Repository navigation
chore: add security scanning workflows #2466
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
+322
−23
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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,21 @@ | ||
| # Copyright Advanced Micro Devices, Inc. | ||
| # SPDX-License-Identifier: MIT | ||
| # | ||
| # Dependabot version updates. See | ||
| # https://docs.github.com/en/code-security/reference/supply-chain-security/dependabot-options-reference | ||
|
|
||
| version: 2 | ||
| updates: | ||
| - package-ecosystem: "github-actions" | ||
| # "/" covers the workflows in .github/workflows. | ||
| directories: | ||
| - "/" | ||
| schedule: | ||
| interval: "daily" | ||
| commit-message: | ||
| prefix: "chore" | ||
| include: "scope" | ||
| groups: | ||
| github-actions: | ||
| patterns: | ||
| - "*" |
This file contains hidden or 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,19 @@ | ||
| # bandit configuration for rocMLIR | ||
| # Reference: https://bandit.readthedocs.io/en/latest/config.html | ||
| # | ||
| # pr-security-scan.yml and weekly-security-scan.yml pass this file to the | ||
| # shared ROCm/rocm-security-gh scan, where it replaces the shared default | ||
| # config wholesale rather than layering onto it. Exclusions and suppressions | ||
| # for this repository (e.g. `skips: [...]`) belong here. | ||
|
|
||
| exclude_dirs: | ||
| - .git | ||
| - .venv | ||
| - venv | ||
| - build | ||
| - dist | ||
| - node_modules | ||
| - __pycache__ | ||
| # Vendored upstream trees. Bandit treats each entry as a substring of the | ||
| # scanned path, so the slashes keep this exclusion to the directory. | ||
| - /external/ |
This file contains hidden or 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,84 @@ | ||
| # gitleaks configuration for rocMLIR | ||
| # Reference: https://github.com/gitleaks/gitleaks/blob/master/config/gitleaks.toml | ||
| # | ||
| # pr-security-scan.yml and weekly-security-scan.yml pass this file to the | ||
| # shared ROCm/rocm-security-gh scan, where it replaces the shared default | ||
| # config wholesale rather than layering onto it. | ||
| # | ||
| # Within a scan, the layering is: | ||
| # * the `[[allowlists]]` below, applying to every rule. | ||
| # * `.gitleaksignore` at the scanned repo's root, carrying one-off | ||
| # fingerprint suppressions for historical findings that don't fit | ||
| # a structural rule. Keep that file shrinking; move recurring | ||
| # patterns up into a config when you see them. | ||
|
|
||
| title = "gitleaks config" | ||
|
|
||
| [extend] | ||
| # Inherit gitleaks' built-in ruleset (rotations, AWS, GCP, Slack, ...). | ||
| # Setting this to false would mean rolling our own detections, which | ||
| # is almost never what you want. | ||
| useDefault = true | ||
|
|
||
|
|
||
|
|
||
| # Allowlist field-vs-target reference: | ||
| # stopwords -> always matched against the SECRET value. | ||
| # regexes -> matched against `regexTarget` (default: "secret"). | ||
| # regexTarget -> "secret" | "match" | "line". | ||
| # Use "match" or "line" when the "tell" is the variable name or | ||
| # surrounding syntax, not the value itself. | ||
|
|
||
| [[allowlists]] | ||
| # Allowlist by location only where a real first-party secret structurally | ||
| # can't live. Dependency lock files qualify: their contents are generated | ||
| # from a manifest, and the high-entropy strings they carry are artifact | ||
| # digests rather than credentials. | ||
| description = "Generated dependency lock files" | ||
| paths = [ | ||
| '''.*\.lock$''', | ||
| ] | ||
|
|
||
| [[allowlists]] | ||
| description = "Vendored upstream trees" | ||
| paths = [ | ||
| '''^external/''', | ||
| ] | ||
|
|
||
| [[allowlists]] | ||
| description = "Test fixtures using well-known dummy variable names" | ||
| # The "tell" here is the variable name on the same line, not the value | ||
| # (the value is a random-looking string by design). Match against the | ||
| # full rule match (variable + value) so we anchor on the identifier. | ||
| regexTarget = "match" | ||
| regexes = [ | ||
| '''(?i)\bINVALID_TOKEN\s*=''', | ||
| '''(?i)\bwrong_secret\s*=''', | ||
| '''(?i)\bsecret\s*=''' | ||
|
umangyadav marked this conversation as resolved.
Resolved
|
||
| ] | ||
|
|
||
| [[allowlists]] | ||
| description = "Dummy gateway key in the Claude sanitizer tests" | ||
| # The sanitizer tests feed this made-up key to the sanitizer to verify that it | ||
| # is rejected. Requiring both the exact path and value means a real secret in | ||
| # the test file is still reported. | ||
| condition = "AND" | ||
| paths = [ | ||
| '''^\.github/scripts/tests/test_sanitize\.sh$''', | ||
| ] | ||
| regexes = [ | ||
| '''^sk-secret-xyzzy-12345$''', | ||
| ] | ||
|
|
||
| [[allowlists]] | ||
| description = "Public artifact digests (variable names ending in SHA256/512/MD5)" | ||
| # SHA-256/512/MD5 hashes of public artifacts (tarballs, GPG keys, | ||
| # mirrored binaries) are not secrets - they're one-way digests used | ||
| # for integrity verification. Match by variable name (against the | ||
| # whole line) so we don't broadly allowlist every 64-char hex string. | ||
| regexTarget = "line" | ||
| regexes = [ | ||
| '''[A-Z][A-Z0-9_]*SHA256\s*[=:]''', | ||
| '''[A-Z][A-Z0-9_]*SHA512\s*[=:]''', | ||
| '''[A-Z][A-Z0-9_]*MD5\s*[=:]''', | ||
| ] | ||
This file contains hidden or 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,19 @@ | ||
| # trivy configuration for rocMLIR | ||
| # Reference: https://trivy.dev/latest/docs/references/configuration/config-file/ | ||
| # | ||
| # pr-security-scan.yml and weekly-security-scan.yml pass this file to the | ||
| # shared ROCm/rocm-security-gh scan, where it replaces the shared default | ||
| # config wholesale rather than layering onto it. Tuning for this repository | ||
| # belongs here; per-finding suppressions go in a .trivyignore at the root. | ||
|
|
||
| scan: | ||
| skip-dirs: | ||
| - .git | ||
| - .venv | ||
| - venv | ||
| - build | ||
| - dist | ||
| - node_modules | ||
| - __pycache__ | ||
| # Vendored upstream trees. | ||
| - external |
This file contains hidden or 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,21 @@ | ||
| # zizmor configuration for rocMLIR | ||
| # Reference: https://docs.zizmor.sh/configuration/ | ||
| # | ||
| # pr-security-scan.yml and weekly-security-scan.yml pass this file to the | ||
| # shared ROCm/rocm-security-gh scan, where it replaces the shared default | ||
| # config wholesale rather than layering onto it. Zizmor has no path | ||
| # exclusions; vendored workflows are kept out by /external/*/.github in the | ||
| # root .gitignore. | ||
| # | ||
| # Per-rule ignore lists and tuning live under `rules:`, as | ||
| # `<rule-id>: { ignore: [file.yml:line:col] }`, which keeps a suppression | ||
| # reviewable in one place rather than scattered as inline comments | ||
| # across workflows. | ||
| rules: | ||
| dangerous-triggers: | ||
| ignore: | ||
| # These companions need pull_request_target to label and comment on fork | ||
| # PRs. Neither checks out nor runs PR code; both default to no permissions | ||
| # and use explicitly scoped App tokens. See CLAUDE_AUTO_REVIEW.md. | ||
| - claude_auto_review_fork_notify.yml | ||
| - claude_auto_review_perimeter_banner.yml |
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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,38 @@ | ||
| # Copyright Advanced Micro Devices, Inc. | ||
| # SPDX-License-Identifier: MIT | ||
|
umangyadav marked this conversation as resolved.
Resolved
|
||
| # | ||
| # PR security gate: fast, PR-side security scanners that run on every pull | ||
| # request. This complements the premerge checks in `ci.yml`. The set of | ||
| # scanners lives in `security-baseline.yml`, so scanners coming online are | ||
| # picked up here without touching this file. | ||
| # | ||
| # `report_formats: human` applies to Bandit, Gitleaks, Trivy, and Zizmor: | ||
| # their findings are uploaded as build artifacts and printed to job summaries. | ||
| # GitHub permits code-scanning uploads triggered by `pull_request` even without | ||
| # `security-events: write`, so CodeQL uploads its results independently. See | ||
| # weekly-security-scan.yml for non-PR SARIF uploads and explicit permission. | ||
|
|
||
| name: Security scan (PR) | ||
|
|
||
| on: | ||
| pull_request: | ||
| # Spelled out the default to avoid confusion. | ||
| types: [opened, synchronize, reopened] | ||
|
|
||
| permissions: | ||
| contents: read | ||
|
|
||
| concurrency: | ||
| group: ${{ github.workflow }}-${{ github.event.pull_request.number }} | ||
| cancel-in-progress: true | ||
|
|
||
| jobs: | ||
| security: | ||
| name: Security scan | ||
| uses: ROCm/rocm-security-gh/.github/workflows/security-baseline.yml@62c2c4f3effcd47711da28276815c90cb4aa6444 # v1.0.2 | ||
|
umangyadav marked this conversation as resolved.
Resolved
|
||
| with: | ||
| report_formats: human | ||
| bandit_config_path: .github/scan_tools_configs/bandit.yml | ||
| gitleaks_config_path: .github/scan_tools_configs/gitleaks.toml | ||
| trivy_config_path: .github/scan_tools_configs/trivy.yml | ||
| zizmor_config_path: .github/scan_tools_configs/zizmor.yml | ||
This file contains hidden or 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,39 @@ | ||
| # Copyright Advanced Micro Devices, Inc. | ||
| # SPDX-License-Identifier: MIT | ||
| # | ||
| # Weekly security scan: runs on a fixed cadence and pushes SARIF findings | ||
| # to the repository's code-scanning Security tab. Complements | ||
| # `pr-security-scan.yml`, which scans only what changed in a PR and | ||
| # uploads reviewer-readable artifacts for in-review browsing. | ||
| # | ||
| # `security-events: write` is granted on the `uses:` job itself, not just | ||
| # the top-level `permissions:` block above it, since a `permissions:` | ||
| # block (wherever declared) implicitly zeroes out anything it doesn't | ||
| # list. | ||
|
|
||
| name: Security scan (Weekly) | ||
|
|
||
| on: | ||
| # Run every Saturday at 10:00 UTC. | ||
| schedule: | ||
| - cron: "0 10 * * 6" | ||
| workflow_dispatch: | ||
|
|
||
| permissions: | ||
| contents: read | ||
|
|
||
| jobs: | ||
| security: | ||
| name: Security scan | ||
| # Only the job that uploads SARIF gets write access to code scanning. | ||
| permissions: | ||
| contents: read | ||
| security-events: write | ||
| uses: ROCm/rocm-security-gh/.github/workflows/security-baseline.yml@62c2c4f3effcd47711da28276815c90cb4aa6444 # v1.0.2 | ||
| with: | ||
| scan_mode: all | ||
| report_formats: sarif | ||
| bandit_config_path: .github/scan_tools_configs/bandit.yml | ||
| gitleaks_config_path: .github/scan_tools_configs/gitleaks.toml | ||
| trivy_config_path: .github/scan_tools_configs/trivy.yml | ||
| zizmor_config_path: .github/scan_tools_configs/zizmor.yml |
This file contains hidden or 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
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.