ECC/scripts
Jamkris e06d038257 fix(ci): match quoted write-all + dedupe duplicate checkout violations
Two round-1 review findings, fixed together because they touch the
same regex/loop region of `findViolations`:

1. **cubic P0 — quoted write-all bypass**.
   `WRITE_ALL_PATTERN` was `/^\s*permissions:\s*write-all\b/m`, which
   does not match the perfectly valid YAML forms
   `permissions: "write-all"` and `permissions: 'write-all'`. A
   workflow that quoted the shorthand slipped right through the
   persist-credentials gate the previous commit was supposed to close.

   Reproduced before this commit:
     $ cat /tmp/q.yml
     name: bad
     on: [push]
     permissions: "write-all"
     jobs:
       do:
         runs-on: ubuntu-latest
         steps:
           - uses: actions/checkout@v4
     $ ECC_WORKFLOWS_DIR=/tmp node scripts/ci/validate-workflow-security.js
     Validated workflow security for 1 workflow files
     exit=0

   Fix: tighten the regex to
     /^\s*permissions:\s*["']?write-all["']?\s*$/m
   which accepts the bare, double-quoted, and single-quoted YAML forms
   while still anchoring on the `permissions:` key. The trailing `\s*$`
   prevents accidentally matching keys whose value happens to start
   with `write-all` (e.g. some future literal `write-all-something`).

2. **greptile P2 — duplicate violation when both patterns match**.
   A `ref: refs/pull/${{ github.event.pull_request.head.sha }}/merge`
   value matches both the `pull_request_target` rule's
   `expressionPattern` (the `head.sha` interpolation) and its
   `refPattern` (the `refs/pull/` literal). Each push generates an
   ERROR line with the same description and just a different
   `expression:` echo, so the reviewer sees the same violation twice.

   Fix: track `stepFlagged` inside the per-step loop and skip the
   `refPattern` fallback once any `expressionPattern` match has already
   produced a violation for this step. The `refPattern` is a fallback
   for ref-only forms (`refs/pull/123/head`, `${{ env.X }}` whose
   resolved value is a PR ref); when the more specific expression
   already fires, the fallback is redundant by definition.

After both fixes, the round-1 reproductions resolve cleanly:

  $ # quoted form now blocks
  $ ECC_WORKFLOWS_DIR=/tmp/q1/.github/workflows node scripts/ci/validate-workflow-security.js
  ERROR: quoted.yml:8 - workflows with write permissions must disable checkout credential persistence
  exit=1

  $ # combined head.sha + refs/pull now prints one ERROR, not two
  $ ECC_WORKFLOWS_DIR=/tmp/q2/.github/workflows node scripts/ci/validate-workflow-security.js
  ERROR: dup.yml:10 - pull_request_target must not checkout an untrusted pull_request head ref/repository
    Unsafe expression: ${{ github.event.pull_request.head.sha }}
  exit=1

Test additions land in the next commit.
2026-05-17 21:19:29 -04:00
..
ci fix(ci): match quoted write-all + dedupe duplicate checkout violations 2026-05-17 21:19:29 -04:00
codemaps feat: add scripts/codemaps/generate.ts codemap generator Fixes #247 - The generate.ts script referenced in agents/doc-updater.md was missing from the repository. This adds the actual implementation. The script: - Recursively walks the src directory (skipping node_modules, dist, etc.) - Classifies files into 5 areas: frontend, backend, database, integrations, workers - Generates docs/CODEMAPS/INDEX.md + one .md per area - Uses the codemap format defined in doc-updater.md - Supports optional srcDir argument: npx tsx scripts/codemaps/generate.ts [srcDir] 2026-02-22 16:19:16 +05:30
codex feat: support disabling bundled mcp servers 2026-04-05 14:37:28 -07:00
codex-git-hooks fix: skip pre-push checks on branch deletion 2026-03-29 23:09:26 +09:00
hooks fix: add context monitor cost warning opt-out 2026-05-17 01:53:57 -04:00
lib fix(installer): harden locale docs install 2026-05-17 20:46:04 -04:00
auto-update.js feat: add auto-update command 2026-04-29 21:01:27 -04:00
build-opencode.js fix: restore ci baseline for opencode packaging 2026-04-05 14:47:26 -07:00
catalog.js feat: add install catalog and project config autodetection 2026-03-27 05:56:39 -04:00
claw.js fix(scripts): resolve claude.cmd on Windows by enabling shell for spawn (#1471) 2026-04-21 18:02:13 -04:00
consult.js fix: tune machine learning workflow routing 2026-05-11 18:11:05 -04:00
discussion-audit.js Add discussion audit gate 2026-05-15 16:26:57 -04:00
doctor.js fix(scripts): add os.homedir() fallback for Windows compatibility 2026-03-28 11:28:12 +08:00
ecc.js feat: add platform and supply-chain audit commands (#1926) 2026-05-15 08:06:26 -04:00
gan-harness.sh fix: harden install planning and sync tracked catalogs 2026-03-31 22:57:48 -07:00
gemini-adapt-agents.js feat: add gemini agent adapter 2026-04-08 15:38:49 -07:00
harness-adapter-compliance.js docs: add data-backed harness adapter scorecard (#1785) 2026-05-12 02:59:52 -04:00
harness-audit.js fix: salvage stale PR plugin install fixes 2026-05-11 18:48:23 -04:00
install-apply.js feat(installer): add --locale flag for translated docs installation 2026-05-17 20:32:52 -04:00
install-plan.js fix: restore short Claude plugin slug and skill installs (#1712) 2026-05-11 02:10:36 -04:00
list-installed.js fix(scripts): add os.homedir() fallback for Windows compatibility 2026-03-28 11:28:12 +08:00
loop-status.js fix: handle dotted reserved snapshot names 2026-04-30 12:25:14 -04:00
observability-readiness.js security: add supply-chain IOC scanner (#1904) 2026-05-14 21:15:35 -04:00
operator-readiness-dashboard.js docs: refresh rc1 dashboard after security hardening 2026-05-17 17:57:37 -04:00
orchestrate-codex-worker.sh fix: resolve all CI test failures (19 fixes across 6 files) (#519) 2026-03-16 01:59:53 -07:00
orchestrate-worktrees.js fix: preserve orchestration launcher compatibility 2026-03-12 15:40:25 -07:00
orchestration-status.js feat: orchestration harness, selective install, observer improvements 2026-03-14 12:55:25 -07:00
platform-audit.js chore: clean up lint blockers 2026-05-16 03:30:30 -04:00
preview-pack-smoke.js Fix preview pack smoke lint 2026-05-17 15:40:29 -04:00
release.sh feat: add GitHub Copilot prompt support 2026-05-12 23:00:00 -04:00
repair.js fix(scripts): add os.homedir() fallback for Windows compatibility 2026-03-28 11:28:12 +08:00
session-inspect.js feat: self-improving skills loop — observe, inspect, amend, evaluate 2026-03-14 23:21:18 -07:00
sessions-cli.js fix(scripts): add os.homedir() fallback for Windows compatibility 2026-03-28 11:28:12 +08:00
setup-package-manager.js fix: reject flags passed as package manager names in setup-package-manager CLI 2026-02-13 03:37:46 -08:00
skill-create-output.js fix: narrow unicode cleanup scope 2026-03-29 21:21:18 -04:00
skills-health.js feat(design): skill health dashboard mockup (#518) 2026-03-16 14:01:41 -07:00
status.js feat: add status exit code gate 2026-05-11 12:38:59 -04:00
sync-ecc-to-codex.sh feat: sync the codex baseline and agent roles 2026-04-01 16:08:03 -07:00
uninstall.js fix(scripts): add os.homedir() fallback for Windows compatibility 2026-03-28 11:28:12 +08:00
work-items.js feat: sync GitHub queue into work items 2026-05-11 13:07:29 -04:00