Skip to content

ci: harden lint workflows against credential exposure in fork PRs#586

Open
KevinZhao wants to merge 1 commit intogoogleapis:mainfrom
KevinZhao:fix/ci-harden-lint-workflows
Open

ci: harden lint workflows against credential exposure in fork PRs#586
KevinZhao wants to merge 1 commit intogoogleapis:mainfrom
KevinZhao:fix/ci-harden-lint-workflows

Conversation

@KevinZhao
Copy link

Summary

The four lint workflows (lint-toolbox-core, lint-toolbox-adk, lint-toolbox-langchain, lint-toolbox-llamaindex) currently run the label-removal step and the lint steps in a single job. This means the lint steps — which check out and execute fork PR code (pip install -r requirements.txt, pip install .[test]) — run with pull-requests: write and issues: write permissions that are only needed by the label-removal step.

This PR splits each workflow into two jobs:

  • remove-label: has write permissions, does NOT check out or execute any PR code
  • lint: checks out and runs PR code, but only has contents: read permission

Also adds persist-credentials: false to the checkout step so the GITHUB_TOKEN is not stored in ~/.git-credentials where subsequent steps could read it.

This follows the same hardening pattern applied to googleapis/genai-toolbox in commits 949e8242 and 3f83c497.

Reference

Split the single lint job into two separate jobs to follow the
principle of least privilege:

- remove-label: runs with write permissions but does NOT check out
  or execute any PR code
- lint: checks out and executes PR code but only has read permissions

Also add persist-credentials: false to the checkout step to prevent
the GITHUB_TOKEN from being stored in git credentials where it could
be read by subsequent steps.

This follows the same pattern applied to googleapis/genai-toolbox in
commits 949e8242 and 3f83c497.

Reference: https://securitylab.github.com/resources/github-actions-preventing-pwn-requests/
@KevinZhao KevinZhao requested a review from a team as a code owner March 13, 2026 15:15
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