-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
docs(js): Quick Start guides: Auth tokens in env files #14159
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
base: master
Are you sure you want to change the base?
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
Bundle ReportChanges will decrease total bundle size by 268.95kB (-1.22%) ⬇️. This is within the configured threshold ✅ Detailed changes
Affected Assets, Files, and Routes:view changes for bundle: sentry-docs-server-cjsAssets Changed:
view changes for bundle: sentry-docs-client-array-pushAssets Changed:
|
…ick-start/clean-up-authtoken
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good! 🎸
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I looked specifically on the Nuxt code, that's perfect 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Solidstart looking... solid 😅
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bug: Vite Misconfiguration Exposes Sentry Auth Token
The Sentry auth token is exposed to the client-side. The documentation incorrectly advises storing the token as VITE_SENTRY_AUTH_TOKEN
and accessing it via import.meta.env.VITE_SENTRY_AUTH_TOKEN
in vite.config.ts
. Vite exposes all VITE_
prefixed environment variables to the client bundle, making the sensitive token publicly accessible. In vite.config.ts
(which runs server-side during build), the token should be stored as SENTRY_AUTH_TOKEN
and accessed using process.env.SENTRY_AUTH_TOKEN
.
docs/platforms/javascript/guides/react-router/index.mdx#L414-L432
sentry-docs/docs/platforms/javascript/guides/react-router/index.mdx
Lines 414 to 432 in 842de7a
// store it in an environment variable to keep it secure. | |
authToken: import.meta.env.VITE_SENTRY_AUTH_TOKEN, | |
// ... | |
}; | |
export default defineConfig(config => { | |
return { | |
+ plugins: [reactRouter(),sentryReactRouter(sentryConfig, config)], | |
}; | |
}); | |
``` | |
To keep your auth token secure, always store it in an environment variable instead of directly in your files: | |
<OrgAuthTokenNote /> | |
```bash {filename:.env} | |
VITE_SENTRY_AUTH_TOKEN=___ORG_AUTH_TOKEN___ | |
``` |
Was this report helpful? Give feedback by reacting with 👍 or 👎
In this PR, I've updated the Source Maps section in the Quick Start guides (manual setup) to ensure we recommend storing the Sentry auth token in an environment file instead of directly in the config files.
Updated for SDKs:
Closes: #13896
DESCRIBE YOUR PR
Tell us what you're changing and why. If your PR resolves an issue, please link it so it closes automatically.
IS YOUR CHANGE URGENT?
Help us prioritize incoming PRs by letting us know when the change needs to go live.
SLA
Thanks in advance for your help!
PRE-MERGE CHECKLIST
Make sure you've checked the following before merging your changes:
EXTRA RESOURCES