fix(presentation): scan every static-site text asset and fail closed on unreviewable text #9406
All Vouch review confidence checks passed
Residual risk 0.21 = Change Risk (0.52) × (1 − Review Confidence (0.60)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.52 · 650 lines diff across 8 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.388
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #9406"
general
weight: 0.35
JasonBuildAI
Goal And Delivered Outcome
loopx presentation packagecertifies a whole static-site bundle as public-safe while inspecting only eight filename suffixes and decoding only UTF-8, so ordinary text assets such as.csvchart data,.logcaptures,.yamlconfig,.env,Dockerfile,.map/.tsbuildinfoJSON and BOM-marked or BOM-less UTF-16 captures are copied into the publish artifact underok: truewithout being scanned. This PR makes every text asset in a copied bundle reach the existing public boundary patterns regardless of its filename, decodes the encoding the asset declares, and fails closed when the bytes cannot be reviewed as text. It also keeps the publisher's own media support boundary, so a browser-decodable container such as AVIF or APNG is copied verbatim instead of being decoded as text (review follow-up on both P2 rounds below)._scan_public_textinloopx/presentation/static_site.pyreturned before reading unless the asset's suffix was one of.css,.html,.js,.json,.md,.svg,.txt,.xml, and always read bytes as UTF-8. The repository's outbound public-safe scanner already documents why an allow-list fails for this task (loopx/capabilities/public_safe_outbound/scan_cli.py,_iter_text_files: it "silently skipped.env,Dockerfile,Makefile,id_rsa") and decodes the BOM-declared encoding; the static-site publisher never received that correction. Follow-up to #9370, which removed the separate 2 MB exemption and recorded this gap as out of scope.a7d72a1cf, a site withdata.csvcarrying a synthetic GitHub token returns{"ok": true, ... "write_performed": true}and the token is present inpublish/data.csv; at head, the same site returns{"ok": false, "error": "public boundary scan failed for data.csv: provider token"}, exits 2 and creates no publish directory. The same before/after holds for.log,.yaml,.env,Dockerfile(including nested paths),.map,.tsbuildinfo, a BOM-marked UTF-16.txt, and BOM-less UTF-16 (the last reportscontent is not reviewable text). For media, the first reviewed headebac4eb9brejected a valid 16×16 AVIF withpublic boundary scan failed for assets/hero.avif: content is not decodable as utf-8and created no publish directory; the second reviewed head204fd145erejected a valid 16×16 two-frame APNG the same way while accepting the identical bytes renamed.png, while basea7d72a1cfpublished both. This head copies the AVIF (331 bytes), the APNG (239 bytes) and the renamed.pngbyte for byte with matching manifest digests, and each still rejects a.csvcredential placed in the same bundle. Theregression_parityandreal_entrypointrows below record the raw comparison.loopx-project/loopxmain, and the branch was cut frommainata7d72a1cf(the merge base), not from the fork.Author Declaration
Implemented against
a7d72a1cf:loopx/capabilities/public_safe_outbound/README.mdandscan_cli.py(candidate selection is a binary deny-list, and a candidate is decoded with the BOM-declared Unicode encoding) anddocs/public-private-boundary.md(a raw credential token with no label is rejected by both tiers).| Criterion (spec clause) | Disposition | Symbol / path | Test or command |
| --- | --- | --- | --- |
| Every text asset the bundle copies reaches the existing boundary patterns, regardless of filename suffix | implemented |
loopx/presentation/static_site.py::_scan_public_text|tests/test_static_site_presentation.py::test_package_scans_text_assets_outside_the_former_suffix_allow_list(8 cases, including a nestedassets/export.csv, extensionless.env/Dockerfile, and.map/.tsbuildinfo); real CLI before/after || A BOM-marked UTF-16 capture is decoded before the patterns run | implemented |
_scan_public_text(_BOM_CODECS) |tests/test_static_site_presentation.py::test_package_scans_a_bom_marked_utf16_capture_before_publication; real CLI || A text asset that cannot be decoded in full, or whose decoded text contains NUL, fails publication instead of receiving a receipt | implemented |
_scan_public_text(strictcontent.decode) |test_package_fails_closed_on_bomless_utf16_text,test_package_fails_closed_on_nul_bearing_text,test_package_fails_closed_on_undecodable_text; real CLI || Known binary assets stay outside the text scan and remain publishable;
.map/.tsbuildinfoare reviewed as JSON text | implemented |_scan_public_text(_BINARY_ASSET_SUFFIXES= outboundBINARY_SUFFIXESminus the two JSON text formats, unioned with the publisher's own_STATIC_MEDIA_SUFFIXES) |tests/test_static_site_presentation.py::test_package_still_copies_binary_assets_without_text_scanning;.map/.tsbuildinfocases above || A browser-decodable media container the outbound deny-list does not name is copied verbatim instead of being strict-decoded as text | implemented |
_STATIC_MEDIA_SUFFIXES(.apng,.avif,.avifs,.heic,.heif,.jxl,.m4v,.ogv,.opus— the publisher's own support boundary) |test_package_copies_a_real_media_asset_byte_for_byte[avif\|apng],test_package_rejects_a_text_asset_next_to_real_media[avif\|apng],test_cli_package_copies_real_media_and_rejects_text_beside_it[avif\|apng]; real CLI || Text-shaped assets are not swept into the media boundary: subtitle and playlist formats stay reviewable | implemented |
_STATIC_MEDIA_SUFFIXES(no.vtt/.m3u8/.mpd) | the parametrized text cases above; no exemption added for those suffixes || The failure contract is unchanged:
ok: false, exit 2, no publish directory, filename and rule in the error | implemented |loopx/cli_commands/presentation.py::handle_presentation_command,_collect_site_files| real CLI probes below; existing focused suite || Reserved paths, symlinks, manifest/revision receipt and idempotent packaging behave as before | implemented |
_collect_site_files,_replace_output,package_static_site| existing focused suite (one Windows-only symlink fixture remains blocked by host privilege; see Validation) || Canonical boundary patterns are not restated or narrowed | implemented |
loopx/public_safe_text.py(unchanged) |loopx check --scan-pathover the two changed files || Credentials embedded in binary media remain undetected by the text scan | out_of_scope |
_scan_public_text| separate binary-content decision, not expanded here || Retained-revision rollback does not re-scan | out_of_scope |
rollback_static_site| pre-existing property of the rollback path, not a regression from this change |a7d72a1cf(16 failed, 18 passed: the 8 suffix cases, BOM UTF-16, BOM-less UTF-16, NUL, undecodable UTF-8, both text-next-to-media cases and both CLI parity cases), the second reviewed head204fd145e(2 failed, 32 passed: the APNG copy and the APNG CLI case, both reportingcontent is not decodable as utf-8), and this head (34 passed). The first reviewed headebac4eb9breported the same two failures for AVIF before that format was added. I also ran the realloopx presentation packageCLI on base,204fd145eand this head for 11 token shapes plus PNG, AVIF and APNG controls, Ruff,git diff --check, the repositoryloopx checkboundary scan, the two static-site examples, the architecture import-boundary test and both UTF-8 guards. I did not run the full repository Python suite; CI'spytestjob covers it, and one unrelated required test is already red at the base commit (see Validation). On this Windows hostpython -m pytestcannot create the symlink fixture (WinError 1314), which also fails before and after this change.Scope And Continuation
BINARY_SUFFIXESexclusion minus.map/.tsbuildinfo, decodes the declared encoding strictly, fails closed on undecodable or NUL-bearing content, and reuses the caller's single digest read. Review follow-up: the publisher keeps its own media boundary (_STATIC_MEDIA_SUFFIXES) instead of inheriting the repo-tree deny-list, so a browser-decodable container is copied verbatim while every other asset still has to be reviewable text. The set covers the browser containers the deny-list omits in one place rather than one suffix per review round, and it excludes text-shaped formats (.vtt,.m3u8,.mpd) so they stay scanned. No new pattern, consumer branch, receipt field, dependency or abstraction is introduced._STATIC_MEDIA_SUFFIXESrestores the stricter rejection the review measured.Validation
a603af13167f5214083d759b27b9de736050381dmain(af946a5c1385e3a566386e69cfefcf512802af3f); focused static-site suite 35 passed, architecture import-boundary suite 34 passed, real CLI byte-for-byte media controls and adjacent text rejection passed, and standard premerge passed 6 direct checks plus 2 catalog canaries with 0 failures.| Check kind | Result | Public-safe evidence / limitation |
| --- | --- | --- |
|
regression_parity|passed| Basea7d72a1cfwith the final test file: 16 failed, 18 passed, 1 deselected — the 8 suffix cases (.csv×2,.log,.yaml,.env,Dockerfile,.map,.tsbuildinfo), BOM UTF-16, BOM-less UTF-16, NUL-bearing UTF-8, undecodable UTF-8, both text-next-to-media cases and both CLI parity cases. Second reviewed head204fd145e: 2 failed, 32 passed — the APNG copy and the APNG CLI case, both withcontent is not decodable as utf-8; the AVIF cases pass there. This head: 34 passed, 1 deselected. Counterfactuals are the removed suffix filter (base), the permissive UTF-8 read (base) and the one-suffix media set (first reviewed head). ||
real_entrypoint|passed| Realloopx presentation package --execute. Text: 11 token shapes at base publish withok: true, exit 0 and the synthetic token inpublish/for 9 of them; at this head all 11 returnok: false, exit 2 and create no publish directory, withcontent is not reviewable textfor the BOM-less/NUL shapes andprovider tokenfor the rest. Media: a 16×16 AVIF and a 16×16 two-frame APNG are published byte-identically (331 and 239 bytes, manifest sha256 matches) with exit 0; atebac4eb9bthe AVIF was rejected and at204fd145ethe APNG was rejected, both with exit 2 and no publish directory, while the identical APNG bytes renamed.pngpublished at both heads. Adding a.csvcredential to each media bundle returnsok: false, exit 2 and creates no publish directory. ||
unit|passed|uv run --extra test python -m pytest tests/test_static_site_presentation.py -q -k "not test_package_rejects_reserved_paths_symlinks_and_public_boundary_leaks"-> 34 passed, 1 deselected. The deselected fixture fails at base and head on this Windows host (WinError 1314, symlink creation privilege), so it is not a regression. ||
unit|failed|tests/test_runtime_subprocess_utf8.py::test_shipped_runtime_pins_utf8_for_every_text_mode_subprocess_callfails onloopx/control_plane/goals/planning_batch.py:704, a file this PR does not touch (2 changed files), from #9263 at the base commit. An in-flight contributor fix owns that lane; it is disclosed here rather than claimed as passing. ||
static|passed|uv run --extra test python -m ruff check loopx/presentation/static_site.py tests/test_static_site_presentation.py-> All checks passed.git diff --check-> clean. ||
integration|passed|uv run --extra test loopx canary premerge --from-git-diff --git-diff-base a7d72a1cf-> status passed, changed_files 2, surfaces python, 0 failures, 0 advisory failures, 0 manual holds; 6 direct checks and both selected canaries passed. Rootnpm ci --ignore-scriptswas required for the semantic-vocabulary canary. ||
manual|passed|uv run --extra test loopx --format json check --scan-path loopx/presentation/static_site.py --scan-path tests/test_static_site_presentation.py-> public boundary scan clean: 2 files. The wrapper also reports one pre-existing local registry diagnostic that the diff does not touch.examples/static-site-presentation-smoke.py-> ok;examples/session-dash-panel-smoke.py-> OK. |package_static_siteentrypoint (not only the helper), includes a nested directory, an extensionless.env, an extensionlessDockerfile,.map,.tsbuildinfo, a BOM-marked UTF-16 capture, BOM-less UTF-16, NUL-bearing UTF-8, undecodable UTF-8, and two real fixtures — a 16×16 AVIF from Pillow's libavif encoder and a 16×16 two-frame APNG — each beside a.csvcredential, so a consumer that bypassed the scan, certified unreviewable bytes or rejected a browser-decodable container would fail it. The CLI case covers both halves through the shipped command for both fixtures. The real CLI covers the shipped entrypoint and records the base, previous-head and current over-reject sets, including the same APNG bytes renamed.pngas the control that isolates the suffix boundary. The media exemption is by suffix: a text payload appended to a listed container (.avif,.apng, and.pngat base) is copied without review, which is the declared binary-content boundary and unchanged by this slice. The full Python suite was not run locally; the unchangedplanning_batch.pyUTF-8 lane is red at the base commit and is owned by another in-flight fix. Credentials embedded in binary media remain explicitly out of scope.Frontend / Visual Evidence
Type of Change
LoopX Area
Technical Direction
Shared-authority RFC fixture impact
Boundary Checklist
.loopx/,.codex/goals/, and liveACTIVE_GOAL_STATE.md). Only a synthetic token shape and<tmp>placeholders are used.python3 scripts/check_rfc_bilingual.py --base origin/main --head HEADpasses, or no paired RFC changed.none.Signed-off-bytrailer (git commit -s).