Skip to content

fix: remove hardcoded OAuth client_secret from frontend#1637

Open
hobostay wants to merge 1 commit into
eigent-ai:mainfrom
hobostay:fix/hardcoded-client-secret
Open

fix: remove hardcoded OAuth client_secret from frontend#1637
hobostay wants to merge 1 commit into
eigent-ai:mainfrom
hobostay:fix/hardcoded-client-secret

Conversation

@hobostay
Copy link
Copy Markdown

Summary

  • Remove hardcoded Stack Auth client_id and client_secret from src/pages/Login.tsx
  • Move both values to environment variables (VITE_STACK_CLIENT_ID, VITE_STACK_CLIENT_SECRET)
  • Add TypeScript declarations for the new env vars in src/vite-env.d.ts
  • The hardcoded secret pck_t13egrd9ve57tz52kfcd2s4h1zwya5502z43kr5xv5cx8 was visible to anyone who could view the page source or inspect the bundled JS

Security Impact

HIGH — OAuth client secrets should never be embedded in frontend code. This secret could be used to impersonate the application.

Test plan

  • Set VITE_STACK_CLIENT_ID and VITE_STACK_CLIENT_SECRET in .env.development
  • Verify Stack Auth login flow still works end-to-end
  • Verify the secret is no longer visible in the bundled JS output

🤖 Generated with Claude Code

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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant