-
Notifications
You must be signed in to change notification settings - Fork 280
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
76351dc
commit 5ff477f
Showing
2 changed files
with
58 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
name: Scan GitHub Action workflows files for security issues | ||
|
||
on: | ||
pull_request: {} | ||
workflow_dispatch: {} | ||
push: | ||
paths: | ||
- '.github/workflows/**.ya?ml' | ||
|
||
permissions: | ||
contents: read | ||
security-events: write | ||
|
||
jobs: | ||
semgrep: | ||
name: semgrep-oss/scan | ||
runs-on: ubuntu-latest | ||
|
||
container: | ||
image: semgrep/semgrep | ||
|
||
# Skip any PR created by dependabot to avoid permission issues: | ||
if: (github.actor != 'dependabot[bot]') | ||
|
||
steps: | ||
- name: Checkout Code | ||
uses: actions/checkout@v4 | ||
|
||
|
||
- name: Run Actions semgrep scan | ||
run: semgrep scan --sarif --config semgrep-rules/actions >> semgrep-results-actions.sarif | ||
|
||
- name: Save Actions SARIF results as artifact | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: semgrep-scan-results-actions | ||
path: semgrep-results-actions.sarif | ||
|
||
- name: Upload Actions SARIF result to the GitHub Security Dashboard | ||
uses: github/codeql-action/upload-sarif@v3 | ||
with: | ||
sarif_file: semgrep-results-actions.sarif | ||
if: always() |
15 changes: 15 additions & 0 deletions
15
semgrep-rules/actions/pull_request_target_needs_exception.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
rules: | ||
- id: pull-request-target-needs-exception | ||
languages: | ||
- yaml | ||
severity: WARNING | ||
message: pull_request_target for Google repos is only approved by exception. | ||
metadata: | ||
category: best-practice | ||
technology: | ||
- github-actions | ||
patterns: | ||
- pattern-either: | ||
- patterns: | ||
- pattern-inside: "{on: ...}" | ||
- pattern: pull_request_target |