Skip to content

fix(cli): escape line separators in generated literals; license headers and review docs - #347

Merged
totollygeek merged 4 commits into
masterfrom
claude/scorecard-findings-improve-vdfb6s
Aug 13, 2026
Merged

fix(cli): escape line separators in generated literals; license headers and review docs#347
totollygeek merged 4 commits into
masterfrom
claude/scorecard-findings-improve-vdfb6s

Conversation

@totollygeek

@totollygeek totollygeek commented Aug 13, 2026

Copy link
Copy Markdown
Contributor

What & why

Two things landed here: the OpenSSF gold-criteria groundwork, and — surfaced by CodeQL running on that large diff — fixes for every open CodeQL security alert in the repository (28 results across three rules, reproduced locally with the same default code-scanning suite and re-verified to zero).

CodeQL alert fixes

  • js/bad-code-sanitization in packages/cli/src/import.ts: the import scaffolder built generated string literals with bare JSON stringification, which leaves the U+2028 and U+2029 characters raw — legal in JSON strings, line terminators to a JavaScript parser — so a crafted task command could split a generated literal across lines. Those characters are now escaped, with a regression test. This is the release-worthy fix that titles the PR.
  • js/incomplete-sanitization in build/gitleaks_report.ts: the findings table escaped pipes and control characters but not backslashes, letting a value's own backslash pose as an escape and fabricate cell content. Backslashes are escaped first now, with a regression test.
  • js/incomplete-url-substring-sanitization at 26 sites in test fakes: fake fetch routers and assertions matched hosts by substring, so an unexpected host containing the expected one as a fragment could satisfy them. They now match explicit https origin prefixes, or exact list membership where the value is an endpoint list rather than a URL.

Gold-criteria groundwork

  • Per-file copyright and SPDX headers, for the copyright_per_file and license_per_file criteria: every TypeScript source file, both launchers, and the HCL wrapper template open with the two-line header. A new test under tests/ fails the suite on any source file missing it; the header lives in the template so the HCL sync check stays in agreement; the API docs check confirms the generated documentation is unaffected.
  • AGENTS.md now carries the header as a non-negotiable coding guideline: the exact lines, placement after any shebang, the shell-comment form, and the rule that generated files get their header from the template.
  • Code review standards, for the code_review_standards criterion: CONTRIBUTING.md documents how review is conducted, what must be checked, and what is required to merge.
  • Security review record, for the security_review criterion: docs/security-review.md documents the performed reviews with scope, method, findings, and outcomes.

Related issues

