#23985·harbor

Robot account that creates a project should automatically receive permissions on the project it created

Author: SiebeVECreated Sep 22, 2026Updated Sep 28, 2026
Labelskind/requirement

Is your feature request related to a problem? Please describe. We have a shared Harbor instance that hosts many private projects, one per team. We want each team's automation to use a robot account that can create its own project and then fully manage (push, pull, configure, create sub-robot-accounts for) the project it created, while having no access to any other team's project. Today this is not possible:

  • A robot account with the system-level project:create permission can create a project, but it receives no permissions on the project it just created. In CreateProject (src/server/v2.0/handler/project.go), when the caller is a robot the project's owner is set to an arbitrary system admin user, and nothing links the robot to the new project.
  • The robot cannot bootstrap itself afterwards:
    • Adding itself as a project member (POST /projects/{id}/members) requires member-create permission on the new project, which the robot does not have.
    • Updating its own permissions (PUT /robots/{id}) is rejected by isValidPermissionScope (src/server/v2.0/handler/robot.go), which requires the new permission set to be a subset of the robot's current permissions. Without the /project/* "Cover all projects" scope, a robot can never add a newly created project to its own scope.
  • The only working workaround is a system robot with the "Cover all projects" (/project/*) scope, but that grants the robot its permissions on every existing and future project of the instance. This defeats multi-tenancy isolation: team A's robot would hold push/pull/configure rights on team B's projects. Human users do not have this problem: a regular user who creates a project automatically becomes its owner. We would like equivalent "creator becomes owner" semantics for robot accounts.

Describe the solution you'd like A supported way for a robot account that creates a project to automatically hold a configurable set of permissions (e.g., the equivalent of project admin, or the robot's configured project permissions) on only that project, without holding permissions on any other project.

Describe the main design/architecture of your solution Preferred option: auto-grant on creation:

  • When the caller of POST /projects is a robot account (system-level robot with the project:create permission), persist a robot_permission row for the creator robot scoped to the new project ID (/project/), with the access set derived from a configurable template, e.g. "robots that create projects receive project-admin permissions".
  • This mirrors the owner semantics human users already get, keeps robot permission evaluation entirely within the existing static-policy model (src/common/security/robot/context.go), requires no new evaluator logic, and the grant remains visible/editable/deletable through the existing robot API and audit logs.

Describe the development plan you've considered

  • Add a configuration option defining the permission set granted to creator robots (default: project admin, or disabled to preserve current behavior).
  • In CreateProject, when the security context is a robot security context, create the corresponding robot_permission record in the same transaction as project creation.
  • Add/extend API and UI tests: robot creates project → robot can push/pull/configure the created project → robot still cannot access other projects.
  • Update the robot account documentation to describe the new behavior.

Additional context Issue created with help of AI.

Related issues:

  • #14145: Robot account with advanced permissions (notes that system and project permissions cannot be mixed, and a robot that creates a project has no access to it)