Skip to content

🛡️ Sentinel: [HIGH] Fix timing side-channel vulnerability in constant time comparison#301

Draft
EffortlessSteven wants to merge 2 commits intomainfrom
sentinel-constant-time-eq-2038802240454213054
Draft

🛡️ Sentinel: [HIGH] Fix timing side-channel vulnerability in constant time comparison#301
EffortlessSteven wants to merge 2 commits intomainfrom
sentinel-constant-time-eq-2038802240454213054

Conversation

@EffortlessSteven
Copy link
Member

🚨 Severity: HIGH
💡 Vulnerability: The constant_time_eq method manually implemented a constant-time comparison via byte folding. However, manual bitwise comparisons in Rust are vulnerable to timing side-channels due to compiler optimizations like auto-vectorization and short-circuiting.
🎯 Impact: Attackers could potentially perform timing side-channel attacks to guess basic authentication tokens character-by-character if the compiler optimized the comparison in a way that leaked timing information about early mismatches.
🔧 Fix: Added the industry-standard subtle crate to http-auth-verifier and updated constant_time_eq to use the ConstantTimeEq trait, which guarantees constant-time comparison utilizing compiler black-boxes.
✅ Verification: Ran cargo test -p http-auth-verifier which passed, confirming that the new logic maintains functional equivalence while gaining the constant-time guarantees from subtle.


PR created automatically by Jules for task 2038802240454213054 started by @EffortlessSteven

… time comparison

Replaced manual byte folding with the `subtle` crate's `ConstantTimeEq` to
guarantee constant-time evaluation and prevent timing side-channel attacks
in basic token verification.
@google-labs-jules
Copy link

👋 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.

@gemini-code-assist
Copy link

Warning

You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again!

@coderabbitai
Copy link

coderabbitai bot commented Mar 22, 2026

Important

Review skipped

Review was skipped due to path filters

⛔ Files ignored due to path filters (1)
  • Cargo.lock is excluded by !**/*.lock

CodeRabbit blocks several paths by default. You can override this behavior by explicitly including those paths in the path filters. For example, including **/dist/** will override the default block on the dist directory, by removing the pattern from both the lists.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro

Run ID: 9109d8f1-96aa-4a9f-9714-5487dd4843d1

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Walkthrough

The pull request replaces a manual constant-time string comparison implementation with the subtle crate's ConstantTimeEq trait. A dependency is added to Cargo.toml, and the constant_time_eq function is refactored to use the library's provided constant-time equality method.

Changes

Cohort / File(s) Summary
Dependency Addition
crates/http-auth-verifier/Cargo.toml
Added subtle = "2.6.1" as a new dependency to support constant-time operations.
Constant-Time Comparison Refactor
crates/http-auth-verifier/src/lib.rs
Replaced manual XOR/fold-based byte comparison with subtle::ConstantTimeEq::ct_eq() for improved code reliability and maintainability. Added corresponding import statement.

Estimated Code Review Effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

🐰 A leap to subtler ground we make,
Where timing's secrets none can break,
A trusted crate now guards our way,
Constant and secure, come what may! 🔐

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly identifies the main change: fixing a timing side-channel vulnerability in constant-time comparison using the subtle crate.
Description check ✅ Passed The description comprehensively explains the vulnerability, its impact, the fix applied, and verification performed—all directly related to the changeset.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch sentinel-constant-time-eq-2038802240454213054

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

… time comparison

Replaced manual byte folding with the `subtle` crate's `ConstantTimeEq` to
guarantee constant-time evaluation and prevent timing side-channel attacks
in basic token verification. Also bumped `rustls-webpki` to v0.103.10 to resolve
RUSTSEC-2026-0049.
@github-actions
Copy link

Test Results

283 tests   245 ✅  11m 12s ⏱️
 25 suites   38 💤
  1 files      0 ❌

Results for commit cd8bb79.

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