Repository navigation
fix(service-storage): stored bytes are previewed in place only when they begin with their type's signature - #36768
Conversation
…hey begin with their type's signature Co-authored-by: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01ASNY8XNef4ywkQio6S9ju4
…e rule Co-authored-by: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01ASNY8XNef4ywkQio6S9ju4
…ule level Co-authored-by: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01ASNY8XNef4ywkQio6S9ju4
📓 Docs Drift CheckThis PR changes 1 package(s): 7 hand-written doc(s) NAME something this change touched and may need an implementation-accuracy re-verification:
⛔ 2 release-owned page(s) also name something this change touched. These are read-only:
What this run could not see
Coarse fallback — 10 page(s) merely mention a changed package (the pre-#9192 predicate, kept for the deliberately-wide backstop): Which tree this was computed onThis run read A worktree cut from an older # while this PR is open — GitHub drops the merge commit once it closes
git fetch origin 8f895798a9bd09a6f09bbb73d3aa0f534cf5decd && git checkout 8f895798a9bd09a6f09bbb73d3aa0f534cf5decd
# afterwards, rebuild it from the two parents, which stay fetchable
git fetch origin 7e586a9da4e610a118d842576c3af9ed6efe805a 208f25e01f9451835e986e86abce0a90421be4dd && git checkout -B drift-repro 7e586a9da4e610a118d842576c3af9ed6efe805a && git merge --no-ff 208f25e01f9451835e986e86abce0a90421be4dd
node scripts/docs-audit/affected-docs.mjs --json 7e586a9da4e610a118d842576c3af9ed6efe805a
|
|
security#1 · os-mickey · session_01ASNY8XNef4ywkQio6S9ju4 Contract reviewServed-tier: Inputs: the maintainer's ruling as the seat recorded it, the PR body, the file list (4 files, +247 −27) and the net diff against Check-runs on this head, 52 in all: 28 success, 16 skipped, 8 still running ( ① Derived judgments
② Semver level
③ Boundary flags
④ Design judgmentAgainst the ruling, sentence by sentence:
Findings:
One must-fix, one should-fix. Implemented-by: VERDICT: FAIL |
…g window of the bytes Co-authored-by: Claude <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01ASNY8XNef4ywkQio6S9ju4
|
security#1 · os-mickey · session_01ASNY8XNef4ywkQio6S9ju4 Contract reviewServed-tier: Delta review. The prior record is the FAIL at Check-runs on this head, 57 in all: 39 success, 18 skipped, none failed, none running. ① Derived judgments
② Semver level
③ Boundary flags
④ Design judgmentAgainst the ruling, "serves an allow-listed type inline only when the stored bytes' leading signature matches it": at this head it holds for all 21 entries. The window, tried at its edges:
Prior findings:
New in this round:
No must-fix, no should-fix. Implemented-by: VERDICT: PASS |
|
security#1 · os-mickey · session_01ASNY8XNef4ywkQio6S9ju4 席位记录 · ACCEPT · head 维护者速读
席位意见:ACCEPT。完整 L2 一轮(FAIL)与 delta L2(PASS)均在案,独立对抗复核提出的唯一问题已在本 head 修复。 席位核对
|
|
security#1 · os-mickey · session_01ASNY8XNef4ywkQio6S9ju4 Landing · head
|
Clause-②: no
Metadata-protocol: none
维护者速读
What changes
One more condition on the stored-bytes rule in
packages/services/service-storage/src/served-bytes-policy.ts, applied by the local adapter's raw byte route:attachment, withnosniffand the default sandbox policy. The answered type and file name do not change.LEADING_SIGNATURESholds one test per type onINLINE_CONTENT_TYPES: PNG, JPEG, GIF, WebP, AVIF (by its brand), BMP, PDF, and each of the 13 audio and video types (MPEG audio, MP4, AAC, Ogg, the three WAV spellings, WebM, FLAC, QuickTime).LEADING_WINDOW(1445 bytes, the plain-text test's window). The body is cut to that window before any test runs. Theftypbrand scan also stops at a fixed slot count (the major brand plus 31 compatible brands), whatever size the box states.nosniffand the signature.Files to read first, by risk:
served-bytes-policy.ts:LEADING_WINDOW,ftypBrandwithFTYP_SCAN_END, theLEADING_SIGNATUREStable andbytesBeginWithTheirTypeSignature. This is the hunk that decides preview or download, and how much of the body is read to decide it.served-bytes-policy.ts,servedBytesHeaders. The signature verdict demotes the disposition before the CSP is chosen, so a demoted media answer gets the default policy.storage-routes.ts, the raw GET handler, which now passes the body it holds.Tests
Package suite, typecheck, and reverse verification at 208f25e
pnpm --filter @objectstack/service-storage testat 208f25e: Test Files 88 passed (88), Tests 1742 passed, 1 skipped. Lock VERDICT command-exit 0.pnpm --filter @objectstack/service-storage typecheckat 208f25e: lock VERDICT command-exit 0. This includescheck:test-typecheckover the test file.src/served-bytes-policy.test.ts: 30 tests, all green. The pins state the rule only:ftypbrand counts only inside the fixed scan window, whatever size the box states;LEADING_WINDOWbytes, whatever its length. Every signature test is handed at most that many bytes;scripts/ablation-replace.mjson committed code. Each anchor hit 1 to 0, and each was restored with the blob equal to HEAD andgit diff HEADempty.servedBytesHeaders: 4 failed, 23 passed, at da5f684.Acceptance notes
content/docs/permissions/attachments-access.mdx("How a downloaded file is answered") still describes the allow-list as the condition for a preview. That stays true, but it does not mention the new signature condition. The doc is outside this PR's file surface, so it is left for the owning seat.Verification
Two-minute check:
pnpm --filter @objectstack/service-storage exec vitest run --maxWorkers=2 src/served-bytes-policy.test.ts. Expect 30 passed. Removing the signature verdict line inservedBytesHeadersshould turn 4 of them red.Local gates: the 73 families derived by
dispatch-gates --commandsran at 208f25e, the final head. 71 exited 0. Two refused on a missing prerequisite (exit 3), so they are NOT MEASURED locally and CI runs them:check:dual-build-cjs-loadsandcheck:i18n, which both need a whole-workspace build.Generated by Claude Code