-
Notifications
You must be signed in to change notification settings - Fork 2.9k
fix(forgejo): support fallback for all forgejo-* host types
#39968
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
Conversation
|
2franix seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account. You have signed the CLA already but the status is still pending? Let us recheck it. |
Not sure why the CLA bot changed its mind. I did sign the CLA and the email address stored in my commits are now linked to my GH account. |
|
Hi there, You are using Good luck, The Renovate team |
|
🎉 This PR is included in version 42.58.3 🎉 The release is available on:
Your semantic-release bot 📦🚀 |
Changes
When running renovate against my self-hosted forgejo instance, I noticed that some requests to forgejo API were not properly authenticated and were failing with 403. My config file was:
I was also setting the
RENOVATE_TOKENenv var with a valid token. As a user, I am expecting this to be sufficient for any API call targeting my instance.After some investigation, I noticed that requests with
hostType: 'forgejo'were authenticated and successful but those withhostType: 'forgejo-tags'were left unauthenticated and failing. I noticed that adding an explicit host rule withhostType: 'forgejo-tags'and proper authentication was indeed making the calls succeed. But as a user, I don't expect to have to repeat my token for each and every host subtype.I dug a little more in the code and found -I think- the cause of the bug:
lib/util/http/host-rules.tsis not applying any fallback mechanism like it does for gitea. Since gitea and forgejo are still very close to one another in terms of behavior, that does not seem right. I added the fallback and my 403 errors went away.When investigating, I found another place where a fallback was present for gitea but was missing for forgejo:
lib/util/http/auth.tsapplies bearer auth if a token is present. I figured this deserved a fix as well but that does not seem to have any impact on my issue, so I am not quite sure if this change is relevant or not. Hopefully you can :)Disclaimer
I humbly confess I did not understand all the ins and outs of authentication in renovate. I used my intuition and common sense to hopefully fix what I believe to be a bug in renovate. But give me your honest feedback about both changes. If they should deserve separate PRs or if they are not ideal, I am happy to improve the PR.
Context
Please select one of the following:
AI assistance disclosure
Did you use AI tools to create any part of this pull request?
Please select one option and, if yes, briefly describe how AI was used (e.g., code, tests, docs) and which tool(s) you used.
Documentation (please check one with an [x])
How I've tested my work (please select one)
I have verified these changes via:
The public repository: none. I used a private repo.