mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
Labels
No labels
needs-format
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Niko1221/Strata#5079
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/Niko1221/Strata/pull/4535
Author: @schmittcn
Created: 10/28/2026
Status: ❌ Closed
Base:
main← Head:pr/host-key-constant-time📝 Commits (1)
ae6283capps/host: the shared listener compares the API key in constant time (as the engine since #213)📊 Changes
2 files changed (+32 additions, -2 deletions)
View changed files
📝
apps/host/server/serving.mjs(+6 -2)➕
apps/host/tests/serving-key-compare.test.mjs(+26 -0)📄 Description
Problem and result
serving.authorized()inapps/host/server/serving.mjscompares the API key with===. The local share listener and the Cloudflare tunnel origin use this check. On the tunnel it faces the internet, andSECURITY.mdsays the key "is compared in constant time". The engine has done that since #213 (key_matches,hmac.compare_digest); the app's host never did.Both values are now hashed with SHA-256 and compared with
crypto.timingSafeEqual. Neither the key's content nor its length can end the comparison early. Both the Bearer and thex-api-keyheader are compared on every request, so the time doesn't show which one was sent. Nothing else changes: the same headers pass, and no key set still means open access (the 0.2.2 decision).This is hardening, not an observed attack. Timing a single
===over a network and through Cloudflare is hard, and the generated key has 96 random bits.Validation
Revision:
upstream/mainat46c152a1, Linux, Node 26.9.0.node --test tests/serving-key-compare.test.mjs tests/serving-key-optional.test.mjsinapps/host. The new test covers: Bearer passes;x-api-keypasses; a missing header, an empty Bearer, a wrong key, a prefix of the key, the key plus one character, and a key withoutBearerall fail; a wrong Bearer together with the rightx-api-keypasses, as before.npm testinapps/host(afternpm ci): 1226 tests, 1119 passed, 2 failed, 105 skipped. Unmodifiedmaingives the same two failures (1225 tests, 1118 passed), so they are not from this change:packaged: an update job an OLDER host left running is finished when the app program file is newer than the jobStop ends the job and everything it started, deletes the copies, leaves the person's files alone, and the run then reads as cancelled🤖 Generated with Claude Code
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.