Skip to content

fix: use timing-safe compare for cron secret#396

Merged
ArnasDon merged 1 commit into
ArnasDon:mainfrom
opastorello:fix/cron-timing-safe
Jul 17, 2026
Merged

fix: use timing-safe compare for cron secret#396
ArnasDon merged 1 commit into
ArnasDon:mainfrom
opastorello:fix/cron-timing-safe

Conversation

@opastorello

Copy link
Copy Markdown
Contributor

Summary

Use timing-safe string comparison for cron secret validation to prevent timing attacks.

What changed

File: src/app/api/automations/cron/route.ts

  • Import timingSafeEqual from node:crypto
  • Replace simple string equality with constant-time comparison
  • Match the pattern already used in flows cron endpoint

Why

Simple string comparison leaks timing information — an attacker with network access could measure response latency and recover AUTOMATION_CRON_SECRET byte-by-byte.

Test plan

  • typecheck + lint clean
  • Pattern matches flows cron implementation

Match flows cron implementation (timingSafeEqual).
@opastorello
opastorello requested a review from ArnasDon as a code owner July 16, 2026 16:03
@ArnasDon
ArnasDon merged commit 96e60ad into ArnasDon:main Jul 17, 2026
1 check passed
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