fix: inject auth token into generated .env.sentry-build-plugin files#706
Merged
MathurAditya724 merged 2 commits intomainfrom Apr 10, 2026
Merged
fix: inject auth token into generated .env.sentry-build-plugin files#706MathurAditya724 merged 2 commits intomainfrom
MathurAditya724 merged 2 commits intomainfrom
Conversation
Closes getsentry/cli-init-api#72 The server-side AI codemod planner generates .env.sentry-build-plugin with an empty SENTRY_AUTH_TOKEN= because it never has access to the user's auth token (by design — the token is only used as an HTTP Authorization header). This change makes the CLI fill in the token client-side during patchset application. When a created env file contains an empty SENTRY_AUTH_TOKEN=, the locally-available auth token is injected before writing to disk. The token never leaves the client.
Contributor
Semver Impact of This PR🟢 Patch (bug fixes) 📋 Changelog PreviewThis is how your changes will appear in the changelog. New Features ✨Docs
Other
Bug Fixes 🐛Dashboard
Other
Internal Changes 🔧
🤖 This preview updates automatically when you update the PR. |
Contributor
|
Contributor
Codecov Results 📊✅ 134 passed | Total: 134 | Pass Rate: 100% | Execution Time: 0ms 📊 Comparison with Base Branch
✨ No test changes detected All tests are passing successfully. ✅ Patch coverage is 100.00%. Project has 1573 uncovered lines. Coverage diff@@ Coverage Diff @@
## main #PR +/-##
==========================================
+ Coverage 95.31% 95.31% —%
==========================================
Files 230 230 —
Lines 33501 33520 +19
Branches 0 0 —
==========================================
+ Hits 31928 31947 +19
- Misses 1573 1573 —
- Partials 0 0 —Generated by Codecov Action |
String.replace() with a string replacement pattern interprets $-sequences ($1, $$, $&, etc.) specially. If an auth token contained a $ character, it could be misinterpreted. Using a function replacement avoids this entirely.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
wizard-runner.tsthrough tolocal-ops.tsvia a newauthTokenfield onWizardOptionsSENTRY_AUTH_TOKEN=, the CLI injects the locally-available auth token before writing to disk.env*files and only fills in empty values — non-empty values are never overwrittenCloses getsentry/cli-init-api#72