Repository navigation
fix(cloud-environment): pass curl -q in vault-exec so a planted .curlrc cannot redirect tokens - #717
Conversation
…rc cannot redirect tokens vault-exec's Key Vault read now starts curl with -q, the same guard pages-publish gained in #706, so a .curlrc under CURL_HOME, XDG_CONFIG_HOME or HOME cannot add a url, proxy or trace line. The test asserts -q is curl's first argument and runs the real curl against a hostile .curlrc whose trace-ascii line must never write its file. The README records pages-publish's trusted inputs: a caller-set HTTPS_PROXY or CURL_CA_BUNDLE (cloud sessions route through the agent proxy) and the owner-checked 0600 config. Closes #710 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. |
|
Claude finished @kyle-sexton's task in 1m 35s —— View job Security review —
|
|
Claude finished @kyle-sexton's task in 2m 44s —— View job Claude's review
No high-signal correctness findings. This is a tightly scoped fix and the change holds up under review:
Not independently verified (author-claimed only): I was unable to execute shell commands ( |
|
claude-security-review has reviewed this pull request through 0766c84; a later push is reviewed from there. |
|
claude-review has reviewed this pull request through 0766c84; a later push is reviewed from there. |
…publish (#723) Closes #707 ## Summary The pages Worker (melodic-software/provisioning#705) scans a normalized copy of every upload, but `pages-publish` scanned 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-publish` builds two decoded copies in linear POSIX-awk passes, with no new dependency: - **Host copy**: exactly the Worker's `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. - **Wide copy**: adds the extra named entities, numeric entities without their `;`, and JS escapes (`\/`, `\"`, `\uXXXX`, `\u{…}`, `\xHH`). A credential found only here forces the page private instead of refusing it. - An invalid decoded code point (NUL, above U+10FFFF, or overlong) becomes U+FFFD, so it never joins two fragments into a token shape. - Machine-path and hostname shapes only ever force private, on the raw copy and both decoded copies. gitleaks, when present, runs on the raw page. - Path shapes are reconciled with `components/path-detection/machine-path-patterns.sh`: - `setup.sh` installs the script as a single file, so the five `HPP_*` bodies are copied in word for word, and a test fails if the copy and the library differ. - On decoded copies they add home paths with no trailing slash, the forward-slash and 8.3 Windows forms, and Windows checkout roots. - The cloud-environment README documents the decoded scan and a **Rollout of the decoded scan** paragraph (lifecycle exception for a check that blocks from day one, with the Worker evidence below). The path-detection README names the embedded copy. ## Verification - `bash components/cloud-environment/pages-publish.test.sh`: 233 assertions pass. - The escaped-form, HPP-only-shape, invalid-code-point and sync tests all fail against the old script. - Tests pin which escaped forms are refused and which go private. - An escaped placeholder and stray entities stay public. - A 2 MiB single line of each separator scans in under 20 s. - The Worker's own `scan()` (provisioning main `0809074`) was run over the samples. - It flags the entity, hex-entity and tag-split token forms. The client refuses those. - It flags nothing for the `_`, `\"`, `_` and `_`-without-`;` forms. The client forces those private. - `machine-path-patterns.test.sh` and `setup.test.sh` pass. shellcheck, `shfmt -i 2 -ci -d` and markdownlint-cli2 are clean. The ci-workflows `check-machine-specific-paths.sh` driver reports nothing. - Follow-ups left out of scope: - the Worker's "fleet hostname" and `CLOUDFLARE|CF_API_TOKEN` shapes, which the client lacks; - a pre-existing `pgup_` length mismatch (client 16+, Worker 20+). ## Related - melodic-software/provisioning#705 (the Worker's normalized scan, `cloudflare/pages-worker/src/scan.js`) - `components/path-detection/machine-path-patterns.sh` - #717 (vault-exec `-q`, same component) 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01G3BsUv4VeQ81gAPhk73xvs --------- Co-authored-by: Claude Opus 5.5 <[email protected]>
Closes #710
Summary
vault-exec called curl without
-q, so a.curlrcunderCURL_HOME,XDG_CONFIG_HOMEorHOMEcould add a url, proxy or trace line and send Key Vault responses (or the token the proxy adds) to a second destination. pages-publish already guards against this since #706; this brings vault-exec in line and records pages-publish's trusted inputs.Fix
components/cloud-environment/vault-exec: the Key Vault read infetch(), its only curl call, now starts with-q(curl honors it only as the first argument), with a comment saying it must stay first.components/cloud-environment/vault-exec.test.sh: asserts-qis curl's first argument, and runs the real curl against a hostile.curlrc(atrace-asciiline, withCURL_HOME/HOME/XDG_CONFIG_HOMEpointing at it and the proxy set to a closed local port), asserting the trace file is never written.components/cloud-environment/README.md: the pages-publish section notes the-qguard and adds a "Trusted inputs" paragraph: a caller-setHTTPS_PROXY/CURL_CA_BUNDLEis trusted by design (cloud sessions route through the agent proxy), and the 0600, owner-checked config is trusted (forging it needs write access to the home directory).Verification
-qtemporarily removed, both new assertions fail (expected -q got -sS;planted-tracefound). With it, they pass.bash components/cloud-environment/vault-exec.test.sh,pages-publish.test.sh,setup.test.sh: all pass.shellcheckandshfmt -i 2 -ci -dclean;markdownlint-cli20 issues; lefthook pre-commit (editorconfig, typos, gitleaks, shellcheck, markdownlint) passed.Related
-qguard this mirrors)🤖 Generated with Claude Code
https://claude.ai/code/session_01G3BsUv4VeQ81gAPhk73xvs
Generated by Claude Code