Skip to content

Mint read-only App token for zizmor audit - #29

Closed
Wenxin Jiang (Wenxin-Jiang) wants to merge 2 commits into
masterfrom
wenxin/audit-readonly-app-token
Closed

Wenxin Jiang (Wenxin-Jiang) wants to merge 2 commits into
masterfrom
wenxin/audit-readonly-app-token

Conversation

@Wenxin-Jiang

@Wenxin-Jiang Wenxin Jiang (Wenxin-Jiang) commented Sep 14, 2026

Copy link
Copy Markdown

LLM Description written by Claude Code:claude-fable-5-1

The required Audit GitHub Actions check aborts in any repository that pins an action or reusable workflow from another private Socket repository. zizmor's online impostor-commit and ref-confusion audits list the target repository's refs; the repository GITHUB_TOKEN cannot read another private repository, the error is fatal, and zizmor exits with fatal: no audit was performed. First instance: depscan#26088, which pins SocketDev/patchpedia/.github/workflows/*-drop.yaml@<sha> (failing job). zizmor 1.23.1 has no per-file or per-repository escape (ignore rules filter findings after the audit; upstream zizmor#1350 recommends a token with access).

Change

When the audited repository provides vars.ZIZMOR_AUDIT_APP_CLIENT_ID, secrets.ZIZMOR_AUDIT_APP_PRIVATE_KEY and vars.ZIZMOR_AUDIT_REPOSITORIES, mint a contents: read installation token restricted to the repositories named in ZIZMOR_AUDIT_REPOSITORIES and pass it to zizmor. Everything else falls back to GITHUB_TOKEN, so repositories without those values behave exactly as today.

  • Minting is skipped for Dependabot actors and cross-repository pull requests (neither receives Actions secrets) and runs with continue-on-error, so a failed mint still falls back instead of failing the audit.
  • Report token source logs minted or fallback GITHUB_TOKEN so the effective mode is visible in the job log.
  • actions/create-github-app-token is pinned to the same SHA depscan uses (v3.2.0). The token is revoked in the action's post step.
  • secrets-outside-env is suppressed inline for the one secret reference; this workflow intentionally runs without an environment. Negative check: removing the comment yields one Medium finding (exit 13).

Provisioning (platform, before any repository opts in)

  1. Create a dedicated GitHub App (for example socket-zizmor-audit) with repository permissions Metadata: read and Contents: read only, no other permissions, no webhook.
  2. Install it on the org, limited to the repositories that audited workflows reference (for depscan: patchpedia) plus the consuming repositories.
  3. Add org variable ZIZMOR_AUDIT_APP_CLIENT_ID and org secret ZIZMOR_AUDIT_APP_PRIVATE_KEY, visible only to consuming repositories.
  4. Each consuming repository sets ZIZMOR_AUDIT_REPOSITORIES (comma-separated) to exactly the private repositories its workflows pin. depscan: patchpedia.

The first revision of this PR reused the Socket PR App credentials. Review feedback rejected that: its installation-wide token would expose every installed repository if leaked, and that App's private key can mint contents: write, pull-requests: write and actions: write tokens, so it is not a read-only credential. This revision keeps the key that this job can see limited to an App whose installation is itself read-only and repository-scoped.

Trust boundary

Pre-existing: the audit reads zizmor.yml, ignore comments and .gitignore from the PR checkout. New: the audit job holds a short-lived read-only token for the allowlisted repositories, used only for zizmor's API calls (zizmor does not execute workflows), and can reference the dedicated App's private key when the repository exposes it.

Validation

  • zizmor==1.23.1 .github --min-severity medium on this branch: no findings, exit 0.
  • actionlint 1.7.12: clean, including the multi-line if:.
  • The PR's own Audit GitHub Actions run scans this file (1 ignored finding = the inline comment). Required workflows run the master definition on PRs, so the new steps execute live only after merge; live proof is a fresh depscan#26088 run showing audit token: minted once provisioning is done.

This replaces the closed #28, which scoped a depscan-specific impostor-commit exception via a double scan; this change keeps provenance auditing enabled everywhere.

🤖 Generated with Claude Code

https://claude.ai/code/session_01FqKyQNqkiw7aakGFPCTg9t

Repositories that pin actions or reusable workflows from other private
Socket repositories fail the audit: zizmor's online provenance checks
cannot list refs with the repository GITHUB_TOKEN and abort the run.

When a repository provides vars.SOCKET_PR_CLIENT_ID and
secrets.SOCKET_PR_APP_PRIVATE_KEY, mint a contents:read installation
token for the audit step; otherwise, on Dependabot PRs and on
cross-repository PRs, fall back to GITHUB_TOKEN so behavior is
unchanged. The secret access is suppressed inline for
secrets-outside-env; this workflow runs without an environment by
design.

Assisted-by: Claude Code:claude-fable-5-1
Claude-Session: https://claude.ai/code/session_01FqKyQNqkiw7aakGFPCTg9t
@socket-security

socket-security Bot commented Sep 14, 2026

Copy link
Copy Markdown

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Addedactions/​create-github-app-token@​bcd2ba49218906704ab6c1aa796996da409d3eb190100100100100

View full report

@socket-security-staging

socket-security-staging Bot commented Sep 14, 2026

Copy link
Copy Markdown

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Addedactions/​create-github-app-token@​bcd2ba49218906704ab6c1aa796996da409d3eb190100100100100

View full report

Review feedback: an installation-wide token from the Socket PR App
exposes every installed repository if leaked, and that App's private
key can mint write tokens, so it is not a read-only credential.

Mint from dedicated ZIZMOR_AUDIT_APP_* credentials instead, intended
for an App whose installation only grants read access, and restrict
the token to the repositories each consumer names in
ZIZMOR_AUDIT_REPOSITORIES. Minting is skipped unless both are set.

Assisted-by: Claude Code:claude-fable-5-1
Claude-Session: https://claude.ai/code/session_01FqKyQNqkiw7aakGFPCTg9t
@Wenxin-Jiang

Copy link
Copy Markdown
Author

[agent] Closing: no longer needed. depscan PR SocketDev/depscan#26088 was reworked so depscan no longer calls Patchpedia reusable workflows (commit 125c280ba7). Patchpedia CI owns publication and depscan only reads the published release, so the audit has no private cross-repository uses: pins to resolve. The Audit GitHub Actions check passes on that head with the plain GITHUB_TOKEN.

auto-merge was automatically disabled September 14, 2026 19:35

Pull request was closed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant