fix(security): audit quick fixes — V2, V3, V13, V14, V15, V16 - #15
Conversation
Replace tokenPreview (first 20 + last 10 chars of bearer tokens) with tokenType + tokenLength. For a 40-char GitHub PAT, the preview leaked 30/40 characters — enough to reconstruct via brute force. Ref: OWASP Logging Cheat Sheet — never log access tokens. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This endpoint was unauthenticated and allowed anyone to probe whether private repositories exist by name, using the GitHub App installation token. Now requires authenticateGitHub like other github routes. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
When a requested secret key was not found, the error response listed ALL available secret keys in that environment. This allowed any user with read access to discover secret names without knowing them. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The webhook error handler was returning error.message to Stripe, potentially leaking internal details (DB errors, service names). Now returns a generic "Processing failed" — the full error is already logged server-side. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
sendDefaultPii: true was sending IP addresses, cookies (including session tokens), and headers to Sentry. For a secrets management platform, session cookies must never be sent to third-party services. Disabled in all 3 Sentry configs: client, edge, and server. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
The error query parameter was displayed verbatim in the UI, allowing attackers to craft URLs with social engineering messages (e.g. "Your account has been compromised, click here..."). Now maps error codes to predefined safe messages. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
📝 WalkthroughWalkthroughAPI routes, middleware, and dashboard configs updated: GitHub auth added to Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~22 minutes Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@packages/dashboard/app/auth/callback/page.tsx`:
- Around line 23-25: The code currently sends the raw, user-controlled
errorParam to analytics; update the error handling in the auth callback to
normalize errorParam against the allowed set (keys of errorMessages or an
explicit knownErrors list), map any unrecognized or empty value to
'unknown_error', use that normalized value when calling
trackEvent(AnalyticsEvents.AUTH_CALLBACK_ERROR, ...), and continue to use
setError(errorMessages[normalized] || 'An unexpected error occurred...') so the
UI still shows a friendly message while telemetry only receives the normalized
code.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: badb50cc-b4f0-4199-b9a7-285e1ed24588
📒 Files selected for processing (8)
packages/backend/src/api/v1/routes/billing.routes.tspackages/backend/src/api/v1/routes/github.routes.tspackages/backend/src/api/v1/routes/secrets.routes.tspackages/backend/src/middleware/auth.tspackages/dashboard/app/auth/callback/page.tsxpackages/dashboard/instrumentation-client.tspackages/dashboard/sentry.edge.config.tspackages/dashboard/sentry.server.config.ts
CodeRabbit review: the raw errorParam from the URL was still sent to PostHog analytics, allowing user-controlled values into telemetry. Now only sends known error codes; unknown values are tracked as "unknown" to prevent high-cardinality noise and data injection. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Summary
Six quick security fixes from the AppSec audit, all low-risk and surgically scoped.
Changes
V2 — Stop logging token preview in auth middleware [Critical]
packages/backend/src/middleware/auth.tstokenPreview(first 20 + last 10 chars of bearer tokens) withtokenType+tokenLengthV3 — Require authentication on
/v1/github/repo-ids[High]packages/backend/src/api/v1/routes/github.routes.tspreHandler: [authenticateGitHub]to the routeV13 — Remove secret name enumeration from error messages [Medium]
packages/backend/src/api/v1/routes/secrets.routes.tsV14 — Generic error in Stripe webhook response [Medium]
packages/backend/src/api/v1/routes/billing.routes.tserror: error.messagetoerror: "Processing failed"in webhook error responseV15 — Disable
sendDefaultPiiin all Sentry configs [Medium]packages/dashboard/instrumentation-client.ts,sentry.edge.config.ts,sentry.server.config.tssendDefaultPii: falsein all 3 Sentry configs (client, edge, server)V16 — Map auth callback errors to predefined messages [Medium]
packages/dashboard/app/auth/callback/page.tsxWhat's NOT in this PR
Test plan
/v1/github/repo-idsreturns 401 without auth header🤖 Generated with Claude Code