Skip to content

Commit dac6941

Browse files
authored
ci: standardize security posture (gitleaks + dependency-review + scorecard, explicit permissions) (#576)
Standardizes the Security workflow to the netresearch posture used by the other repo classes: - **gitleaks** — secret scanning - **dependency-review** — runs on PRs - **scorecard.yml** — OpenSSF supply-chain posture (new file) - existing **node-audit** kept (yarn / high) Every reusable caller job declares its exact permission union under a top-level `permissions: {}`, so the token passed to each reusable is explicit and never relies on `default_workflow_permissions` — making the planned org-wide default→read flip safe. Custom `codeql.yml` is unchanged.
2 parents e939acc + 7a1a168 commit dac6941

2 files changed

Lines changed: 52 additions & 2 deletions

File tree

.github/workflows/scorecard.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
name: OpenSSF Scorecard
2+
3+
# Supply-chain posture scoring (branch protection, pinned actions, token
4+
# permissions, …). Runs on default-branch push and on a weekly schedule;
5+
# results upload to the code-scanning dashboard.
6+
7+
on:
8+
push:
9+
branches: [main, master]
10+
schedule:
11+
- cron: '0 0 * * 0'
12+
workflow_dispatch:
13+
14+
permissions: {}
15+
16+
jobs:
17+
scorecard:
18+
uses: netresearch/.github/.github/workflows/scorecard.yml@main
19+
permissions:
20+
contents: read
21+
security-events: write
22+
id-token: write
23+
actions: read

.github/workflows/security.yml

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,41 @@
11
name: Security
22

3+
# Aggregated security scans: secret scanning (gitleaks), dependency review on
4+
# PRs, and a Node.js dependency audit.
5+
#
6+
# Top-level `permissions: {}` denies everything by default; each reusable
7+
# caller job re-declares the exact union its reusable requires, so the token
8+
# passed to each reusable is fully explicit and never relies on the repo
9+
# default (default_workflow_permissions). This is the same contract proven in
10+
# netresearch/.github's go-app / php-module templates.
11+
312
on:
4-
pull_request:
5-
branches: [main, master]
613
push:
714
branches: [main, master]
15+
pull_request:
16+
17+
permissions: {}
818

919
jobs:
20+
gitleaks:
21+
uses: netresearch/.github/.github/workflows/gitleaks.yml@main
22+
permissions:
23+
contents: read
24+
security-events: write
25+
secrets:
26+
GITLEAKS_LICENSE: ${{ secrets.GITLEAKS_LICENSE }}
27+
28+
dependency-review:
29+
if: github.event_name == 'pull_request'
30+
uses: netresearch/.github/.github/workflows/dependency-review.yml@main
31+
permissions:
32+
contents: read
33+
pull-requests: write
34+
1035
node-audit:
1136
uses: netresearch/.github/.github/workflows/node-audit.yml@main
37+
permissions:
38+
contents: read
1239
with:
1340
package-manager: yarn
1441
audit-level: high

0 commit comments

Comments
 (0)