Skip to content

ci: harden workflows for public repo - #12

Merged
godronus merged 2 commits into
mainfrom
hardening/github-hosted-runners
Aug 5, 2026
Merged

ci: harden workflows for public repo#12
godronus merged 2 commits into
mainfrom
hardening/github-hosted-runners

Conversation

@demetristsadiotis

@demetristsadiotis demetristsadiotis commented Jul 30, 2026

Copy link
Copy Markdown
Contributor

Three workflows (codex-parity, validate-codex-plugin, validate-cursor-plugin) trigger on pull_request and execute scripts from the PR's own tree. On a public repo with forking enabled that means any fork author could get code execution on a persistent, shared self-hosted runner. the same fleet that runs the jobs holding tokens. All five workflows now run on ubuntu-latest.

External actions are pinned to commit SHAs; create-github-app-token@v1 was a mutable major tag with access to the GitHub App private key. Each pin resolves to the commit its tag already pointed at, so no version change: checkout v6.1.0, setup-node v6.5.0, create-github-app-token v1.12.0.

The three pull_request checkouts also set persist-credentials: false so untrusted PR code cannot read the token out of .git/config.


Secret scoping in sync-reference-docs.yaml (second commit)

ANTHROPIC_API_KEY and OPENAI_API_KEY were declared at workflow level, so they sat in the environment of every step — including actions/checkout, create-github-app-token and the composite setup-node action. Only invoke-agent.sh reads them; they now live on the Sync reference docs step alone.

The GitHub App token was written to $GITHUB_ENV, which persists it into every later step for the rest of the job. It is now passed per step to the three that actually need it:

Step Why
Validate sources.json validate-sources.sh:50 calls gh api
Configure git credentials gh auth setup-git
Sync reference docs fetch-repo.sh, manage-pr.sh, and the git push via the gh credential helper

Checkout, token generation, Setup Node.js and Install Claude CLI now run with no secrets in scope.

Hardening pass now that the repo is public.

Three workflows (codex-parity, validate-codex-plugin, validate-cursor-plugin)
trigger on pull_request and execute scripts from the PR's own tree. On a
public repo with forking enabled that means any fork author could get code
execution on a persistent, shared self-hosted runner — the same fleet that
runs the jobs holding FASTEDGE_APP_PRIVATE_KEY, ANTHROPIC_API_KEY and
OPENAI_API_KEY. All five workflows now run on ubuntu-latest.

External actions are pinned to commit SHAs; create-github-app-token@v1 was
a mutable major tag with access to the GitHub App private key. Each pin
resolves to the commit its tag already pointed at, so no version change:
checkout v6.1.0, setup-node v6.5.0, create-github-app-token v1.12.0.

The three pull_request checkouts also set persist-credentials: false so
untrusted PR code cannot read the token out of .git/config.
ANTHROPIC_API_KEY and OPENAI_API_KEY were set at workflow level, putting
them in the environment of every step — including actions/checkout,
create-github-app-token and the composite setup-node action. They are only
read by invoke-agent.sh, so they now live on the Sync reference docs step.

The App token was written to $GITHUB_ENV, which persists it into every
later step's environment for the rest of the job. It is now passed per
step to the three that actually use it: Validate sources.json
(validate-sources.sh calls gh api), Configure git credentials
(gh auth setup-git), and Sync reference docs (fetch-repo.sh, manage-pr.sh
and the git push via the gh credential helper).

Checkout, token generation, Setup Node.js and Install Claude CLI now run
with no secrets in scope.
@demetristsadiotis demetristsadiotis changed the title ci: move workflows to GitHub-hosted runners and pin actions to SHAs ci: harden workflows for public repo Jul 30, 2026
@godronus
godronus merged commit e2ae7db into main Aug 5, 2026
6 checks passed
@godronus
godronus deleted the hardening/github-hosted-runners branch August 5, 2026 12:59
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.

2 participants