ci: declare workflow-level contents: read on 6 workflows#2042
ci: declare workflow-level contents: read on 6 workflows#2042arpitjain099 wants to merge 1 commit into
contents: read on 6 workflows#2042Conversation
Greptile SummaryThis PR adds a workflow-level
|
| Filename | Overview |
|---|---|
| .github/workflows/ci-main.yml | Adds workflow-level permissions: contents: read; only calls reusable workflows for pre-commit and Docker build/test, no GITHUB_TOKEN writes needed. |
| .github/workflows/ci-pull-request.yml | Adds workflow-level permissions: contents: read; PR number is read from event payload (not API), no status or PR-write permissions required. |
| .github/workflows/docker-build-arm.yml | Adds workflow-level permissions: contents: read; artifact upload uses ACTIONS_RUNTIME_TOKEN, not GITHUB_TOKEN, so the scope is correct. |
| .github/workflows/integration-test-library-mode.yml | Adds workflow-level permissions: contents: read; only does checkout and runs pytest against hosted NIMs — no GitHub API writes. |
| .github/workflows/retriever-unit-tests.yml | Adds workflow-level permissions: contents: read; checkout plus pytest only — correct scope. |
| .github/workflows/scheduled-nightly.yml | Adds workflow-level permissions: contents: read; Docker push targets external NGC registry (no packages: write needed), PyPI publish uses Artifactory credentials (not GITHUB_TOKEN), artifact transfers use ACTIONS_RUNTIME_TOKEN. |
Flowchart
%%{init: {'theme': 'neutral'}}%%
flowchart TD
subgraph Workflow Permissions After This PR
A["ci-main.yml\npermissions: contents: read"] --> B["reusable-pre-commit.yml"]
A --> C["reusable-docker-build-and-test.yml\n(artifact via ACTIONS_RUNTIME_TOKEN)"]
D["ci-pull-request.yml\npermissions: contents: read"] --> B
D --> C
D --> E["inline jobs\n(checkout + pytest only)"]
F["docker-build-arm.yml\npermissions: contents: read"] --> G["checkout + docker buildx\n(artifact upload via ACTIONS_RUNTIME_TOKEN)"]
H["integration-test-library-mode.yml\npermissions: contents: read"] --> I["checkout + pytest\n(external NIM APIs)"]
J["retriever-unit-tests.yml\npermissions: contents: read"] --> K["checkout + pytest"]
L["scheduled-nightly.yml\npermissions: contents: read"] --> M["docker buildx push\n(NGC — no GITHUB_TOKEN)"]
L --> N["reusable-pypi-build.yml"]
N --> O["reusable-pypi-publish.yml\n(artifact via ACTIONS_RUNTIME_TOKEN;\nArtifactory via secrets)"]
end
style A fill:#d4edda
style D fill:#d4edda
style F fill:#d4edda
style H fill:#d4edda
style J fill:#d4edda
style L fill:#d4edda
Reviews (3): Last reviewed commit: "ci: declare workflow-level contents: rea..." | Re-trigger Greptile
Pins the default GITHUB_TOKEN to contents: read on the workflows in .github/workflows/ that don't call a GitHub API beyond the initial checkout. The other workflows in this directory are left implicit because they need write scopes that a maintainer is better placed to declare. Motivation: CVE-2025-30066 (March 2025 tj-actions/changed-files compromise) exfiltrated GITHUB_TOKEN from workflow logs. Per-workflow caps bound runtime authority irrespective of repo or org default, give drift protection if the default ever widens, and are credited per-file by the OpenSSF Scorecard Token-Permissions check. YAML validated locally with yaml.safe_load. Signed-off-by: Arpit Jain <arpitjain099@gmail.com>
f9664a1 to
cb8e184
Compare
Pins the default
GITHUB_TOKENtocontents: readon 6 workflows in.github/workflows/that don't call a GitHub API beyond the initial checkout.Why
CVE-2025-30066 (March 2025
tj-actions/changed-filessupply-chain compromise) exfiltratedGITHUB_TOKENfrom workflow logs. Pinning per workflow caps runtime authority irrespective of the repo or org default, gives drift protection if the default ever widens, and is credited per-file by the OpenSSF ScorecardToken-Permissionscheck.YAML validated locally with
yaml.safe_loadon each touched file.