Skip to content

πŸ›‘οΈ Sentinel: HIGH Fix Timing Attack in Codex Auth - #862

Open
Mihir-Rabari wants to merge 2 commits into
mainfrom
sentinel-fix-timing-attack-codex-auth-11433560090034243071
Open

Mihir-Rabari wants to merge 2 commits into
mainfrom
sentinel-fix-timing-attack-codex-auth-11433560090034243071

Conversation

@Mihir-Rabari

Copy link
Copy Markdown
Owner

🚨 Severity: HIGH
πŸ’‘ Vulnerability: In apps/auth-service/src/routes/codexRoutes.ts, a simple string comparison (clientSecret !== internalSecret) was used for verifying the internal service secret in the Codex authentication flow. This exposes the system to timing-based side-channel attacks, because string equality checks short-circuit on the first mismatched character.
🎯 Impact: An attacker could potentially discover the internal service secret byte-by-byte by carefully measuring the API response times of failed requests, leading to unauthorized access.
πŸ”§ Fix: Replaced the direct string comparison with Node.js's crypto.timingSafeEqual(). Buffered both secrets and explicitly checked for length equality before the comparison to ensure constant-time execution independent of the input values and avoid TypeError on mismatched buffer lengths. Included an inline Sentinel comment.
βœ… Verification: Verified using workspace wide pnpm test and specific cd apps/auth-service && pnpm test. Checked that formatting and linting pass for the specific modified service using pnpm format and pnpm lint --filter auth-service. The patch introduces no new regressions.


PR created automatically by Jules for task 11433560090034243071 started by @Mihir-Rabari

Replaced simple string equality check with constant-time crypto.timingSafeEqual() to prevent timing-based side-channel attacks on the internal service secret.

Co-authored-by: Mihir-Rabari <169349389+Mihir-Rabari@users.noreply.github.com>
@google-labs-jules

Copy link
Copy Markdown
Contributor

πŸ‘‹ Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a πŸ‘€ emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

Replaced simple string equality check with constant-time crypto.timingSafeEqual() to prevent timing-based side-channel attacks on the internal service secret.

Co-authored-by: Mihir-Rabari <169349389+Mihir-Rabari@users.noreply.github.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