Skip to content

fix(artifact): escape hostile metadata in CLI reports - #405

Merged
StepenkoAnatoli merged 1 commit into
mainfrom
fix/issue-360-safe-cli-report
Oct 14, 2026
Merged

StepenkoAnatoli merged 1 commit into
mainfrom
fix/issue-360-safe-cli-report

Conversation

@StepenkoAnatoli

@StepenkoAnatoli StepenkoAnatoli commented Oct 13, 2026 •

Copy link
Copy Markdown
Owner

Fixes #360.

what changed: Artifact text reports escape control characters in metadata, diagnostics and remedies, keeping each field on one physical line. Metadata is withheld until the manifest passes schema validation.

why: An invalid package could inject a second quiet verdict or terminal control sequence into the report. Validation now preserves the report's boundaries and does not present invalid declarations as trusted metadata.

what it touched: The artifact validator, artifact CLI, two CLI regressions, the architecture map, changelog and test inventory.

what you verified: verified — the new regressions failed before the fix; 69 focused artifact tests and 21 architecture-map tests passed. An isolated CLI run passed all 120 tests after investigation of a prior full-gate failure. The normal full commit gate subsequently allowed commit 6295179. Handoff, preflight and doctor passed. All seven GitHub CI jobs passed on this exact head: offline-suite run.

what you got wrong and fixed: mistake — the first assertion rejected PASS anywhere in output, including an escaped key on a safe diagnostic line. where — the hostile-metadata artifact CLI regression. impact — it falsely failed safe one-line rendering; no published product behavior was affected. cause — substring matching did not distinguish an actual forged physical output line. fix — assert no physical line starts with the forged verdict and exactly one MANIFEST-SCHEMA line is present. verified — focused artifact and isolated CLI suites passed. The earlier full-gate failure and interrupted child-status investigation remain documented in the commit report; their original cause was not established.

what changed: The validator now exposes manifest state and identity metadata only after schema validation. The artifact CLI escapes control characters in every text diagnostic field, so malformed manifest strings remain on one physical line and cannot forge a verdict. JSON reports retain normal escaping.

why: Issue #360 showed package-supplied state, packageId, clientRef and unknown schema keys could inject terminal controls or a second PASS line, including under --quiet. Quiet mode promises a single verdict line and exit status alone cannot protect a human reading output.

what it touched: artifact-validator report shape, artifact CLI text rendering, artifact CLI regressions, architecture map, changelog, README test inventory. No format schema or exit-code change.

what you verified: verified - red-first 22 passed/2 expected failures; then 69 artifact-cli and artifact-validator tests passed. Coverage includes forged state under --quiet, newline in an unknown manifest key, terminal escape in packageId, newline clientRef, and null metadata for invalid schemas. Architecture-map 21 passed; handoff OK (33 ledger entries, 27 evidence rows); preflight PASS (28 pass, 1 warn, 0 fail); doctor ok with no blocking findings. Cached diff check clean. A retained full gate blocked on the preflight-scope CLI case (1778 passed, one failed, 12 unsupported); a subsequent interrupted focused run returned null child statuses in other CLI cases. The precise cause was not retained by those helpers. An isolated repeat with unchanged assertions passed all 120 CLI/artifact-CLI tests in 396.4 seconds, with no spawn errors. Temporary diagnostics were restored from exact backups before the normal full gate retry. The required full offline suite runs in the commit gate before acceptance.

what you got wrong and fixed: mistake - the first green-regression assertion rejected the string PASS anywhere in output, including the escaped key name on its now-safe diagnostic line. where - artifact-cli.test.mjs hostile metadata test. impact - it falsely failed a safe one-line rendering; no product behavior or delivered result was affected. cause - the assertion checked for a substring, not an actual forged physical output line. fix - assert no physical line starts with the forged PASS verdict, and assert the unknown key yields exactly one MANIFEST-SCHEMA line. verified - artifact-cli and artifact-validator groups passed 69 tests, 0 failures.
@StepenkoAnatoli
StepenkoAnatoli merged commit 0dc3ff0 into main Oct 14, 2026
7 checks passed
@StepenkoAnatoli
StepenkoAnatoli deleted the fix/issue-360-safe-cli-report branch October 14, 2026 18:56
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.

artifact validate prints manifest strings raw: a state holding a newline forges a second 'PASS build AUTHORIZED' line, under --quiet too

1 participant