Skip to content

Escape forbidden controls in generated inline scripts - #7

Draft
falloutmule wants to merge 5 commits into
mainfrom
codex/sfhs-u0080-pack-verify-fix
Draft

Escape forbidden controls in generated inline scripts#7
falloutmule wants to merge 5 commits into
mainfrom
codex/sfhs-u0080-pack-verify-fix

Conversation

@falloutmule

Copy link
Copy Markdown
Owner

Purpose

Fix the disagreement where SFHS packing could emit raw forbidden C0/C1 characters inside generated inline JavaScript that the exact verifier correctly rejects.

Root cause

Bundled Pixi code contains raw U+0080 inside JavaScript. The old producer preserved it in the HTML script body; the strict HTML scanner then correctly reported control-character-in-input-stream.

Fix

  • Use esbuild's JavaScript serializer with ASCII output in the real builder.
  • Escape remaining raw C0/C1 controls only where JavaScript semantics are preserved.
  • Fail closed for tagged-template raw content containing a control or closing </script sequence, where rewriting would alter .raw semantics.

Security boundary

  • The scanner remains strict; no C1 whitelist was added.
  • No Pixi- or Skyline-specific exception exists.
  • HTML, CSS, assets, and encoded binary data are not rewritten.
  • Inline script termination protection remains in place and now fails closed for unsafe tagged templates.

Regression coverage

Focused builder, packer, and verifier tests cover raw U+0000, U+001F, U+007F, U+0080, U+009F, permitted tab/LF/CR, U+00A0, UTF-8 decoding, JavaScript strings, regular expressions, tagged templates, comments/scanner boundaries, HTML/CSS rejection, escaped representation, script termination, semantic execution, and deterministic output.

Skyline validation (external fixture; not included in this PR)

The preserved Skyline intake reproduces the original failure at SFHS_SCAN_HTML_PARSE_ERROR /html:1818609. With this repair, canonical pack and exact verify pass:

  • dist/index.html
  • 2,966,054 bytes
  • SHA-256 e35c894a4a4b6ddeaa5bf06816c62fc8c3cbeb34c2bd5735a30b0883abc88f08
  • build ID skyline-drop-1835440be550

Skyline browser boot remains BLOCKED by its unrelated legacy cross-file global namespace assumption (ReferenceError: Direction is not defined). That source migration is intentionally out of scope.

Verification

  • pnpm check — 220 passed, 2 skipped
  • focused builder/packer/verifier tests — 49 passed
  • pnpm plugin-validate
  • pnpm hermes-adapter-validate
  • pnpm determinism — deterministic SHA-256 4487a0b1d1aec53625ebff9706312f90d734fee9e55fb2a7aa7de8288d0367b2
  • pnpm browser-smoke
  • pnpm browser-scenarios
  • Skyline project typecheck, simulation suites, One-Shot inspect/audit, canonical pack, and exact verify

Safety

Draft PR only. No merge, release, or deployment is authorized.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant