Skip to content

fix: harden HTTP request security against downgrade and timing attacks#116

Merged
John-David Dalton (jdalton) merged 1 commit intomainfrom
fix/http-security-hardening
Mar 28, 2026
Merged

fix: harden HTTP request security against downgrade and timing attacks#116
John-David Dalton (jdalton) merged 1 commit intomainfrom
fix/http-security-hardening

Conversation

@jdalton
Copy link
Copy Markdown
Collaborator

Summary

  • HTTPS-to-HTTP redirect downgrade protection: Both httpDownloadAttempt and httpRequestAttempt now reject redirect responses that attempt to downgrade from HTTPS to HTTP
  • Constant-time hash comparison: SHA256 checksum verification in httpDownload now uses crypto.timingSafeEqual instead of string !== to prevent timing side-channel attacks
  • Randomized temp file paths: Download temp files now use crypto.randomBytes(6) hex suffix instead of a predictable .download extension, preventing symlink/race attacks
  • Constant-time integrity comparison in dlx/binary: SRI integrity verification now uses crypto.timingSafeEqual instead of string !==

Test plan

  • test/unit/http-request.test.mts — 100 tests pass
  • test/unit/dlx/binary.test.mts — 47 tests pass, 3 skipped (pre-existing)
  • Lint and type-check pass

@jdalton John-David Dalton (jdalton) merged commit efca0fb into main Mar 28, 2026
11 checks passed
@jdalton John-David Dalton (jdalton) deleted the fix/http-security-hardening branch March 28, 2026 20:31
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