skip to content

In a repository manager, how do you scope read, deploy and delete rights, and why should CI publish with a token, not a password?

level: middleimportance: must knowfreq 58%

answer

  1. least privilege, per repository
  2. readers wide, writers narrow
  3. delete rights for very few
  4. non-human identity for pipelines
  5. Harbor robot accounts expire

basics

~20 s

Grant rights per repository: wide read, deploy only to the hosted repositories a team owns, delete and admin to few. CI publishes as a dedicated non-human identity with a scoped, expiring, revocable token, so no person's password lives in pipelines.

solid answer

~50 s

Start from least privilege, per repository and, where the product supports it, per path: consumers get **read** (usually through the group URL), each team's CI gets **deploy** only to that team's hosted repositories, **delete** and overwrite go to a handful of release owners, and **admin** stays with the platform team. Keep anonymous access off unless a repository is meant to be public. Artifactory governs access through permission targets; Harbor applies roles per project, where a Developer can push and a Maintainer can also delete; in Nexus Repository a privilege on a group reaches its members only for requests sent to the group URL. Pipelines should authenticate as a **non-human identity**: a Harbor robot account (project-scoped or system-wide, no UI login, 30-day expiry by default) or a dedicated Artifactory service user with an identity token. A token is scoped, rotatable and revocable, and survives people leaving.

go deeper

for a junior

Recall the four rights (read, deploy, delete, admin) and that CI should publish with its own token, never an engineer's password.

for a middle

Explain how one product expresses scope: Harbor project roles and robot accounts, Artifactory permission targets, or Nexus privileges and the group-URL rule. Say why tokens beat passwords: scope, rotation, revocation, attribution.

for a senior

Design grants for a real org: deploy only to each team's hosted repositories, delete for release owners, anonymous off, robot accounts with expiry, and a plan for rotation and leaked tokens.

for a principal

Weigh central control against team autonomy: who may create repositories and issue tokens, how often grants are reviewed, and how the repository manager's identity ties into the organisation's identity provider.

## What you are protecting A repository manager is the place every build trusts. Whoever can **write** to a release repository can change what production runs; whoever can **delete** from it can break every rebuild of an old version; whoever is **admin** can change the rules for everyone. Read access matters too, because internal artifacts often contain proprietary code. So permission design on a repository manager is about keeping each of those four rights as narrow as the work allows. ## The four rights and who gets them - **Read** - developers, CI and deployment systems that consume artifacts. Usually granted on the group URL that builds resolve through, sometimes organisation-wide for shared libraries. - **Deploy** (publish) - the CI identity of the team that owns a hosted repository, and nobody else. A team that can publish into another team's repository can impersonate that team's releases. - **Delete and overwrite** - a small set of release owners or an automated retention process. Released versions should not be overwritten at all; the right to do so should be rare and audited. - **Admin** - the platform team that runs the repository manager: creating repositories, changing permissions, configuring upstreams. Two further rules apply everywhere: 1. **Anonymous access off by default.** Several products can serve some repositories to anonymous users; turn that on only for repositories that are meant to be public. 2. **Scope by repository first, then by path** where the product supports path patterns, so a team's rights end at its own namespace. ## How the products express it | Product | Unit of access | Notable rule | |---|---|---| | Artifactory | permission targets over repositories | access to package content is governed by permission targets; Annotate permission is needed to add or edit properties | | Nexus Repository | privileges per repository | a privilege on a group repository reaches its members only when the request goes to the group URL; a direct request to a member needs its own privilege | | Harbor | roles per project | Limited Guest and Guest pull; Developer can also push; Maintainer can also scan and delete images; Project Admin manages members and settings | The Nexus rule surprises people. A user who can read `maven-public` can download a component through the group, but the same user requesting the hosted member's own URL is refused unless that member was granted explicitly. That is deliberate: the group URL becomes the controlled entry point. ## Why CI should not use a person's password A pipeline that publishes with an engineer's own login has several problems at once: - the credential carries **everything that person can do**, not just publishing to one repository; - it sits in CI secrets, logs and build agents, where a leak exposes a human account; - it **breaks the day the person leaves** or changes their password; - the audit trail says a person published, when a machine did. The fix is a **non-human identity** with a token: - **Harbor robot accounts.** A project robot account can act only inside its project; a system robot account, created by an administrator, can be granted permissions across several projects or all of them. Robot accounts cannot log in to the Harbor interface. Their names carry a prefix, `robot$` by default, which is how Harbor tells them apart from user accounts. By default they expire after 30 days, though an administrator can change the period or choose never to expire. Harbor does not store the secret, so it must be copied when the account is created. Push permission can only be granted together with pull. - **Artifactory service users and identity tokens.** Artifactory's documentation recommends an identity token over a user password for configuring clients. For CI, give the pipeline its own service user, grant that user deploy rights on its hosted repositories only, and issue the token to it. - **Nexus Repository** follows the same principle: a dedicated user or role for the pipeline, with privileges limited to the repositories it publishes to. Tokens win because they can be **scoped** to one repository or project, **rotated** on a schedule, **revoked** instantly after a leak, and **attributed** to the pipeline in audit logs. ## A layout that works For a team publishing to a hosted Maven repository and a Harbor project: 1. Developers: read on the group URL and on the Harbor project. 2. The team's CI identity: deploy on the team's hosted repository; a Harbor robot account with push and pull on the team's project only. 3. Release owners: delete rights, used rarely and through a reviewed process. 4. Platform team: admin, with personal accounts protected by the organisation's identity provider. Review the grants on a schedule. Permissions on a repository manager tend to grow and never shrink, and an unused CI token with deploy rights is the cheapest way into your release repositories.

  • A CI robot account in Harbor suddenly gets authentication errors on every push, though nothing changed in the pipeline. What would you check first?
    Its expiry. Harbor robot accounts expire after a configured period, 30 days by default, unless they were created as never expiring. Check the account's expiration time and enabled status in the project or system robot account list, then restore access (re-enable it, or replace an expired account with a new one) and update the pipeline's secret store. Harbor cannot show an old secret again, though it can refresh one.
  • Why grant read on the group URL rather than on every member repository?
    It makes the group the controlled entry point. In Nexus Repository a group privilege covers its members only for requests sent to the group, so clients cannot bypass it to reach, say, a hosted snapshot repository directly. New members join the group without a new grant, and audit logs show one place where reads happen.
  • Why should delete rights on a release repository be rarer than deploy rights?
    A deploy adds a new version; a delete removes one that builds, rollbacks and audits may still depend on. Deleting a released version silently breaks every rebuild that pins it. Keep delete with a few release owners or an automated retention process that is reviewed, and keep overwrite of released versions disabled.

  • Give CI an engineer's own login; it already has the rights it needs.
  • A privilege on a Nexus group lets you read every member through any URL.
  • Every developer needs deploy rights so they can publish fixes quickly.
  • Harbor can show a robot account's secret again whenever a pipeline loses it.
  • Anonymous read is harmless because artifacts are only binaries.