Skip to content

🛡️ Sentinel: [HIGH] Harden safeEqual against timing side-channel attacks#50

Open
SuvenSeo wants to merge 1 commit into
masterfrom
sentinel/harden-safe-equal-13090750406378637729
Open

🛡️ Sentinel: [HIGH] Harden safeEqual against timing side-channel attacks#50
SuvenSeo wants to merge 1 commit into
masterfrom
sentinel/harden-safe-equal-13090750406378637729

Conversation

@SuvenSeo

@SuvenSeo SuvenSeo commented Jun 1, 2026

Copy link
Copy Markdown
Owner

🚨 Severity: HIGH
💡 Vulnerability: Timing side-channel attack in safeEqual utility.
🎯 Impact: An attacker could perform a timing attack to determine the length of secrets (DASHBOARD_PASSWORD, CRON_SECRET, etc.) and then proceed to brute-force or guess the values more efficiently.
🔧 Fix: Modified safeEqual to hash both inputs with SHA-256 before constant-time comparison using timingSafeEqual. This ensures uniform buffer lengths and prevents length-based timing leaks.
✅ Verification: Ran npm test in the frontend directory. All 34 tests (including auth and webhook verification tests that rely on safeEqual) passed.


PR created automatically by Jules for task 13090750406378637729 started by @SuvenSeo

Modified frontend/src/lib/middleware/auth.js to hash inputs with SHA-256
before constant-time comparison, neutralizing length-based timing leaks.

Co-authored-by: SuvenSeo <263689617+SuvenSeo@users.noreply.github.com>
@google-labs-jules

Copy link
Copy Markdown

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

Copilot AI review requested due to automatic review settings June 1, 2026 19:59
@vercel

vercel Bot commented Jun 1, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
seo-os-agent Ready Ready Preview, Comment Jun 1, 2026 8:00pm

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Hardens the safeEqual helper to eliminate a length-based timing side-channel by hashing both inputs with SHA-256 before performing the constant-time comparison, so the buffers passed to timingSafeEqual always have identical length regardless of input.

Changes:

  • Replace length-check + timingSafeEqual(Buffer.from(a), Buffer.from(b)) with timingSafeEqual(sha256(a), sha256(b)).
  • Add a Sentinel learning note documenting the vulnerability and the fix.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
frontend/src/lib/middleware/auth.js Hash both inputs with SHA-256 before constant-time comparison to remove length leak.
.jules/sentinel.md New Sentinel log entry documenting the timing side-channel vulnerability and prevention guidance.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

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.

2 participants