Skip to content

fix(workflows): stop reading repo-level sync App secrets - #740

Merged
kyle-sexton merged 1 commit into
mainfrom
fix/stop-reading-repo-sync-secrets
Oct 9, 2026
Merged

kyle-sexton merged 1 commit into
mainfrom
fix/stop-reading-repo-sync-secrets

Conversation

@kyle-sexton

Copy link
Copy Markdown
Member

No related issue: prep for deleting the repository-level STANDARDS_SYNC_APP_* secrets now that the sync App key lives in the main-only standards-sync environment.

Summary

Three workflows still read the repository-level STANDARDS_SYNC_APP_CLIENT_ID / STANDARDS_SYNC_APP_PRIVATE_KEY. This PR moves the two scheduled audits onto the standards-sync environment. The third, pr-require-checks.yml job verify-pr-convention-lockstep, is left unchanged and needs an owner decision before the repository secrets are deleted (see below).

Fix

maintenance-audit-code-review-rules.yml / audit. The App token (contents: read, metadata: read, whole installation) lists installation/repositories, keeps the private ones, and reads each one's AGENTS.md. Those repositories are private, so GITHUB_TOKEN cannot replace it. The job runs only on schedule and workflow_dispatch, so it now declares environment: {name: standards-sync, deployment: false}; the environment's secrets of the same names supply the key, and its main branch policy admits these runs. No deployment record is created.

maintenance-audit-link-check-excludes.yml / audit. The App token (metadata: read, whole installation) reads installation/repositories names and visibility once. That is the installation's repository set, which GITHUB_TOKEN cannot read. Same trigger shape, same change.

In both, the missing-credential warning now names the environment. A workflow_dispatch from a non-main branch is now refused by the environment's branch policy instead of running.

pr-require-checks.yml / verify-pr-convention-lockstep: unchanged. The token (contents: read, whole installation) is passed as LOCKSTEP_GITHUB_TOKEN to components/pr-convention-policy/lockstep-drift.mjs, which reads gate files through the contents API in every CONSUMER_REPOSITORIES entry. Five of them are private (claude-code-proxy, dotfiles, github-iac, medley, provisioning, checked with gh api repos/melodic-software/<r> --jq .private), so GITHUB_TOKEN cannot read them. The job runs on PR branches, so the main-only environment cannot serve it either. Once the repository secrets are deleted, the mint step is skipped, the private fetches fail as fetch-error, and the lane goes red on every PR. The owner needs to choose one of:

  • a separate read-only App (contents: read only, installed on the gate callers) whose key stays a repository secret (and a Dependabot secret);
  • keep the current repository secrets until such an App exists;
  • move the live lockstep check off PRs into a scheduled main-only job in standards-sync, leaving only the hermetic fixture tests on PRs.

Verification

  • actionlint on both changed workflows: clean.
  • zizmor --offline on both: no findings.
  • npm run lint:github-actions-conventions (enforcing): 0 findings.
  • gh api repos/melodic-software/standards/environments/standards-sync: branch policy main only; secrets STANDARDS_SYNC_APP_CLIENT_ID, STANDARDS_SYNC_APP_PRIVATE_KEY present.
  • Not yet run live: a workflow_dispatch of each audit on main after merge confirms the environment key mints.

Related

🤖 Generated with Claude Code

https://claude.ai/code/session_01T7GukBojtE99rLCPY7Cw3R

The two scheduled audits read private repositories through the
standards-sync App token. Run their jobs in the main-only standards-sync
environment (deployment: false), whose secrets carry the App key, so the
repository-level STANDARDS_SYNC_APP_* secrets can be deleted.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01T7GukBojtE99rLCPY7Cw3R
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 8, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-08T23:43:36.475351Z 42e7222 PR opened
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@claude

claude Bot commented Oct 8, 2026 •

Copy link
Copy Markdown

Claude finished @kyle-sexton's task in 1m 33s —— View job


Security review complete

  • Gather context (PR diff, workflow files)
  • Review changed workflow files for security issues
  • Post findings

Scope: .github/workflows/maintenance-audit-code-review-rules.yml and .github/workflows/maintenance-audit-link-check-excludes.yml (diff against origin/main).

No security issues found.

