Semgrep #413
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
| # Name of this GitHub Actions workflow. | |
| name: Semgrep | |
| on: | |
| # Scan changed files in PRs (diff-aware scanning): | |
| # The branches below must be a subset of the branches above | |
| pull_request: | |
| branches: ["master", "main"] | |
| push: | |
| branches: ["master", "main"] | |
| schedule: | |
| - cron: '0 6 * * *' | |
| permissions: | |
| contents: read | |
| jobs: | |
| semgrep: | |
| # User definable name of this GitHub Actions job. | |
| permissions: | |
| contents: read # for actions/checkout to fetch code | |
| security-events: write # for github/codeql-action/upload-sarif to upload SARIF results | |
| name: semgrep/ci | |
| # If you are self-hosting, change the following `runs-on` value: | |
| runs-on: ubuntu-latest | |
| container: | |
| # Pinned by digest for supply-chain integrity (DEVA11Y-476). | |
| # To update: docker manifest inspect returntocorp/semgrep:latest | |
| image: returntocorp/semgrep@sha256:f1f7b71861c7b28b6e0f661225a2c4f58a484f5d0f182465c6d6b3b22f972ade | |
| steps: | |
| # Fetch project source with GitHub Actions Checkout. | |
| - uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3 | |
| # Run the "semgrep ci" command on the command line of the docker image. | |
| - run: semgrep ci --sarif --output=semgrep.sarif | |
| env: | |
| # Add the rules that Semgrep uses by setting the SEMGREP_RULES environment variable. | |
| SEMGREP_RULES: p/default # more at semgrep.dev/explore | |
| - name: Upload SARIF file for GitHub Advanced Security Dashboard | |
| uses: github/codeql-action/upload-sarif@6c089f53dd51dc3fc7e599c3cb5356453a52ca9e # v2.20.0 | |
| with: | |
| sarif_file: semgrep.sarif | |
| # SARIF upload needs security-events: write, which Dependabot-triggered runs | |
| # do not get; skip only this privileged step for dependabot so the scan itself | |
| # still runs on Dependabot PRs (which bump the action pins that live in this | |
| # very workflow). always() keeps upload on non-dependabot runs even if the scan | |
| # step reports findings. | |
| if: always() && github.actor != 'dependabot[bot]' | |