Repository navigation
feat(cloud-environment): pages-publish reads its config from Key Vault when no file exists - #756
Conversation
…t when no file exists The passwd-home config file stays an override with the same owner, mode and symlink checks. With no file, the same KEY=VALUE text is read from the Key Vault secret pages-publish-config with VAULT_EXEC_VAULT unset, and parsed by the same function. Source selection lives in load_config. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01EQPrCTBQPb5b1XtbAH7tMA
|
Claude finished @kyle-sexton's task in 4m 11s —— View job Code review complete
SummaryReviewed the Key Vault config-source fallback in The implementation holds up well under close reading:
One finding posted inline:
Notes on verificationI could not execute |
|
Claude finished @kyle-sexton's task in 4m 43s —— View job Security review —
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: dfff5c12e4
ℹ️ 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".
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-review has reviewed this pull request through 646dd9b; a later push is reviewed from there. |
|
claude-security-review has reviewed this pull request through 646dd9b; a later push is reviewed from there. |
… config path Key Vault is used only when stat confirms the config file does not exist; any other lookup failure exits 5. The token reads in send() also unset VAULT_EXEC_VAULT, and the README notes the vault's own audit logs. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01EQPrCTBQPb5b1XtbAH7tMA
|
Claude finished @kyle-sexton's task in 5m 51s —— View job Security review —
|
|
Claude finished @kyle-sexton's task in 3m 41s —— View job Code review (incremental: dfff5c1 → 646dd9b)
SummaryThis incremental pass reviews only what changed since No findings. The changes correctly close all three outstanding items:
Traced the new test's state dependencies ( Notes on verificationI could not execute |
…Vault at session start (#758) No related issue: follow-up to #756; the rendered-views preference never reached cloud sessions because claude.ai passes environment variables to the session, not the setup script. ## Summary `write_rendered_views` in `setup.sh` writes `rendered-views.md` from `RENDERED_VIEWS_MD`, but claude.ai passes an environment's variables only to the session, never to the setup script, so the file was never written. The session cannot copy the variable either: a repository's `.claude/settings.json` `env` block can set it, and the preference file is a trusted layer. ## Fix - New `components/cloud-environment/rendered-views-sync`, installed by `setup.sh` to `~/.local/bin/rendered-views-sync` by its marker line, like `pages-publish`. It runs only when `CLAUDE_CODE_REMOTE=true`. It reads Key Vault secret `rendered-views-md` through the `vault-exec` beside it (`--optional`, `VAULT_EXEC_VAULT` unset, a 20-second budget, a fixed `PATH`; the value is never in argv), and writes a non-empty value atomically to `${CLAUDE_CONFIG_DIR:-$HOME/.claude}/rendered-views.md`. An absent or empty secret, or one holding a CR, leaves the file alone. It always exits 0, prints nothing to stdout (SessionStart stdout becomes session context), and logs one stderr line on failure. - `setup.sh` registers it as a user-scope SessionStart hook in `${CLAUDE_CONFIG_DIR:-$HOME/.claude}/settings.json`. `register_session_hook` removes any earlier entry for the same command before it appends, so a re-run is byte-identical, and every other key and hook is kept. It registers only after this build installed the script. - README: no longer says the environment's variables reach the setup script, and documents the hook. `write_rendered_views` and `write_pages_publish_config` stay. - CI runs the new test file. `SCRIPT_VERSION` is now `2026-10-10.1`. ## Verification - `bash harness/shell/run-tests.sh` over the cloud-environment tests and cloud-bootstrap: 5 files passed (setup 125 PASS, rendered-views-sync 23 PASS). - `shellcheck --rcfile .shellcheckrc` and `shfmt -d` are clean. markdownlint on the README is clean. ## Related - #756 (pages-publish Key Vault fallback, same pattern) - https://code.claude.com/docs/en/hooks (SessionStart hook shape, as of 2026-10-10) 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01EQPrCTBQPb5b1XtbAH7tMA --------- Co-authored-by: Claude Opus 5.5 <[email protected]>
No related issue: follow-up to #706 re-adding pages-publish with admission evidence ## Summary Re-adds the `pages-publish` component to the sync manifest for `melodic-software/dotfiles`, which 6554be9 removed because the admitting change lacked the evidence [`docs/component-lifecycle.md`](docs/component-lifecycle.md#admission-evidence) requires. This PR carries that evidence below. `rendered-views-sync` (cloud-only; exits 0 unless `CLAUDE_CODE_REMOTE`) and `vault-exec` (the cloud variant differs from dotfiles' own) stay out. ## Fix Re-applies exactly what 6554be9 removed: - `distribution/sync-manifest.yml`: the `pages-publish` component (`components/cloud-environment/pages-publish` -> `dot_local/bin/executable_pages-publish`), and `pages-publish` in the `melodic-software/dotfiles` managed list. - `components/managed-files-guard/managed-files-guard-fleet.yml`: `dot_local/bin/executable_pages-publish` in the guarded `paths:`, in sorted position. ## Admission evidence Per [`docs/component-lifecycle.md` § Admission evidence](docs/component-lifecycle.md#admission-evidence). - **Live consumer**: the `explain-change` skill in claude-code-plugins (melodic-software/claude-code-plugins#6426, merged 2026-10-07) publishes its digest pages with `pages-publish` when the hosted medium is configured. The dotfiles target is the consumer of the shared bytes here: it materializes them to `~/.local/bin/pages-publish` on local machines. - **Owner and outcome**: owner is the operator (melodic-software). Outcome: one shared page host that any rotated Claude account can publish to, locally and in cloud sessions. Acceptance condition: a stamped page published from a local machine returns a 200 page URL and deletes cleanly, as the cloud check below did. Rollback: drop `pages-publish` from the dotfiles managed list and remove `dot_local/bin/executable_pages-publish` in dotfiles in a coordinated PR, following the distribution lifecycle (deletion is never inferred from deselection). Operating instructions live beside the script in `components/cloud-environment/README.md`. - **Delivery boundary**: standards owns the script (`components/cloud-environment/pages-publish`). Exact materialization through this repository puts the same bytes on local machines via dotfiles. Cloud sessions keep getting them from `components/cloud-environment/setup.sh`. One source file, two delivery paths, no second copy to drift. - **Alternatives and overlap**: built-in Claude Artifacts are bound to one account, so a page published from one rotated account is not reachable from another; that limit is the reason for this work. GitHub Pages and Netlify were considered and rejected by the operator. Overlap: none with existing components. In the claude-code-plugins consumer the Artifact stays the default; the hosted medium is opt-in personal configuration. - **Operational fit**: the PLAN 7.4 cloud live check on 2026-10-10, from a Claude Code cloud session. The `setup.sh`-installed `pages-publish` read its config from the Key Vault secret `pages-publish-config` (#756), published a page at `https://pages.melodicsoftware.com/<id>/` that returned 200 with a `content-security-policy` header and `noindex`, private routing worked, and the page returned 404 after delete. No permission prompt and no classifier denial fired; the allow rule `Bash(pages-publish *)` is in the standards permissions floor (#706). The local dotfiles path was checked the same day; see "Local consumer check (2026-10-10)" below. Requirements: bash 4+, curl, awk, coreutils `realpath`/`stat`; `gitleaks` is used when present. There is no `getent` dependency, so the local path is not limited to Linux and WSL. Credentials: bearer tokens and the Access service-token pair are resolved by `vault-exec` and reach curl only on stdin, never argv. Failure behavior: distinct exit codes (2 usage, 3 not a stamped temp-dir page, 4 credential content, 5 config missing or invalid, 6 upload failed), and the credential scan runs before any network call. - **Upstream health**: first-party script with no third-party upstream; its only runtime dependencies are base OS tools. - **Legal and security fit**: first-party code in this repository, so there is no upstream license to record. The repository declares `"license": "UNLICENSED"` (`package.json`) and ships no LICENSE file. No vendored or downloaded artifact. Provenance and integrity: the sync copies the tracked, clean source bytes and their executable mode exactly (`distribution/sync-manifest.sh` rejects untracked or dirty sources); they reach dotfiles only through the reviewed standards-sync PR; and the managed-files guard blocks hand edits to the destination there. Network boundary: HTTPS only (`--proto =https`) to the two configured upload origins. Security review: a fresh-context review of this diff against `conventions/review/security.md` found no injection and no argv credential exposure. It found one P3 issue in the existing script, tracked in #760: a user-written `~/.config/pages-publish/config` could name any vault secret and any https endpoint, and the floor pre-approves `Bash(pages-publish *)` but not `vault-exec`. The P3 issue (#760) was fixed by #761 before this PR merged: config now comes only from Key Vault, so no file write can redirect secrets. The script landed through #706, #756 and #761; this PR changes no script bytes. - **Update path**: no independent dependency root, so no updater entry. The script changes through standards PRs and reaches dotfiles through the normal sync. - **Verification**: `components/cloud-environment/pages-publish.test.sh` is the behavioral suite and runs in `pr-require-checks.yml`; the managed-files-guard and sync-manifest suites cover the materialization. ## Local consumer check (2026-10-10) PLAN 7.4 local: the dotfiles delivery path on a local WSL2 Linux machine (kernel 6.18, bash), with the exact bytes this sync delivers. - **vault-exec**: rendered from dotfiles `main` at 7ddb14c with `chezmoi --source <fresh worktree> apply ~/.local/bin/vault-exec`. The preview diff was only the name map from melodic-software/dotfiles#1106: +`pages-publish-config` and the four `cloudflare-pages-*` names, -`cloudflare-r2-pages-public`/`-private`, all under `kv-melo-devtools-prod`. This is dotfiles' own `az`-based resolver, not the cloud variant. - **pages-publish**: installed to `~/.local/bin/pages-publish` (mode 0755) from standards `main` at 41282ac, `components/cloud-environment/pages-publish`. Git blob `126013899fd8777cd714b259b9c03fa2d14d1e4d`, matching the blob at that ref and the source this PR syncs; sha256 `d03ecf8decca2df02382ddb1e802abc65c45693f19e3a6b18d1ce93b676ba995`. Once the standards-sync PR lands, chezmoi manages this file with the same bytes. - **Consumer**: explain-change's `publish-hosted.mjs` (the script from melodic-software/claude-code-plugins#6783) published a builder-stamped digest page of claude-code-plugins#6783 with `--repo melodic-software/claude-code-plugins`. The repository visibility lookup returned public, and the page went to `https://pages.melodicsoftware.com/Cr_e5xdZNGSKuNo-NQsSWQ/`, which returned HTTP 200 with `content-security-policy: default-src 'none'; ...; sandbox allow-scripts allow-downloads` and `x-robots-tag: noindex, nofollow`. pages-publish read its config only from the Key Vault secret `pages-publish-config` through the local vault-exec. - **Private routing**: the same page with `--repo melodic-software/architecture` (private) routed to `https://pages-private.melodicsoftware.com/bVYsWtKUIE6evlGNobHc3A/`. An unauthenticated request got HTTP 302 to the Cloudflare Access login (`melodic.cloudflareaccess.com`) with a `www-authenticate: Cloudflare-Access` header and no page content. - **Delete**: `pages-publish --delete <id> --visibility public|private` removed both pages, each with exit 0; the public URL then returned 404. - **Permissions**: no permission prompt and no classifier denial fired for `pages-publish` or `publish-hosted.mjs` in this session. ## Verification Run locally in the worktree: - `bash distribution/sync-manifest.sh validate` -> `Manifest valid: 42 components, 13 targets` - `bash distribution/sync-manifest.test.sh` (after `npm ci --prefix distribution`) -> 336 PASS, 0 FAIL - `bash harness/shell/run-tests.sh components/managed-files-guard/managed-files-guard.test.sh components/cloud-environment/pages-publish.test.sh` -> 2 passed, 0 failed - lefthook pre-commit (editorconfig, typos, gitleaks) passed on the commit ## Related - #706 (pages-publish and the permissions floor allow rule) - #756 (Key Vault config secret `pages-publish-config`) - #758 (rendered-views preference sync) - 6554be9 (the removal this re-applies) - melodic-software/claude-code-plugins#6426 (explain-change hosted medium, the live consumer) - melodic-software/claude-code-plugins#6783 (publish-hosted looks up repository visibility itself; used in the local check) - melodic-software/dotfiles#1106 (local vault-exec map for the pages-publish secrets) - #760 (pages-publish config-override hardening, found in this PR's security review; closed by #761) - #761 (pages-publish reads config only from Key Vault) 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01EQPrCTBQPb5b1XtbAH7tMA Co-authored-by: Claude Opus 5.5 <[email protected]>
No related issue: operator request to let cloud sessions run pages-publish without per-environment config variables.
Summary
pages-publishnow reads its config from the Key Vault secretpages-publish-configwhen<passwd home>/.config/pages-publish/configdoes not exist. An existing file still wins and gets the same owner, mode 0600 and symlink checks as before.Fix
components/cloud-environment/pages-publish: config parsing moved intoparse_config(KEY=VALUE text on stdin, same validators), and source selection into oneload_configfunction, so a later move to another source replaces only that function. With no file it runsenv -u VAULT_EXEC_VAULT vault-exec --env PP_CONFIG=pages-publish-config -- bash -c 'printf "%s" "$PP_CONFIG"', so the value stays off argv and a repositoryenvblock cannot point the read at another vault. A missingvault-exec, a failed read, an empty value or invalid text exits 5 with one stderr line. A line that is notKEY=VALUEis now reported by line number instead of echoing its text, so neither source can print a value in an error.pages-publish.test.sh: thevault-execstub answerspages-publish-configfrom a fixture file and logs theVAULT_EXEC_VAULTit saw. New cases: Key Vault config uploads with its endpoint and tokens; vault-exec failure, invalid text, a non-KEY=VALUE line (not echoed) and an empty secret each exit 5 with no curl call and one stderr line; a file present (or a symlinked file) never reads Key Vault; a callerVAULT_EXEC_VAULTis unset for the read.README.md: the Config paragraph, the exit-5 row, Trusted inputs and the SetupPAGES_PUBLISH_*bullet describe the file-then-Key-Vault order.setup.shis unchanged; its writer is now optional.Verification
bash components/cloud-environment/pages-publish.test.sh: 258 PASS, 0 FAIL.shellcheck -xon both scripts: clean.shfmt -d: no diff.markdownlint-cli2on the README: 0 issues. Pre-commit hooks (editorconfig, typos, markdownlint, shellcheck, gitleaks) passed.Related
kv-melo-devtools-prodis a separate operator step; until it exists, a session with no config file exits 5 as it does today.🤖 Generated with Claude Code
https://claude.ai/code/session_01EQPrCTBQPb5b1XtbAH7tMA