Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing access to /retentions for Robot Accounts #16862

Open
keskad opened this issue May 16, 2022 · 6 comments
Open

Missing access to /retentions for Robot Accounts #16862

keskad opened this issue May 16, 2022 · 6 comments
Labels
area/robot-account kind/requirement New feature or idea on top of harbor

Comments

@keskad
Copy link

keskad commented May 16, 2022

Hi, I was trying to use a system RobotAccount that would be able to manage Retention Policies without luck, getting 403 errors.
To workaround this issue I used OIDC account and passed CSRF token, it is a tricky and very dirty workaround.

Question: Is there any undocumented permission that needs to be assigned to RobotAccount that I could be missing?

If there is no such permission, then I'm submitting there a feature request :)

Version: Harbor v2.4.0

Thanks :)

@wy65701436 wy65701436 added area/robot-account kind/requirement New feature or idea on top of harbor labels May 23, 2022
@wy65701436
Copy link
Contributor

please refer to #14145 (comment)

@github-actions
Copy link

github-actions bot commented Jul 5, 2022

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 github-actions bot added the Stale label Jul 5, 2022
@keskad
Copy link
Author

keskad commented Jul 6, 2022

Hi @wy65701436

I just checked it again and I get UNAUTHORIZED error instead of FORBIDDEN whatever I set as permissions.

Here is what I have tried:

  • Setting all permissions on system-level RobotAccount
  • Setting all permissions on project-level RobotAccount

Is this a bug or intended behavior that RobotAccount cannot edit retentions?

@github-actions github-actions bot removed the Stale label Jul 6, 2022
@wy65701436
Copy link
Contributor

please share the payload when you try to create a robot.

@tj-macdonald
Copy link

I'm on harbor v2.7.1 and am having the same issues. I've tried to give * permissions to both system and projects for testing and still get a forbidden response. I've tried other endpoints and have had no issues but all /retentions endpoints except metadatas return forbidden.

The robot account payload is below

{
  "creation_time": "2023-05-09T13:46:02.333Z",
  "disable": false,
  "duration": 90,
  "editable": true,
  "expires_at": 1691415962,
  "id": 64,
  "level": "system",
  "name": "robot-robot-test-2",
  "permissions": [
    {
      "kind": "project",
      "namespace": "*",
      "access": [
        {
          "resource": "repository",
          "action": "list"
        },
        {
          "resource": "repository",
          "action": "pull"
        },
        {
          "resource": "repository",
          "action": "push"
        },
        {
          "resource": "repository",
          "action": "delete"
        },
        {
          "resource": "artifact",
          "action": "read"
        },
        {
          "resource": "artifact",
          "action": "list"
        },
        {
          "resource": "artifact",
          "action": "delete"
        },
        {
          "resource": "artifact-label",
          "action": "create"
        },
        {
          "resource": "artifact-label",
          "action": "delete"
        },
        {
          "resource": "tag",
          "action": "create"
        },
        {
          "resource": "tag",
          "action": "delete"
        },
        {
          "resource": "tag",
          "action": "list"
        },
        {
          "resource": "scan",
          "action": "create"
        },
        {
          "resource": "scan",
          "action": "stop"
        },
        {
          "resource": "helm-chart",
          "action": "read"
        },
        {
          "resource": "helm-chart-version",
          "action": "create"
        },
        {
          "resource": "helm-chart-version",
          "action": "delete"
        },
        {
          "resource": "helm-chart-version-label",
          "action": "create"
        },
        {
          "resource": "helm-chart-version-label",
          "action": "delete"
        },
        {
          "resource":"*",
          "action":"*"
        }
      ]
    },
    {
      "kind":"system",
      "namespace":"*",
      "access":[
        {
          "resource":"*",
          "action":"*"
        }
      ]
    }
  ],
  "update_time": "2023-05-11T20:02:09.179Z",
  "description": null
}

Then I am trying to do a get to /api/v2.0/retentions/3 and the response is 403 forbidden.

@tj-macdonald
Copy link

@wy65701436 would you be able to help provide any insight?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/robot-account kind/requirement New feature or idea on top of harbor
Projects
None yet
Development

No branches or pull requests

3 participants