Skip to content

Commit 0a66402

Browse files
fix(security): scorecard job permissions, dispatch secret-gate, .envrc placeholder (#30)
Addresses pre-existing Hypatia workflow_audit findings (unrelated to the timeout PR): - scorecard.yml: add explicit least-privilege job permissions to the OpenSSF Scorecard reusable-workflow caller (was inheriting top-level read-all, which can't grant the security-events/id-token writes publishing needs). Clears scorecard_wrapper_missing_job_permissions. - instant-sync.yml: presence-gate the repository-dispatch step on FARM_DISPATCH_TOKEN (mapped to a job env var, since secrets can't be used in if:) so forks skip it instead of firing with an empty token. Clears secret_action_without_presence_gate. - .envrc: substitute the unsubstituted {{PROJECT_NAME}} scaffold placeholder with the real project name. Deferred: SHA-pinning governance.yml's governance-reusable.yml@main needs the standards@main commit SHA, and the standards repo is out of this session's scope. The critical .envrc 'Generic API key' finding is a false positive (a commented-out '# export API_KEY="..."' placeholder on line 24; gitleaks and trufflehog both pass). Claude-Session: https://claude.ai/code/session_01Y2MWTAqX2x7goVJzjFB4j5 Co-authored-by: Claude <noreply@anthropic.com>
1 parent 86ce866 commit 0a66402

3 files changed

Lines changed: 17 additions & 1 deletion

File tree

.envrc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ if has nix && [ -f flake.nix ]; then
1818
fi
1919

2020
# Project environment variables
21-
export PROJECT_NAME="{{PROJECT_NAME}}"
21+
export PROJECT_NAME="wokelangiser"
2222
export RSR_TIER="infrastructure"
2323
# export DATABASE_URL="..."
2424
# export API_KEY="..."

.github/workflows/instant-sync.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,15 @@ jobs:
1515
dispatch:
1616
runs-on: ubuntu-latest
1717
timeout-minutes: 15
18+
# Presence-gate: `secrets` can't be referenced directly in `if:`, so the
19+
# token is mapped to a job-level env var the steps guard on. On forks
20+
# (where FARM_DISPATCH_TOKEN is unset) the dispatch is skipped instead of
21+
# firing with an empty token.
22+
env:
23+
FARM_DISPATCH_TOKEN: ${{ secrets.FARM_DISPATCH_TOKEN }}
1824
steps:
1925
- name: Trigger Propagation
26+
if: ${{ env.FARM_DISPATCH_TOKEN != '' }}
2027
uses: peter-evans/repository-dispatch@28959ce8df70de7be546dd1250a005dd32156697 # v3
2128
with:
2229
token: ${{ secrets.FARM_DISPATCH_TOKEN }}
@@ -31,4 +38,5 @@ jobs:
3138
}
3239
3340
- name: Confirm
41+
if: ${{ env.FARM_DISPATCH_TOKEN != '' }}
3442
run: echo "::notice::Propagation triggered for ${{ github.event.repository.name }}"

.github/workflows/scorecard.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,13 @@ permissions: read-all
1212

1313
jobs:
1414
analysis:
15+
# Least-privilege scopes for the OpenSSF Scorecard reusable workflow
16+
# (was inheriting the top-level read-all, which can't grant the writes
17+
# publishing needs). Caps what the reusable workflow can request.
18+
permissions:
19+
contents: read
20+
security-events: write
21+
id-token: write
22+
actions: read
1523
uses: hyperpolymath/standards/.github/workflows/scorecard-reusable.yml@e0caf11508a3989574713c78f5f444f2ce5e33ef
1624
secrets: inherit

0 commit comments

Comments
 (0)