fix(reliability): preflight inline image decoded size - #166
Conversation
|
Important Draft PR not reviewedDraft PRs are not automatically reviewed by default.
To automatically review draft PRs, update your CodeRabbit configuration: reviews:
auto_review:
drafts: trueThanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
Exact-head local validation for 8f0d1f7: inline-image decoded-size preflight and the related Base64Image MIME/source contracts passed in a detached worktree, 4/4 files and 82/82 tests. This is focused local evidence only; the PR remains Draft and this is not approval or merge evidence. |
Signed-off-by: Seongho Bae <me@seonghobae.me>
Signed-off-by: Seongho Bae <me@seonghobae.me>
|
Restacked the inline-image decoded-size preflight onto exact |
|
@codex review |
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
Remove the duplicated Python support contract changes from this inline-image branch. PR #405 remains the single writer while this branch keeps its bounded size preflight delta. Signed-off-by: Seongho Bae <seonghobae@users.noreply.github.com> Commit-Message-Assisted-by: Claude (via Claude Code)
Problem
Closes #165.
Closes #274.
Inline-image validation must reject oversized decoded payloads without materializing the base64 payload, must avoid whole-source regex validation over attacker-controlled oversized input, preserve malformed-source precedence, and fail closed on malformed public byte ceilings rather than silently disabling the resource policy.
Product test-first lineage
bb93115e3059c8fb54fa08ca6e41e500233cee45established that a valid four-byte raster data URI undermaxSizeBytes: 3must raiseBase64SizeErrorwithout callingBuffer.from(payload, 'base64').ad6fb67a3ed56c4509e634d37895699be18f7d0fplus hosted CI31794000599/ job94746933626proved the implementation still ran whole-source regex validation over a 65,536-code-unit valid raster candidate.e0a92157263b2ad1627d8ea356072629e6487bafmoved decoded-size preflight ahead of the whole-source regex; hosted CI31794194653correctly rejected that intermediate attempt at the repository 100% coverage gate.fa7c46e4cd27bba89bbac82cab672e9f23b2d151added the missing coverage.450847bda35b5950e8521255583afbda2af717d6captured the semantic regression that malformed oversized payloads must still classify asBase64ImageSourceErrorbefore size policy.7701b9d35efa26284b4e0894b24cf050e3994031replaced whole-source regex validation with a bounded MIME/prefix recognizer plus incremental canonical-base64 code-unit validation, then derives decoded length from validated source length/padding.Public byte-limit contract (#274)
Issue #274 was opened against predecessor
edcaf2e6afa013990b7e7bc8ce96eb9a32b41520, where the public validator only interpretedmaxSizeBytes > 0and invalid JavaScript numbers could bypass the intended finite byte policy.RED
08257617c496b639d44be09f1a510f9bffa5ef02. Hosted CI31591393025passed immutable install/typecheck, Office Python 3.11–3.14, and cross-engine clipboard evidence, then failed exactly at repositoryTest with 100% coveragefor the malformed public-byte-limit regressions. Security/SAST on that immediately superseded test-only generation were cancelled and remain historical non-passing evidence.GREEN
1c0b2546ce5d8ec152286e392b5d3d7c958c9a25and descendants.assertValidInlineImageByteLimit()accepts only non-negative safe integers, preserving0as the documented size-limit disable value.NaN, negatives, fractional values, infinities, and unsafe integers fail closed with one payload-redactedRangeErrorbefore source-size comparison. The strict raster grammar, decoded-size derivation without base64 allocation, andBase64SizeErrorbehavior for valid ceilings remain unchanged.Later commits on this long-lived branch included privacy/data-integrity hardening and temporary release-control parity work. Those commits are ancestry only after synchronization; the current effective delta no longer carries release workflow/docs changes.
Protected-main synchronization and current scope
Protected shipped truth is independently resolved as
main@3b38ead2d00f44eb578d0689087b9293b3dabe1e. Current exact Draft head isf0e1a2e641d5372b4e333361ee015593caeb7cc9onfix/inline-image-size-preflight-20260811, a non-destructive synchronization commit whose first parent is predecessor6f17bc31c84b6522ee709d4cce076a3e9b270002and whose second parent is exact protected main.Fresh exact comparison resolves protected main as the merge base and reports
ahead_by=24,behind_by=0. Despite the long branch history, the effective current diff is exactly two Inkspan-owned product/test paths:src/policy/inlineImagePolicy.ts;src/policy/inlineImagePolicyPreflight.test.ts.Protected-main release workflow, release-contract tests, release-security documentation, and exact-checkout fixes are inherited from protected main and are not changed by this PR. No force push or destructive rebase is represented by the synchronization.
Exact-current-head evidence
For unchanged exact head
f0e1a2e641d5372b4e333361ee015593caeb7cc9:32073713863: completed / success;32073713918: completed / success;32073713735: completed / success;These exact-head repository results are technical evidence only. They do not establish separately applicable central required workflows or qualifying independent approval. No predecessor-head, status-only, model-only, skipped, absent, cancelled, queued, or stale result transfers lifecycle authority to this head.
Product and integration boundary
The current diff adds no transport, persistence, credential, model, tenant, deployment, durable-audit, or release-publication authority. Inkspan owns deterministic local inline-image validation only; hosts retain their established service/runtime authorities.
Keep this PR Draft and unmerged while #118 owns exact protected
v0.6.0tag/publication/provenance/registry-digest operational acceptance. Live governance, required workflow identities, review requirements and permissions must be independently refetched before any lifecycle action. Do not self-approve, transfer predecessor evidence, weaken gates, or substitute a branch ref for release identity.