Skip to content

feat(sync-standards): run App-token jobs in a caller environment - #707

Merged
kyle-sexton merged 2 commits into
mainfrom
feat/sync-standards-environment
Oct 7, 2026
Merged

kyle-sexton merged 2 commits into
mainfrom
feat/sync-standards-environment

Conversation

@kyle-sexton

Copy link
Copy Markdown
Member

No related issue: part of the standards-sync automation plan agreed with the Automation Lanes session; tracked in its ledger.

Summary

The standards sync App key is a repository secret in standards, so a run on any branch can read it.
This lets the caller keep the key in an environment whose deployment-branch policy allows only main.

Fix

  • New environment input on maintenance-sync-standards.yml, default standards-sync.
  • The attest and sync jobs (the only ones that use the App secrets) declare
    environment: { name: inputs.environment, deployment: false }.
  • README notes the input.

Until standards creates the environment and moves the secrets into it, the jobs still resolve the
repo-level secrets, so nothing changes at merge or release.

Verification

  • actionlint clean; node --test .github/scripts/*.test.cjs 259/259.
  • zizmor's one high finding (github-app, attest owner-scoped token) is pre-existing on main.
  • Docs basis: environment secrets override secrets:; environment.name accepts inputs;
    deployment: false skips deployment records (docs.github.com, fetched 2026-10-07).
  • After release, Automation Lanes dispatches the sync from main (pass) and from a non-main branch
    (must be refused) before deleting the repo-level secrets.

Related

  • Companion: feat/managed-files-sync-verify (content-verifying sync mode in check-managed-files).
  • Ships in the next single ci-workflows release; needs a runner-policy contract for the new surface.

🤖 Generated with Claude Code

Add an `environment` input (default `standards-sync`) and declare it, with
`deployment: false`, on the attest and sync jobs, the only jobs that read
the App secrets. A caller can then hold the App key as an environment
secret whose deployment-branch policy allows only the default branch.
Repository-level secrets still resolve inside an environment that defines
none, so callers keep working before the key moves.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@kyle-sexton
kyle-sexton marked this pull request as ready for review October 7, 2026 05:47
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 7, 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-07T05:50:02.200043Z 41cb5a4 Draft marked ready
ℹ️ 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 7, 2026 •

Copy link
Copy Markdown

Claude finished @kyle-sexton's task in 4m 36s —— View job


Security review — PR #707

  • Gather context (PR diff, changed files)
  • Apply skip gate
  • Review changed files for security-relevant surface
  • Check for instruction-surface deletions
  • Adversarial validation of any candidate findings
  • Post final results

No security issues found.

This PR adds a caller-configurable environment input to maintenance-sync-standards.yml and attaches environment: { name: inputs.environment, deployment: false } to the attest and sync jobs — the only two jobs that consume the App secrets. No injection surface, no new credential exposure, and no instruction-surface deletions were introduced.

One candidate was hunted and adversarially verified before being dropped, noted here for context rather than as a finding: the PR's own doc comment and README both assert deployment: false skips deployment records while leaving deployment-branch-policy enforcement intact. That's a reasonable reading of the cited GitHub docs, but this review has no network access to independently confirm GitHub's current behavior, so it can't be fully closed out from this sandbox. It doesn't rise to a reportable finding against this diff because nothing here is exploitable today — repository-level secrets still resolve exactly as they did before this change until a separate, future action creates the standards-sync environment in the caller repo and moves the secrets into it. The PR's stated rollout plan (dispatch from main → expect pass, dispatch from a non-main branch → expect refusal, before deleting the repo-level secrets) is exactly the right empirical check for this assumption and already covers the failure mode. Worth keeping in mind when that follow-up lands, but not something to block or fix here.

GitHub Actions hardening items (triggers, permissions:, action pins) are zizmor's lane and out of scope here; the PR notes zizmor's one pre-existing high finding is unrelated to this change.

@claude

claude Bot commented Oct 7, 2026 •

Copy link
Copy Markdown

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


Code review complete

  • Gather context (PR diff, changed files, repo guidelines)
  • Understand the request (/review:code-review lane)
  • Review maintenance-sync-standards.yml changes
  • Review README.md changes
  • Check consistency with AGENTS.md / REVIEW.md lane split
  • Post findings

No code-review findings.

Summary of what I checked:

  • The new environment input (maintenance-sync-standards.yml#L32-L39) is wired onto exactly the two jobs that read the App secrets (attest and sync) — confirmed by grepping the file for secrets.app- and create-github-app-token: those only appear in attest (L159-180) and sync (L391-404). The plan job, which doesn't touch App secrets, correctly has no environment: block.
  • deployment: false is applied consistently to both new blocks, matching the PR's stated intent (suppress deployment records; branch-policy/protection rules on the environment still apply).
  • The multi-line description: >- style for the new input matches the existing convention used elsewhere in this file and others (pr-audit-workflows.yml, pr-review-security.yml, etc.).
  • README changes accurately describe the new behavior and stay consistent with the surrounding section.
  • Per REVIEW.md, this repo runs a dedicated security lane (pr-review-security.yml), so secret-exposure/privilege considerations around the App token are out of scope for this lane and left to that lane.
  • Checked for an existing structural-test convention (e.g. network-timeout-policy.test.cjs, standards-sync-app-attestation.test.cjs) that might need extending for the new environment wiring — none of the existing .test.cjs files assert job-level YAML metadata like environment: or permissions:, so there's no established pattern this PR broke by not adding one; not flagging as a gap.

Not independently verified: I don't have permission to invoke actionlint or node --test in this sandbox, so I did not re-run the PR's cited verification (actionlint clean, 259/259 node tests, zizmor finding pre-existing). Those remain author-claimed.

Branch: feat/sync-standards-environment

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 41cb5a401c

ℹ️ 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".

@github-actions

github-actions Bot commented Oct 7, 2026 •

Copy link
Copy Markdown

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

@github-actions

github-actions Bot commented Oct 7, 2026 •

Copy link
Copy Markdown

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

Environment secret names allow only [A-Za-z0-9_], and a called job's
environment secret replaces the passed secret of the same name. Rename the
workflow_call secrets to STANDARDS_SYNC_APP_CLIENT_ID and
STANDARDS_SYNC_APP_PRIVATE_KEY so the standards-sync environment can supply
them once the repo-level secrets are removed. Callers must rename the
secrets they pass.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@claude

claude Bot commented Oct 7, 2026 •

Copy link
Copy Markdown

Claude finished @kyle-sexton's task in 50s —— View job


Security review — PR #707 (incremental, through 8e770a0)

  • Read incremental diff (.claude-lane/incremental.diff)
  • Apply skip gate
  • Review changed files for security-relevant surface
  • Check for instruction-surface deletions
  • Check secret-name consistency across the whole file (no stray old references)
  • Post final results

No security issues found.

This increment (commits since 41cb5a4) renames the workflow_call secrets from app-client-id / app-private-key to STANDARDS_SYNC_APP_CLIENT_ID / STANDARDS_SYNC_APP_PRIVATE_KEY in maintenance-sync-standards.yml and updates the README to match. This directly resolves the Codex P1 finding on the prior commit: GitHub environment secrets can't contain hyphens, so the old names would have been impossible to shadow with an environment secret once the caller migrated — this fix keeps the "environment secret overrides the passed secret of the same name" migration path (described at maintenance-sync-standards.yml#L32-L40) actually usable.

Checked for correctness of the rename as a security-relevant precondition (a stray leftover reference to the old name would silently read an unset secret rather than erroring, since secrets.<name> on an undeclared name just resolves empty): grepped the full file for app-client-id/app-private-key/APP_CLIENT_ID/APP_PRIVATE_KEY — all 16 references across the attest and sync jobs (credential-presence check, create-github-app-token inputs, and the github-script attestation step) consistently use the new names or the unchanged local env-var aliases (APP_CLIENT_ID/APP_PRIVATE_KEY as step-local env:, fed from the new secret names). No stale reference to the removed hyphenated names remains, so there's no silent-empty-credential path introduced by an incomplete rename.

No instruction-surface deletions (no CLAUDE.md/AGENTS.md/rules-file/hook changes in this increment), no new injection surface, and no change to the environment:/deployment: false gating reviewed on the prior commit — this increment only changes secret identifiers, not control flow or trust boundaries.

Not re-reported here (out of this lane / already covered): the Codex comment's own naming-rule observation is exactly what this increment fixes; cross-repo callers in standards still passing the old hyphenated secret names will need to rename them to keep working, but that's the documented, intentional migration step called out in the README diff, not a security gap in this repo.
· Branch: feat/sync-standards-environment

@claude

claude Bot commented Oct 7, 2026 •

Copy link
Copy Markdown

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


Code review complete

  • Gather context (incremental diff, changed files)
  • Review .github/workflows/maintenance-sync-standards.yml changes since 41cb5a4
  • Review README.md changes since 41cb5a4
  • Check consistency with AGENTS.md / REVIEW.md lane split
  • Post findings

No code-review findings.

This incremental commit (8e770a0) renames the workflow-call secrets from
app-client-id/app-private-key to STANDARDS_SYNC_APP_CLIENT_ID/STANDARDS_SYNC_APP_PRIVATE_KEY,
directly resolving the P1 finding Codex raised against 41cb5a4 (its inline review comment on
maintenance-sync-standards.yml:154): GitHub environment secret names may only contain
[A-Za-z0-9_], so the hyphenated names could never have been defined in the standards-sync
environment once the caller migrates off repo-level secrets.

Checked:

  • All six usages of the old names inside
    maintenance-sync-standards.yml
    (secret declarations, both jobs' credential checks, create-github-app-token inputs) were updated
    consistently — confirmed via grep that no reference to app-client-id/app-private-key remains
    in the file or elsewhere in the repo.
  • The ::error:: message text and env var names were updated to match, so the failure output stays
    accurate.
  • README.md#L787-L791
    documents the new names, the [A-Za-z0-9_] constraint, and explicitly calls out that this is a
    breaking rename for existing callers (who must update the secret names they pass) — consistent
    with the workflow's current pre-adoption state described in the PR body.
  • Checked .github/scripts/*.test.cjs for hardcoded references to the old secret names (standards-sync-app-attestation.test.cjs
    and friends) — none found, so no stale test expectations.
  • Per REVIEW.md, security/credential-exposure framing is the dedicated security lane's
    scope, not this one; the rename here is a naming/compatibility fix, which is this lane's concern,
    and it's correctly scoped.

Not independently verified: no permission to run actionlint or node --test in this sandbox, so
the PR's cited verification results remain author-claimed.

Branch: feat/sync-standards-environment

@kyle-sexton
kyle-sexton merged commit 5113e84 into main Oct 7, 2026
29 checks passed
@kyle-sexton
kyle-sexton deleted the feat/sync-standards-environment branch October 7, 2026 05:58
kyle-sexton added a commit to melodic-software/standards that referenced this pull request Oct 7, 2026
No related issue: fleet repin to ci-workflows v0.39.0 in the GitHub
Actions conventions migration (standards-sync automation, phase C).

## Summary

Moves this repository's repo-owned ci-workflows pins from v0.38.2
(`cf316d1`) to v0.39.0 (`6ba73b97b058602c4dd2bb6e2cce234d11011787`), and
renames the secrets this repository passes to
`maintenance-sync-standards` to the names v0.39.0 declares.

## Fix

- Pin SHA and `# v0.39.0` comment on 31 lines across five workflows.
- `maintenance-sync-standards.yml`: `app-client-id` / `app-private-key`
become `STANDARDS_SYNC_APP_CLIENT_ID` / `STANDARDS_SYNC_APP_PRIVATE_KEY`
(values unchanged). Environment secret names allow only `[A-Za-z0-9_]`,
so the hyphenated names could never be supplied from an environment. No
`environment` input is passed: the default `standards-sync` is intended,
and its main-only branch policy is declared in github-iac separately.
Until then the job auto-creates the environment and still reads the
repo-level secrets.
- Component sources under `components/` are untouched; managed callers
move through `maintenance-repin-ci-workflows`.

## Verification

- actionlint passes on `.github/workflows/*.yml`; every pinned path
exists at `6ba73b9`.
- Runner-policy contracts for `6ba73b9`, including the renamed secret
keys, are in #732; this PR's runner-policy check passes once #732
merges.

## Related

- #732 (v0.39.0 runner-policy contracts)
- melodic-software/ci-workflows#707 (environment input, secret rename),
#708 (sync-verify mode); release v0.39.0

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

Co-authored-by: Claude Opus 5.5 <[email protected]>
kyle-sexton added a commit to melodic-software/standards that referenced this pull request Oct 9, 2026
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

- melodic-software/ci-workflows#707: the `environment` input on the
sync-standards reusable that moved the App key into `standards-sync`.

🤖 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