Skip to content

🛡️ Sentinel: Fix side-channel timing vulnerability in API key verification - #449

Open
ightevenmckane187 wants to merge 1 commit into
mainfrom
sentinel/constant-time-api-key-verification-2947057660451506288
Open

🛡️ Sentinel: Fix side-channel timing vulnerability in API key verification#449
ightevenmckane187 wants to merge 1 commit into
mainfrom
sentinel/constant-time-api-key-verification-2947057660451506288

Conversation

@ightevenmckane187

Copy link
Copy Markdown
Collaborator

🛡️ Sentinel Security Patch:

  • Vulnerability: Non-constant-time string comparison (!=) in verify_api_key (auth.py) exposed the API key authentication gate to side-channel timing analysis attacks.
  • Fix: Substituted string equality operator with hmac.compare_digest(provided_key, CYPHER_API_KEY) to enforce constant-time API key comparisons.
  • Verification: Added test_api_create_share_link_timing_safety in tests/test_share_system.py asserting rejection of invalid keys of various lengths and formats. Updated .gitignore to prevent database test artifacts from tracking. All 24 Python unit tests and 199 Jest tests pass.

PR created automatically by Jules for task 2947057660451506288 started by @ightevenmckane187

Replaces non-constant-time string equality check in `verify_api_key` in `auth.py` with `hmac.compare_digest` to prevent timing side-channel attacks on secret API key comparisons. Adds unit test coverage for invalid key rejection.
@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.

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