Skip to content
This repository was archived by the owner on May 29, 2026. It is now read-only.

Commit ec84a5d

Browse files
committed
fix(security): api-test-coverage — deny-by-default permissions
The workflow triggers on `pull_request` and runs PR-supplied scripts (`tests/newman/run-all.sh`) inside a CI container, copying the entire working tree in via `tar | docker exec`. With no `permissions:` block the job inherits the repo-default GITHUB_TOKEN scope, which on some org configs grants `pull-requests: write` (comment/approve/push back). Add a workflow-level + job-level `permissions: contents: read`. The suite only needs to clone the PR ref. If a future step writes artifacts/comments, scope it explicitly on that job rather than relaxing the default. Pinning `pgvector/pgvector:pg16` and `nextcloud:32-apache` to digests (reviewer's second recommendation) is left as a follow-up — getting the wrong digest breaks CI immediately and digest lookup needs Docker Hub access at commit time. Refs: #1419 review (blocker 8) — discussion_r3187494448
1 parent e3742bb commit ec84a5d

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

.github/workflows/api-test-coverage.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,15 @@
1313

1414
name: api-test-coverage
1515

16+
# SECURITY: deny-by-default permissions for the GITHUB_TOKEN at the
17+
# workflow level. The job below runs PR-supplied scripts
18+
# (tests/newman/run-all.sh) inside a CI container, so a malicious PR
19+
# could otherwise exfiltrate the token or use it to comment/approve/
20+
# push. `contents: read` is the only scope the suite needs (clones the
21+
# PR ref). Override per-job if a future step needs more.
22+
permissions:
23+
contents: read
24+
1625
on:
1726
push:
1827
branches: [development, main]
@@ -30,6 +39,8 @@ jobs:
3039
name: Newman API Test Suite
3140
runs-on: ubuntu-latest
3241
timeout-minutes: 30
42+
permissions:
43+
contents: read
3344

3445
steps:
3546
- name: Checkout repo

0 commit comments

Comments
 (0)