Analysis:

  • Both jobs are triggered only by schedule and workflow_dispatch (unchanged on: blocks) — the diff does not add any pull_request/pull_request_target exposure, so the App key is never reachable from a PR-triggered run.
  • The added environment: {name: standards-sync, deployment: false} (code-review-rules.yml#L33-L35, link-check-excludes.yml#L38-L40) only changes where the two existing secrets (STANDARDS_SYNC_APP_CLIENT_ID/_PRIVATE_KEY) are read from — repo-level → environment-level. No new secret, no widened token scope, no change to the read-only, whole-installation App token grants already in place.
  • Even if the environment's main-only deployment-branch policy turned out not to gate non-deployment jobs as described, the exploit path is bounded: workflow_dispatch already requires repository write access to trigger, and that same actor could already push to main directly. So this is a correctness/behavioral question (not in this lane's scope — /review:code-review or manual verification against a live workflow_dispatch covers it), not an exploitable privilege-escalation path.
  • No injection surface was introduced: the only run: changes are static string literals in echo "::warning::..." lines, with no new interpolation of attacker-influenced github.*/steps.* context values.
  • No instruction-surface (rules/AGENTS.md/policy file) was touched by this diff, so the instruction-exception-register lens doesn't apply here.
  • GitHub Actions hardening (pins, trigger shape, permissions:) is unchanged and is zizmor's lane per the PR's own verification notes (zizmor --offline: no findings).

@claude

claude Bot commented Oct 8, 2026 •

Copy link
Copy Markdown

Claude finished @kyle-sexton's task in 2m 42s —— View job


Code review complete

  • Gather context (PR diff, changed files)
  • Review maintenance-audit-code-review-rules.yml
  • Review maintenance-audit-link-check-excludes.yml
  • Check cross-file consistency / whole-PR concerns
  • Post findings

No blocking findings. The change is a small, well-scoped move of two scheduled-audit jobs from repo-level STANDARDS_SYNC_APP_* secrets onto the job-level environment: {name: standards-sync, deployment: false} block, plus a wording update to the missing-credential warning in each.

Notes from review:

  • environment: { name: standards-sync, deployment: false } (maintenance-audit-code-review-rules.yml L33-L35, maintenance-audit-link-check-excludes.yml L38-L40) is a real, precedented key shape in this org — components/runner-policy/README.md:1134-1137 documents ci-workflows' maintenance-sync-standards using the identical pattern (environment input defaulting to standards-sync, secrets read with deployment: false). So this isn't an invented/unsupported field, and the "no deployment record" claim checks out against that precedent.
  • Both jobs only trigger on schedule and workflow_dispatch (never pull_request), so scoping them to a main-only environment is consistent with how they're invoked — matches the PR description's reasoning.
  • The updated warning text ("...is not configured in the standards-sync environment...") correctly reflects the new secret location in both files.
  • The PR body's own verification (actionlint, zizmor, lint:github-actions-conventions, and the live gh api .../environments/standards-sync check) is author-claimed; I did not have network/gh access in this sandbox to independently re-run those checks, so I'm not re-asserting them as verified here. I did independently confirm the deployment: false precedent in components/runner-policy/README.md and re-read both full workflow files against origin/main...HEAD.
  • Scope is appropriately narrow: pr-require-checks.yml's verify-pr-convention-lockstep job is correctly left untouched, since (per the PR body) it runs on PR branches where the main-only environment can't serve it, and its private-repo reads can't move to GITHUB_TOKEN. That's a real open question but it's explicitly deferred to an owner decision, not something this PR needs to resolve.

@github-actions

github-actions Bot commented Oct 8, 2026

Copy link
Copy Markdown

claude-security-review has reviewed this pull request through 42e7222; a later push is reviewed from there.

@github-actions

github-actions Bot commented Oct 8, 2026

Copy link
Copy Markdown

claude-review has reviewed this pull request through 42e7222; a later push is reviewed from there.

