Trusted Publishers settings silently revert — the form never persists #205321
🏷️ Discussion TypeBug BodyConfiguring OIDC Trusted Publishing on a package appears to succeed but never saves, leaving long-lived granular tokens as the only working option. Steps
ExpectedThe trusted publisher is registered. ActualThe page reports The package access portion of the same form (public/private, 2FA requirement) saves correctly — only the trusted-publisher fields are lost. It looks like those inputs are cleared when the 2FA modal opens, so the submit that follows carries only the package-access values. Environment / notes
Questions
Without trusted publishing, CI needs a bypass-2FA token rotated every 90 days — which is the exact thing trusted publishing is meant to remove. |
Replies: 3 comments 1 reply
|
💬 Your Product Feedback Has Been Submitted 🎉 Thank you for taking the time to share your insights with us! Your feedback is invaluable as we build a better GitHub experience for all our users. Here's what you can expect moving forward ⏩
Where to look to see what's shipping 👀
What you can do in the meantime 💻
As a member of the GitHub community, your participation is essential. While we can't promise that every suggestion will be implemented, we want to emphasize that your feedback is instrumental in guiding our decisions and priorities. Thank you once again for your contribution to making GitHub even better! We're grateful for your ongoing support and collaboration in shaping the future of our platform. ⭐ |
|
@trendai-au npm trust github your-package-name \
--repo owner/repo \
--file publish.yml \
--allow-publishRequirements: npm CLI On question 1 — I couldn't find this exact "fields wiped when the 2FA modal opens" bug already reported publicly, so I can't confirm it's a known, tracked issue rather than something specific to your session. But your own diagnosis (package-access fields survive, trusted-publisher fields don't, and it's reproducible both by hand and via automation) is solid enough to report as a real bug rather than user error — that's not something login/2FA/account health would explain, which you've already ruled out. Worth filing it at npm's own support (https://npmjs.com/support) or the [npm/cli](https://github.com/npm/cli/issues) or [npm/documentation](https://github.com/npm/documentation) repos rather than assuming it's just you — include the repro steps exactly as you wrote them here, that's a clean report. In the meantime, |
|
@nirav-gajera thank you — Recording the two things that still tripped me up, in case they help anyone else landing here: 1. A bypass-2FA granular token can't do it. 2. The OTP escalation URL 404s. With a real (web-login) session, every That URL renders "Route not found!". So on an account whose only 2FA factor is a security key, there's no interactive way to satisfy the OTP. What worked: passing a 2FA recovery code as Single-use, so it costs one code, but it goes straight through and prints the trust config. One CI gotcha too: Net result: package publishes from GitHub Actions via OIDC with a provenance attestation, the bypass-2FA token is revoked and the The original report stands, though — the web form still silently discards its trusted-publisher fields when the 2FA modal opens. |
@trendai-au
Good news on question 2 first, since it's your actual way out of this: yes, there's a CLI route that skips the web form entirely —
npm trust. This isn't a workaround someone hacked together, it's the documented command-line equivalent of the same settings page:Requirements: npm CLI
11.15.0+, 2FA enabled on the account (it'll prompt interactively the first time — via the normal npm 2FA flow, not the web form), and the package must already exist on the registry.npm trust list [package]shows existing config,npm trust revoke --id <id>removes one if you need to replace it (only …