Repository navigation
feat(cloud-environment): scan a normalized copy of the page in pages-publish - #723
Conversation
…publish The pages Worker scans a normalized copy of each upload (melodic-software/provisioning#705), so pages-publish now does too: tags stripped, HTML entities decoded and JSON/JS escapes undone, in three linear awk passes. Credential shapes found there still refuse with exit 4, and machine paths or hostnames still force private. The decoded copy is also matched against the path-detection bodies, embedded verbatim because setup.sh installs the script as one file; the test pins the copy to components/path-detection/machine-path-patterns.sh. Closes #707 Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01G3BsUv4VeQ81gAPhk73xvs
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
Code review in progress
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: ce0c6fb9e3
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
…ded scan A decoded NUL or invalid code point now becomes U+FFFD instead of nothing, so token halves around �, �, \u0000 or \x00 no longer join into a credential shape and falsely refuse. The decoded scan now builds two copies. The host copy repeats the Worker's normalize() exactly, and a credential there still exits 4: the Worker already answers that page with a 422, which also exits 4. The wide copy adds the extra entities and JS escapes; a credential found only there sends the page private instead of refusing it. gitleaks runs on the raw page only, as before. The README records the rollout exception and the Worker evidence for it. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01G3BsUv4VeQ81gAPhk73xvs
|
@codex review Generated by Claude Code |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 154ffc105f
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
…-publish gitleaks scanned only the raw page, so a credential only a gitleaks rule covers slipped through when markup or an entity split it. It now also runs over the host and wide decoded copies. A raw finding still refuses with exit 4; a finding only in a decoded copy sends the page private, since gitleaks rules are not the host's and the rollout exception covers only the host's refusals. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01G3BsUv4VeQ81gAPhk73xvs
|
@codex review Generated by Claude Code |
|
Claude finished @kyle-sexton's task in 5m 7s —— View job Code review complete
No new findings. I traced the full decode pipeline ( Both of Codex's P1 findings on this PR were real and are now resolved in the branch:
I also checked:
Not verified by me: I could not execute Security-relevant aspects (credential/secret handling, trust boundaries) are intentionally out of scope for this lane since |
|
claude-review has reviewed this pull request through a885abb; a later push is reviewed from there. |
|
Codex Review: Didn't find any major issues. Breezy! Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". |
|
Claude finished @kyle-sexton's task in 7m 49s —— View job Security review in progress
|
|
claude-security-review has reviewed this pull request through a885abb; a later push is reviewed from there. |
… jobs (#852) No related issue: pilot for installing the guardrails git hooks as shared, committed lefthook jobs instead of per-clone local installs, ahead of the same change in the other melodic-software repositories. ## Summary Installs the guardrails plugin's three git-hook entries in this repository so every clone gets them from `lefthook install`, and records the commit subject pattern they enforce: - `commit-msg-convention` (commit-msg): the subject against `subject_pattern` in `.claude/source-control.md`. - `pre-commit-content` (pre-commit): secrets and machine-specific paths on added lines. - `reference-verify` (pre-push): CLI flags, `/plugin:skill` references and deleted paths on pushed lines. ## Fix - `.githooks/guardrails/`: plugin-owned copies written by `install.mjs copy --scope shared` (guardrails 0.55.4), staged `100755` where they carry a shebang. - `lefthook.yml`: the three jobs from the installer's snippets; `.githooks/guardrails/**` added to the pre-commit `exclude`. - `.github/workflows/pr-require-checks.yml`: `.githooks/guardrails/` skipped by the ShellCheck action and the machine-path check, as `components/path-detection/**` already is (the pattern copies self-match). - `.claude/source-control.md`: `subject_pattern` is the twelve `allowedTypes` from `components/pr-convention-policy/policy.json`, an optional scope (`"requireScope": false`), plus git's own `Merge ...` and `Revert "..."` subjects so agent merges of main and reverts pass. `fixup!`/`squash!`/`amend!` already pass in the hook. - The installer's `.gitattributes` decision (`.githooks/** text eol=lf`) is left out: `* text=auto eol=lf` already covers it. ## Verification Enforcement rollout ([component lifecycle](docs/component-lifecycle.md#enforcement-rollout)), observation runs against this repository's history in report-only mode, before blocking: | Hook | Observation | Findings | Classification | |---|---|---|---| | `reference-verify` | pre-push replay of `origin/main~200..origin/main`, 91 changed `.md`/`.sh`/`.ps1` files, 30 s | 0 | none; no file in the range exceeds the argument-size limit below (largest `components/runner-policy/README.md`, 125,761 bytes) | | `pre-commit-content` | each of the last 100 non-merge commits replayed into the index, 20 s total | 1 commit (2fe3018, #723) | tool noise: `components/cloud-environment/pages-publish` documents `/home/<x>` and `/Users/<x>` forms in its own pattern bodies and self-matches, as the plugin's pattern libraries do. Current content is clean; a future edit of those lines would block. Tracked upstream as item 5 of [claude-code-plugins#9426](melodic-software/claude-code-plugins#9426) (repo-side exemption list) | | `commit-msg-convention` | `subject_pattern` tested against the last 500 subjects on main and 2,000 across all branches | 0 non-matching | none; `update stuff` and `feat:nospace` are rejected, `security: ...`, merge and revert subjects pass | Why blocking from the start: all three checks are deterministic, the baseline above is clean apart from one classified self-match, and each failure message names the file and line and says how to fix it. Also: - `lefthook validate`: All good. `install.mjs verify`: `ok` for all three entries. - The PR's own commits ran all three hooks; a normal commit's `pre-commit-content` ran in 0.04–0.15 s (the 70 s on the first commit was the 10.7k vendored lines). Known defect, upstream: `reference-verify` skips a file over the 128 KiB per-argument limit without a finding (Codex review here; item 4 of [claude-code-plugins#9426](melodic-software/claude-code-plugins#9426)). The copies are not edited in place: they are plugin-owned and a release refresh would overwrite the change. ## Related - [claude-code-plugins#9426](melodic-software/claude-code-plugins#9426): installer defects this pilot hit (exec bit, linted copies, machine-path self-match, argument limit, exemption list). - [dotfiles#1292](melodic-software/dotfiles#1292): removes the user-global `checks.*.declined` keys and makes `repos-sync` run `lefthook install` after clone or fast-forward. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Opus 5.5 <[email protected]>

Closes #707
Summary
The pages Worker (melodic-software/provisioning#705) scans a normalized copy of every upload, but
pages-publishscanned only the raw bytes. Its early check therefore missed HTML-escaped, tag-split and JSON-escaped credential, path and hostname shapes. The client now scans decoded copies too, so it refuses an upload, or forces it private, before sending. The Worker remains the enforcing layer.Fix
components/cloud-environment/pages-publishbuilds two decoded copies in linear POSIX-awk passes, with no new dependency:normalize(). Tags are stripped.&#NN;,&#xHH;, amp, lt, gt, quot, apos and nbsp are decoded only when the;is present.\\becomes\. A credential found here exits 4, the same page the Worker would refuse with a 422.;, and JS escapes (\/,\",\uXXXX,\u{…},\xHH). A credential found only here forces the page private instead of refusing it.components/path-detection/machine-path-patterns.sh:setup.shinstalls the script as a single file, so the fiveHPP_*bodies are copied in word for word, and a test fails if the copy and the library differ.Verification
bash components/cloud-environment/pages-publish.test.sh: 233 assertions pass.scan()(provisioning main0809074) was run over the samples._,\",_and_-without-;forms. The client forces those private.machine-path-patterns.test.shandsetup.test.shpass. shellcheck,shfmt -i 2 -ci -dand markdownlint-cli2 are clean. The ci-workflowscheck-machine-specific-paths.shdriver reports nothing.CLOUDFLARE|CF_API_TOKENshapes, which the client lacks;pgup_length mismatch (client 16+, Worker 20+).Related
cloudflare/pages-worker/src/scan.js)components/path-detection/machine-path-patterns.sh-q, same component)🤖 Generated with Claude Code
https://claude.ai/code/session_01G3BsUv4VeQ81gAPhk73xvs