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

Detect and warn about conflicting Github Tokens #4475

Open
aunovis-heidrich opened this issue Jan 2, 2025 · 1 comment
Open

Detect and warn about conflicting Github Tokens #4475

aunovis-heidrich opened this issue Jan 2, 2025 · 1 comment
Labels
kind/enhancement New feature or request

Comments

@aunovis-heidrich
Copy link

Is your feature request related to a problem? Please describe.
I kept on receiving the 401 Bad credentials HTTP Code when trying to use scorecard, even though I had exported the GITHUB_TOKEN env var with a fresh PAT. A curl request with the PAT worked fine. Only when I started debugging accessor.go did it dawn to me that somewhere on my machine an expired PAT was exported to GITHUB_AUTH_TOKEN. Scorecard currently uses the first env var that exists, so it ignored my correct PAT and went with the expired one.

Describe the solution you'd like
I would like to check all possible names of env variables and print a warning message if their values conflict.

Describe alternatives you've considered

  • The maximum comfort solution would be to read and try all values until GitHub responds with OK, but I think a warning is a cleaner solution than hiding a somewhat broken environment from the user.
  • You could also ignore this request, but it did take me quite some time to figure out the issue. A warning would have significantly sped up the investigation.

Additional context
If you agree I am willing to implement this as a PR. I am expecting maybe 50 lines of productive code and 50 lines of testcode.

@spencerschrock
Copy link
Member

Thanks for the report, and wanting to save others from the pain.

I would like to check all possible names of env variables and print a warning message if their values conflict.

Would this be only when receiving auth issues (e.g 401)? Or in general?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/enhancement New feature or request
Projects
Status: No status
Development

No branches or pull requests

2 participants