harbor icon indicating copy to clipboard operation
harbor copied to clipboard

Making a robot via /projects/{project_name_or_id}/robots is broken

Open Kajot-dev opened this issue 1 year ago • 5 comments

This endpoint does not parse permissions correctly: Try to create a robot in your project via /projects/{project_name_or_id}/robots with this payload:

{
  "name": "puller",
  "description": "Project puller. Created automatically.",
  "expires_at": -1,
  "access": [
    {
      "resource": "repository",
      "action": "pull",
      "effect": null
    }
  ]
}

This returns 400 with pull action of repository resource not exist in project <project_name>

However creating exactly the same robot via /robots endpoint works perfectly. Working payload:

{
  "name": "puller",
  "description": "Project puller. Created automatically.",
  "level": "project",
  "duration": -1,
  "permissions": [
    {
      "access": [
        {
          "resource": "repository",
          "action": "pull",
          "effect": null
        }
      ],
      "kind": "project",
      "namespace": "<project_name>"
    }
  ]
}

Kajot-dev avatar Jul 03 '24 20:07 Kajot-dev

can you clarify the problem? It seems that the creation was successfully with the correct payload.

wy65701436 avatar Jul 08 '24 08:07 wy65701436

Payload is correct in both examples (it is different since it uses different api ednpoints). But endpoint /robots works, but /projects/{project_name_or_id}/robots does not.

It should succeed in both examples.

Kajot-dev avatar Jul 08 '24 17:07 Kajot-dev

To reproduce just try to create a robot via /projects/{project_name_or_id}/robots (a one which haves some permissions) - it's not possible from my testing

Kajot-dev avatar Jul 08 '24 17:07 Kajot-dev

I've encountered same problem along with the inability to create project robot accounts under non-admin user (user has Project Admin privilege)

dmakeienko avatar Aug 16 '24 13:08 dmakeienko

This issue is being marked stale due to a period of inactivity. If this issue is still relevant, please comment or remove the stale label. Otherwise, this issue will close in 30 days.

github-actions[bot] avatar Oct 16 '24 09:10 github-actions[bot]

This issue was closed because it has been stalled for 30 days with no activity. If this issue is still relevant, please re-open a new issue.

github-actions[bot] avatar Nov 16 '24 09:11 github-actions[bot]