Skip to content

fix(reliability): preflight inline image decoded size - #166

Draft
seonghobae wants to merge 25 commits into
mainfrom
fix/inline-image-size-preflight-20260811
Draft

fix(reliability): preflight inline image decoded size#166
seonghobae wants to merge 25 commits into
mainfrom
fix/inline-image-size-preflight-20260811

Conversation

@seonghobae

@seonghobae seonghobae commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

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

  • RED bb93115e3059c8fb54fa08ca6e41e500233cee45 established that a valid four-byte raster data URI under maxSizeBytes: 3 must raise Base64SizeError without calling Buffer.from(payload, 'base64').
  • RED ad6fb67a3ed56c4509e634d37895699be18f7d0f plus hosted CI 31794000599 / job 94746933626 proved the implementation still ran whole-source regex validation over a 65,536-code-unit valid raster candidate.
  • e0a92157263b2ad1627d8ea356072629e6487baf moved decoded-size preflight ahead of the whole-source regex; hosted CI 31794194653 correctly rejected that intermediate attempt at the repository 100% coverage gate.
  • fa7c46e4cd27bba89bbac82cab672e9f23b2d151 added the missing coverage.
  • Test-only 450847bda35b5950e8521255583afbda2af717d6 captured the semantic regression that malformed oversized payloads must still classify as Base64ImageSourceError before size policy.
  • Product repair 7701b9d35efa26284b4e0894b24cf050e3994031 replaced 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 interpreted maxSizeBytes > 0 and invalid JavaScript numbers could bypass the intended finite byte policy.

RED 08257617c496b639d44be09f1a510f9bffa5ef02. Hosted CI 31591393025 passed immutable install/typecheck, Office Python 3.11–3.14, and cross-engine clipboard evidence, then failed exactly at repository Test with 100% coverage for the malformed public-byte-limit regressions. Security/SAST on that immediately superseded test-only generation were cancelled and remain historical non-passing evidence.

GREEN 1c0b2546ce5d8ec152286e392b5d3d7c958c9a25 and descendants. assertValidInlineImageByteLimit() accepts only non-negative safe integers, preserving 0 as the documented size-limit disable value. NaN, negatives, fractional values, infinities, and unsafe integers fail closed with one payload-redacted RangeError before source-size comparison. The strict raster grammar, decoded-size derivation without base64 allocation, and Base64SizeError behavior 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 is f0e1a2e641d5372b4e333361ee015593caeb7cc9 on fix/inline-image-size-preflight-20260811, a non-destructive synchronization commit whose first parent is predecessor 6f17bc31c84b6522ee709d4cce076a3e9b270002 and 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:

  • CI 32073713863: completed / success;
  • Security Scan 32073713918: completed / success;
  • SAST Semgrep 32073713735: completed / success;
  • formal submitted reviews: 0;
  • unresolved inline review threads: 0;
  • GitHub reports the Draft mergeable.

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.0 tag/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.

@coderabbitai

coderabbitai Bot commented Aug 10, 2026

Copy link
Copy Markdown

Important

Draft PR not reviewed

Draft PRs are not automatically reviewed by default.

  • Trigger a manual review

To automatically review draft PRs, update your CodeRabbit configuration:

reviews:
  auto_review:
    drafts: true

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@opencode-agent opencode-agent Bot added priority: medium Normal-priority or P2 work status: draft Draft pull request type: bug Defect or incorrect behavior labels Aug 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

priority: medium Normal-priority or P2 work status: draft Draft pull request type: bug Defect or incorrect behavior

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(data-integrity): validate public inline image byte limits fix(reliability): bound inline image validation without decoding oversized base64

1 participant