fix: remove hardcoded OAuth client_secret from frontend#1637
Open
hobostay wants to merge 1 commit into
Open
Conversation
The Stack Auth client_secret was hardcoded directly in Login.tsx, exposing it to anyone viewing the source code. OAuth client secrets should never be embedded in frontend code. Move both client_id and client_secret to environment variables: - VITE_STACK_CLIENT_ID - VITE_STACK_CLIENT_SECRET These must be configured in .env files. Added type declarations in vite-env.d.ts. Note: Ideally the token exchange should happen server-side to fully protect the client secret. This PR moves the secret to an env var as a minimal fix — a server-side proxy should be considered for a complete solution. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
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
client_idandclient_secretfromsrc/pages/Login.tsxVITE_STACK_CLIENT_ID,VITE_STACK_CLIENT_SECRET)src/vite-env.d.tspck_t13egrd9ve57tz52kfcd2s4h1zwya5502z43kr5xv5cx8was visible to anyone who could view the page source or inspect the bundled JSSecurity Impact
HIGH — OAuth client secrets should never be embedded in frontend code. This secret could be used to impersonate the application.
Test plan
VITE_STACK_CLIENT_IDandVITE_STACK_CLIENT_SECRETin.env.development🤖 Generated with Claude Code