@kyle-sexton
kyle-sexton merged commit 0c71b19 into main Oct 9, 2026
22 checks passed
@kyle-sexton
kyle-sexton deleted the fix/stop-reading-repo-sync-secrets branch October 9, 2026 01:17
kyle-sexton added a commit that referenced this pull request Oct 9, 2026
…udit (#741)

No related issue: follow-on to #740, part of moving the
STANDARDS_SYNC_APP_* secrets into the main-only standards-sync
environment; no standards issue tracks it.

## Summary

The `verify-pr-convention-lockstep` job ran on every pull request and
minted a
standards-sync App token to read five private gate callers for the
caller-pin
scan. Those secrets are moving to the `standards-sync` environment,
whose
branch policy admits only `main`, so a pull-request job can no longer
mint the
token. This splits the lockstep check (ADR-0008) in two: the copy check,
which
reads only public repositories, stays on pull requests; the pin scan
moves to a
`main`-only audit workflow.

Based on #740 (`fix/stop-reading-repo-sync-secrets`), which is still
open; merge
#740 first, and this diff then shrinks to its own two commits.

## Fix

- `pr-require-checks.yml`: `verify-pr-convention-lockstep` becomes
`check-pr-convention-copies`. It keeps the gawk step, the hermetic tests
and
the copy check, reads the public repositories with `github.token`, and
no
longer references `STANDARDS_SYNC_APP_*`. `ci-status` `needs:` and
`results`
use the new id. The note about mirroring the App secrets into Dependabot
secrets is dropped: the PR job no longer reads them, and Dependabot
never
  triggers the push or schedule events the new workflow runs on.
- New `maintenance-audit-pr-convention-pins.yml`: runs on every push to
`main`,
  weekly at `29 7 * * 3`, and on dispatch. The `audit` job declares
`environment: { name: standards-sync, deployment: false }` (the #740
shape),
mints the read-only contents App token behind the `HAS_APP_CREDENTIAL`
guard,
runs the pin scan, and fails on drift. It opens no issue, per the CI
posture
(AGENTS.md, README); the scheduled-run failure notification is the
signal.
- `lockstep-drift.mjs` takes one mode, `copies` or `pins`. npm scripts
  `lint:pr-convention-copies` and `audit:pr-convention-pins` replace
`lint:pr-convention-lockstep`. The pin mode fails up front when neither
`LOCKSTEP_GITHUB_TOKEN` nor `GITHUB_TOKEN` is set, so it can never pass
on the
  public callers alone. New hermetic tests cover mode parsing, the token
requirement, and the CLI exit codes for a missing mode and a tokenless
pin
  scan.
- `vocabulary.json`: maintenance function `audit-pr-convention-pins`.
- ADR-0008 gains a "Revisited 2026-10-08" section; the component README,
the
  README CI posture section describe the split.

## Verification

- `npm run test:pr-convention-lockstep`: 85 tests, 85 pass (3 new).
- `npm run test:pr-convention-policy`: pass.
- `npm run lint:pr-convention-copies` with no token set: "every copy
matches
  policy.json", exit 0.
- `npm run audit:pr-convention-pins` with no token set: fails with
  "fetch-error: the pin scan reads private gate callers and needs
LOCKSTEP_GITHUB_TOKEN or GITHUB_TOKEN; neither is set", exit 1. The live
pin
  scan with a token was not run locally; the first `main` run of the new
  workflow exercises it.
- `npm run test:github-actions-conventions`: 14 pass; `npm run
  lint:github-actions-conventions`: 0 findings.
- `actionlint` and `zizmor --offline` on both workflows: no findings.
- `npm run lint:concurrency-policy` and `npm run lint:runner-policy`:
pass.
- `code-review-rules.sh file`: AGENTS.md carries the section.
- biome, markdownlint, typos, editorconfig and gitleaks through the
lefthook
  pre-commit hooks: pass.

## Related

- Refs #740 (moves the two audit jobs into the `standards-sync`
environment;
  this branch is based on it).
- The STANDARDS_SYNC_APP_* repository-secret retirement plan owned by
the
Automation Lanes session: this removes the last pull-request reader of
those
  secrets.
- melodic-software/github-iac
`.github/governance-verify/expected-contract-only-gates.json`
maps the standards lane `pr-convention-lockstep` to
`verify-pr-convention-lockstep`
under `jobRenames`; it needs `check-pr-convention-copies` in step with
this
  merge, or the daily governance verification reports the job missing.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

https://claude.ai/code/session_01T7GukBojtE99rLCPY7Cw3R

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>
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.

1 participant