mirror of
https://github.com/garrytan/gstack.git
synced 2026-09-09 22:48:57 +02:00
ci: least-privilege tokens on the two lanes that execute PR-controlled code
free-tests runs PR code (install lifecycle scripts + the suite) with whatever the repo-default GITHUB_TOKEN grant is, persisted into .git/config by checkout. Now: permissions contents:read, persist-credentials false, pinned by the wiring test. actionlint gets the same treatment plus a digest pin on the third-party Docker Hub image (a tag is repointable with no GitHub-side audit trail, and the image sees the mounted checkout). restore-keys added to both caches so a lockfile bump warms from the previous cache; stale --parallel header wording corrected.
This commit is contained in:
@@ -53,4 +53,12 @@ describe('free-tests workflow wiring', () => {
|
||||
expect(entries.length).toBe(count);
|
||||
}
|
||||
});
|
||||
|
||||
test('least-privilege token: contents read-only, credentials not persisted', () => {
|
||||
// The job executes PR-controlled code (install lifecycle scripts + the
|
||||
// suite itself). A default-grant GITHUB_TOKEN persisted into .git/config
|
||||
// by checkout would hand that code whatever the repo default allows.
|
||||
expect(source).toMatch(/permissions:\s*\n\s*contents:\s*read/);
|
||||
expect(source).toMatch(/persist-credentials:\s*false/);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user