Part of the OpenSSF Scorecard / Best Practices badge work (#339, #342, #346).

Checklist

  • The PR title is a Conventional Commit — a cli fix, so a patch bump for the cli package, attributed by the changed files under packages/cli/.
  • deno task ci passes locally: lint, fmt, type-check, tests, spell, the HCL sync check, and the API docs check.
  • Tests were added: regression tests for both code fixes, plus the license headers test; coverage stays at 95%+.
  • Docs updated in the same PR.
  • Public API changes regenerated — N/A: no public API changes.
  • No any, no as casts, no non-null assertions.
  • New package wired into all seven places — N/A: no new package.
  • The code is written using AI assisted coding.

🤖 Generated with Claude Code

https://claude.ai/code/session_011SWEqodqknyrDiwLsmpGEq

…ty review record

Closes the repo-fixable OpenSSF Best Practices gold criteria:

- Every TypeScript source file, both launchers, and the HCL wrapper
  template now open with a copyright statement and an SPDX license
  identifier (copyright_per_file, license_per_file). The header sits in
  the template as well as the generated wrappers so hclSyncCheck stays
  in agreement, and tests/license_headers_test.ts fails the suite if a
  new source file ships without the header.
- CONTRIBUTING.md documents the code review requirements: how review is
  conducted (gate, AI reviewers, human maintainer), what must be
  checked, and what is required for a change to be acceptable
  (code_review_standards).
- docs/security-review.md records the performed security reviews with
  scope, method, confirmed findings, and outcomes, tied to the
  assurance case's requirements and boundaries (security_review).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011SWEqodqknyrDiwLsmpGEq
@github-actions

Copy link
Copy Markdown
Contributor

🤖 Zuke AI review

🔎 security review — review

Score: 0/10 · Severity: none · 0 finding(s)

Tokens: 45065 in · 34 out · 45099 total

Budget: 45,099 tokens of 500,000 tokens

No security vulnerabilities were introduced by the documented changes in the diff.

@github-actions

Copy link
Copy Markdown
Contributor

🤖 Zuke AI review

🔎 generic review — review

Score: 0/10 · Severity: none · 0 finding(s)

Tokens: 31806 in · 42 out · 31848 total

Budget: 76,947 tokens of 500,000 tokens

The diff is documentation-only and adds copyright/SPDX headers plus new security-review docs without changing runtime behavior.

Makes the per-file header a written coding guideline so every new file
carries it from the start: the exact two lines, placement after any
shebang, the comment form for shell files, and the rule that generated
files get the header from their template. Enforcement already exists in
the license headers test; this documents the requirement where agents
and contributors read the rules.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011SWEqodqknyrDiwLsmpGEq
@github-actions

Copy link
Copy Markdown
Contributor

🤖 Zuke AI review

🔎 security review — review

Score: 0/10 · Severity: none · 0 finding(s)

Tokens: 45258 in · 38 out · 45296 total

Budget: 45,296 tokens of 500,000 tokens

The diff is documentation and header-only changes with no new security-relevant code paths.

@github-actions

Copy link
Copy Markdown
Contributor

🤖 Zuke AI review

🔎 generic review — review

Score: 0/10 · Severity: none · 0 finding(s)

Tokens: 31709 in · 47 out · 31756 total

Budget: 77,052 tokens of 500,000 tokens

The diff is documentation-only and copyright-header additions, with no functional or security-impacting code changes visible in the provided changeset.

The CodeQL check on the header PR surfaced the repository's open
alerts: 28 results across three rules, reproduced and re-verified to
zero with a local run of the same default code-scanning suite.

- js/bad-code-sanitization: the import scaffolder built generated
  string literals with bare JSON.stringify, which leaves U+2028/U+2029
  raw — legal in JSON, line terminators to a JavaScript parser — so a
  crafted task command could split a generated literal. They are now
  escaped, with a regression test.
- js/incomplete-sanitization: the gitleaks summary table escaped pipes
  and control characters but not backslashes, so a value's own
  backslash could pose as an escape and fabricate cell content.
  Backslashes are escaped first now, with a regression test.
- js/incomplete-url-substring-sanitization: test fakes and assertions
  routed on substring URL checks; they now match explicit
  https origin prefixes (or exact list membership), so an
  unexpected host can never satisfy them.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_011SWEqodqknyrDiwLsmpGEq
@github-actions

Copy link
Copy Markdown
Contributor

🤖 Zuke AI review

🔎 security review — review

Score: 0/10 · Severity: none · 0 finding(s)

Tokens: 44762 in · 58 out · 44820 total

Budget: 44,820 tokens of 500,000 tokens

No security vulnerabilities are introduced by the diff; the changes are documentation and hardening updates with no exploitable injection, auth, secret, SSRF, deserialization, or traversal issues.

@github-actions

Copy link
Copy Markdown
Contributor

🤖 Zuke AI review

🔎 generic review — review

Score: 0/10 · Severity: none · 0 finding(s)

Tokens: 31408 in · 180 out · 31588 total

Budget: 100,439 tokens of 500,000 tokens

Refuted by verification (not reported):

Finding Reason
Generated-string escaping now depends on a narrower test path but lacks coverage for other import sources The change only extends str() to escape U+2028/U+2029, and the new unit test exercises the actual caller translateCommand, so the claim that other import paths remain untested does not identify a concrete regression introduced by this diff.

The change is mostly documentation and test hardening, with one small logic fix in Markdown escaping but no clear functional regression visible in the diff.

@totollygeek totollygeek changed the title chore: add per-file license headers, review standards, and the security review record fix(cli): escape line separators in generated literals; license headers and review docs Aug 13, 2026
@github-actions

Copy link
Copy Markdown
Contributor

🤖 Zuke AI review

🔎 security review — review

Score: 0/10 · Severity: none · 0 finding(s)

Tokens: 44762 in · 176 out · 44938 total

Budget: 82,284 tokens of 500,000 tokens

Refuted by verification (not reported):

Finding Reason
New security-review prose may normalize unverified claims without code backing The new docs file is non-executable prose, and the diff already shows the referenced security-review content was added alongside code and test changes elsewhere, so there is no concrete security flaw or unverified runtime path to exploit.

The change is mostly documentation and test hardening, with one minor review concern around new docs copied from untrusted prose and a low-risk string-escaping fix that appears safe.

@github-actions

Copy link
Copy Markdown
Contributor

🤖 Zuke AI review

🔎 generic review — review

Score: 0/10 · Severity: none · 0 finding(s)

Tokens: 31408 in · 46 out · 31454 total

Budget: 113,738 tokens of 500,000 tokens

The diff is largely documentation, license-header, and test hardening updates with no clear regressions in behavior or maintainability.

@totollygeek
totollygeek merged commit 114f842 into master Aug 13, 2026
12 checks passed
@totollygeek
totollygeek deleted the claude/scorecard-findings-improve-vdfb6s branch August 13, 2026 09:20
@github-actions github-actions Bot mentioned this pull request Aug 13, 2026
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.

2 participants