Commit a5f3976
committed
fix(security): explicit branch check on nightly workflow_run trigger
Add `head_branch == 'develop'` guard to the nightly workflow's init
job. The `branches: [develop]` filter on the trigger already enforces
this, but static analyzers (OSSF Scorecard's DangerousWorkflow rule)
can't trace that — they see workflow_run + head_sha checkout +
secrets: inherit and flag the pattern critical regardless of the
trigger filter.
The explicit branch check ties the trust boundary to develop's branch
protection (PR + code-owner review + required checks), which is the
actual safety guarantee. All downstream jobs depend on init via
needs:, so they inherit the gate without per-job changes.
Behavior is unchanged: workflow_run runs that wouldn't have fired
under the trigger filter still don't fire. Manual workflow_dispatch
remains unaffected.
Note: `workflow_run` triggers always execute the version of this
file from main (per GitHub's rules), so this fix takes effect for
runtime safety only after develop → main lands. The static-analysis
finding (#760, alert #565) closes once the Scorecard scan re-runs
against develop with this change.
Fixes #7601 parent a7688e8 commit a5f3976
1 file changed
Lines changed: 17 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
47 | 47 | | |
48 | 48 | | |
49 | 49 | | |
50 | | - | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
51 | 67 | | |
52 | 68 | | |
53 | 69 | | |
| |||
0 commit comments