-
Notifications
You must be signed in to change notification settings - Fork 49
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
Default GITHUB_TOKEN permissions are not not enough to fetch alerts #34
Comments
@roimor if you curl the endpoint with a EDIT: I appear to be running into the same problem now, I wonder when this behaviour changed 🤔 |
The README was updated to reflect this issue. According to the list endpoint, you must be an admin of the repo/org and the token must have the security scope. https://docs.github.com/en/rest/reference/secret-scanning#list-secret-scanning-alerts-for-a-repository That's why the PAT works and the permissions of the GITHUB_TOKEN doesn't. I believe this extends to users who were given access to the alerts by an admin too 🤔 |
@cmboling quoting from the README line 25-26: ... The docs are still misleading. @AWNCypher indeed, before i opened this issue i tried running curl with the default token and run into the same problem. |
Ok I can clear up the docs, no problem! @roimor are you an admin of the repo that you're testing? |
I am the org admin, and yes that is partially the workaround.. while you also need to be repository admin |
Dropping a comment here - we had this issue, and it wound up being that our org has SAML enforcement that prevented PATs even with full permissions from accessing org resources. You need to authorize the PAT specifically for this use case. Also want to say that GH documents the ability to scope the Actions GITHUB_TOKEN to security-events but the default token did not appear to work even with that scope included. It would probably be helpful if raise_for_status printed the error message. |
The README mentions that "For accessing the Code Scanning alert data, the action uses the GITHUB_TOKEN which is automatically created for you, so you don't need to provide it".
But in reality i had to manually create another PAT and use it like that for the actions to successfully fetch security alerts:
when not adding the manually created PAT i get the following error:
requests.exceptions.HTTPError: 403 Client Error: Forbidden for url: https://api.github.com/repos/neosec-com/neosec-frontend/secret-scanning/alerts?per_page=100
The text was updated successfully, but these errors were encountered: