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

An unknown error occurred on repository setting page (access to global secrets) #3013

Closed
5 tasks done
zc-devs opened this issue Dec 24, 2023 · 8 comments · Fixed by #3620
Closed
5 tasks done

An unknown error occurred on repository setting page (access to global secrets) #3013

zc-devs opened this issue Dec 24, 2023 · 8 comments · Fixed by #3620
Labels
bug Something isn't working
Milestone

Comments

@zc-devs
Copy link
Contributor

zc-devs commented Dec 24, 2023

Component

server, web-ui

Describe the bug

  1. Optional: Activate a repo in Woodpecker
  2. Open repository without secrets
  3. Go to settings page, General tab
  4. Get error
An unknown error occurred
index-yc-Su7Fu.js:25 
GET https://woodpecker.test.smthd.com/api/secrets?page=1 403 (Forbidden)

There are two requests to the secrets?page=1: one with HTTP 200, another HTTP 403.


If there is at least one secret, then there is no error and only one request to the secrets?page=1 with HTTP 200.

System Info

next-acec955943

Additional context

No response

Validations

  • Read the Contributing Guidelines.
  • Read the docs.
  • Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
  • Checked that the bug isn't fixed in the next version already [https://woodpecker-ci.org/faq#which-version-of-woodpecker-should-i-use]
  • Check that this is a concrete bug. For Q&A join our Discord Chat Server or the Matrix room.
@zc-devs zc-devs added the bug Something isn't working label Dec 24, 2023
@qwerty287
Copy link
Contributor

Is this from a user without admin permissions on the WP instance?

@zc-devs
Copy link
Contributor Author

zc-devs commented Dec 25, 2023

Yes, just general user.

@qwerty287 qwerty287 added this to the 2.2.0 milestone Dec 28, 2023
@zc-devs
Copy link
Contributor Author

zc-devs commented Dec 28, 2023

On 2.1.1 if there is no one secret, then all is the same as on 2.0.

But now, even if there is one secret, error appears when page is scrolled down to the bottom:
Screenshot 2023-12-28 191754
Screenshot 2023-12-28 191818

Actually, maybe it was on 2.0 also and I didn't test scroll 🤔

@zc-devs
Copy link
Contributor Author

zc-devs commented Feb 5, 2024

There are two requests to the secrets?page=1: one with HTTP 200, another HTTP 403.

Corrections:

  1. 200 is to /api/orgs/3/secrets?page=1
  2. 403 is to /api/secrets?page=1, Get the global secret list
  3. There are no global secrets on my instance at all, BTW
  4. The same on Repository's Secrets page.

@anbraten
Copy link
Member

anbraten commented Feb 5, 2024

Ahh, the issue is we query instance secrets to show if the user overrides them, but unfortunately we don't allow normal users to access that endpoint. Not sure why the org endpoint is failing your case. 🤔 Are you not an admin of your org?

@zc-devs
Copy link
Contributor Author

zc-devs commented Feb 5, 2024

Not sure why the org endpoint is failing your case

It was OK 200, I think. I just didn't look carefully inside, my bad.
Screenshot 2024-02-05 1

^ there are
200 to api/repos/22/secrets?page=2
200 to api/orgs/3/secrets?page=1
403 to api/secrets?page=1

Are you not an admin of your org?

Don't know, if I wasn't, but now I am :)

we don't allow normal users to access that endpoint

Yeah. Seems, that's the cause.

@zc-devs zc-devs changed the title An unknown error occurred on repository setting page An unknown error occurred on repository setting page (access to global secrets) Feb 19, 2024
@anbraten
Copy link
Member

I am currently checking how to fix this one. We can either skip the api request in case the user is not an admin or we allow every user to get (read-only) the global secrets as they don't include the actual value and will be available in the pipeline anyway.

@qwerty287
Copy link
Contributor

we allow every user to get (read-only) the global secrets as they don't include the actual value and will be available in the pipeline anyway.

I'd go with this way.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants