DecodeMarketing commited on
Commit
c745b10
·
unverified ·
1 Parent(s): c5ea95f

ci(ai-standards): SHA-pin actions + least-privilege permissions (slice 2b) (#25)

Browse files

Workflow hardening only — no app-code edits. Completes the deferred
slice 2b from the icat_app standards remediation.

SHA-pin all workflow actions (floating tags can be moved; SHAs cannot):
- actions/checkout -> 11bd719 (v4.2.2) in main.yml, gate.yml (x2), repo_validate.yml
(main.yml bumped v3->v4 to match the rest of the repo; v3 is deprecated)
- actions/setup-python -> a26af69 (v5.6.0) in repo_validate.yml
- ActionsDesk/lfs-warning -> 1a3a745 (v2.0) in check-file-size.yml
(third-party; kept on v2 to avoid a behavior change)

Add least-privilege permissions blocks:
- main.yml, gate.yml: contents: read (deploy pushes via HF_TOKEN; incident
job files issues via a PAT — neither needs GITHUB_TOKEN write)
- check-file-size.yml: contents: read + issues: write + pull-requests: write
(lfs-warning adds the lfs-detected! label and posts a PR comment)
- repo_validate.yml already had contents: read

Manifest: slice-2b deferred -> in_progress with the pin/permission ledger.

.claude/manifests/standards-sync.yaml CHANGED
@@ -92,11 +92,18 @@ slices:
92
  pr: null
93
  merge_commit: null
94
  merged_at: null
95
- status: deferred
96
  notes: |
97
- SHA-pin actions/checkout and add `permissions:` blocks on main.yml,
98
- gate.yml, check-file-size.yml. Touches the HF deploy pipeline, so
99
- reserved for a dedicated focused PR.
 
 
 
 
 
 
 
100
 
101
  work_folder: "C:\\Users\\JulianeMatussek\\decode-ai-standards-work\\icat_app"
102
  # Audit artifacts (audit-result.yaml, delta-summary.md, remediation-plan.md,
 
92
  pr: null
93
  merge_commit: null
94
  merged_at: null
95
+ status: in_progress
96
  notes: |
97
+ SHA-pin every workflow action and add least-privilege `permissions:`
98
+ blocks. Touches the HF deploy pipeline (main.yml), so done as a
99
+ dedicated focused PR with post-merge deploy verification.
100
+ Pins: actions/checkout -> 11bd719 (v4.2.2; main.yml bumped v3->v4),
101
+ actions/setup-python -> a26af69 (v5.6.0),
102
+ ActionsDesk/lfs-warning -> 1a3a745 (v2.0, kept on v2 to avoid a
103
+ third-party behavior change). Permissions: main.yml + gate.yml =>
104
+ contents:read; check-file-size.yml => contents:read + issues:write +
105
+ pull-requests:write (lfs-warning labels + comments on PRs);
106
+ repo_validate.yml already had contents:read.
107
 
108
  work_folder: "C:\\Users\\JulianeMatussek\\decode-ai-standards-work\\icat_app"
109
  # Audit artifacts (audit-result.yaml, delta-summary.md, remediation-plan.md,
.github/workflows/check-file-size.yml CHANGED
@@ -6,11 +6,19 @@ on: # or directly `on: [push]` to run the action on every push on
6
  # to run this workflow manually from the Actions tab
7
  workflow_dispatch:
8
 
 
 
 
 
 
 
 
9
  jobs:
10
  sync-to-hub:
11
  runs-on: ubuntu-latest
12
  steps:
13
  - name: Check large files
14
- uses: ActionsDesk/lfs-warning@v2.0
 
15
  with:
16
  filesizelimit: 10485760 # this is 10MB so we can sync to HF Spaces
 
6
  # to run this workflow manually from the Actions tab
7
  workflow_dispatch:
8
 
9
+ # Least privilege: lfs-warning reads the PR's files and, on detection, adds the
10
+ # `lfs-detected!` label (issues API) and posts a PR comment (pull-requests API).
11
+ permissions:
12
+ contents: read
13
+ issues: write
14
+ pull-requests: write
15
+
16
  jobs:
17
  sync-to-hub:
18
  runs-on: ubuntu-latest
19
  steps:
20
  - name: Check large files
21
+ # SHA-pinned third-party action (supply-chain hardening).
22
+ uses: ActionsDesk/lfs-warning@1a3a74543c2cf92cc97aa1bad190a500bcb3829c # v2.0
23
  with:
24
  filesizelimit: 10485760 # this is 10MB so we can sync to HF Spaces
.github/workflows/gate.yml CHANGED
@@ -6,11 +6,16 @@ on:
6
  push:
7
  branches: [main, master]
8
 
 
 
 
 
 
9
  jobs:
10
  language-gate:
11
  runs-on: ubuntu-latest
12
  steps:
13
- - uses: actions/checkout@v4
14
  with:
15
  fetch-depth: 0
16
  - name: Install language-gate dependencies
@@ -46,7 +51,7 @@ jobs:
46
  override-audit:
47
  runs-on: ubuntu-latest
48
  steps:
49
- - uses: actions/checkout@v4
50
  with:
51
  fetch-depth: 0
52
  - name: Report override-reviewer usage
 
6
  push:
7
  branches: [main, master]
8
 
9
+ # Least privilege: the gate only reads the repo. The ci-fail-incident job files
10
+ # an issue in another repo using INCIDENT_LOG_TOKEN (a PAT), not GITHUB_TOKEN.
11
+ permissions:
12
+ contents: read
13
+
14
  jobs:
15
  language-gate:
16
  runs-on: ubuntu-latest
17
  steps:
18
+ - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
19
  with:
20
  fetch-depth: 0
21
  - name: Install language-gate dependencies
 
51
  override-audit:
52
  runs-on: ubuntu-latest
53
  steps:
54
+ - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
55
  with:
56
  fetch-depth: 0
57
  - name: Report override-reviewer usage
.github/workflows/main.yml CHANGED
@@ -6,11 +6,16 @@ on:
6
  # to run this workflow manually from the Actions tab
7
  workflow_dispatch:
8
 
 
 
 
 
 
9
  jobs:
10
  sync-to-hub:
11
  runs-on: ubuntu-latest
12
  steps:
13
- - uses: actions/checkout@v3
14
  with:
15
  fetch-depth: 0
16
  lfs: true
 
6
  # to run this workflow manually from the Actions tab
7
  workflow_dispatch:
8
 
9
+ # Least privilege: this workflow only reads the repo to check it out, then
10
+ # pushes to the external HF Space using HF_TOKEN (not GITHUB_TOKEN).
11
+ permissions:
12
+ contents: read
13
+
14
  jobs:
15
  sync-to-hub:
16
  runs-on: ubuntu-latest
17
  steps:
18
+ - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
19
  with:
20
  fetch-depth: 0
21
  lfs: true
.github/workflows/repo_validate.yml CHANGED
@@ -27,13 +27,13 @@ jobs:
27
  timeout-minutes: 5
28
  steps:
29
  - name: Checkout
30
- # Tag-pinned for slice 1. Slice 2 will SHA-pin all workflow actions.
31
- uses: actions/checkout@v4
32
  with:
33
  fetch-depth: 1
34
 
35
  - name: Set up Python
36
- uses: actions/setup-python@v5
37
  with:
38
  # Match runtime.txt so the validator sees the same Python the HF
39
  # Space uses. Keep these in sync.
 
27
  timeout-minutes: 5
28
  steps:
29
  - name: Checkout
30
+ # SHA-pinned in slice 2b (supply-chain hardening).
31
+ uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
32
  with:
33
  fetch-depth: 1
34
 
35
  - name: Set up Python
36
+ uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0
37
  with:
38
  # Match runtime.txt so the validator sees the same Python the HF
39
  # Space uses. Keep these in sync.