(janitor/dedupe): consolidate constant-time secret comparison onto @kilocode/encryption - #5829
Open
kilo-code-bot[bot] wants to merge 1 commit into
Open
(janitor/dedupe): consolidate constant-time secret comparison onto @kilocode/encryption#5829kilo-code-bot[bot] wants to merge 1 commit into
kilo-code-bot[bot] wants to merge 1 commit into
Conversation
…ilocode/encryption Six Cloudflare Worker services each reimplement the same constant-time string comparison for internal-secret auth, either via a TextEncoder + node:crypto timingSafeEqual length-guard or a SHA-256 digest + timingSafeEqual dance. @kilocode/encryption already owns a tested timingSafeEqual that performs the length-guard comparison and is used by nine other workers, so point the stragglers at it and delete the local copies. No behavior change: comparisons remain constant-time and fail closed on missing/empty input. Validated with tsgo typecheck and oxlint on the six affected services.
Contributor
Author
Code Review SummaryStatus: No Issues Found | Recommendation: Merge Executive SummarySix Workers now call the existing Files Reviewed (13 files)
Reviewed by grok-4.6 · Input: 126.9K · Output: 12K · Cached: 441.5K Review guidance: REVIEW.md from base branch |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Six Cloudflare Worker services each reimplement the same constant-time secret comparison for internal-secret auth.
@kilocode/encryptionalready owns a testedtimingSafeEqualand is used by nine other workers, so this PR points the stragglers at it and deletes the local copies.Changes
services/notifications,services/session-ingest— replace the inlineTextEncoder+node:cryptolength-guard block withtimingSafeEqual(provided, expected).services/model-eval-ingest,services/security-sync,services/security-auto-analysis— delete the local SHA-256-digesttimingSafeEqualhelpers;user-data-exportdrops the inline digest comparison inauthorized.@kilocode/encryptionto the six services'package.json(all already runnodejs_compat).No behavior change: comparisons stay constant-time and fail closed on missing/empty input.
Verification
tsgo --noEmitpasses for all six affected services.oxlinton the six changed source files: 0 warnings, 0 errors.@cloudflare/vitest-pool-workersor integration suites in this environment (workers test pool + Postgres/Redis unavailable).