-
Notifications
You must be signed in to change notification settings - Fork 4
Include SAST and SCA #173
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
Merged
Include SAST and SCA #173
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
de776cb
Include SAST and SCA
daeisbae 85c2097
Use Trivy and Opengrep for security scans
daeisbae e62e5e0
Restrict pull request workflow permissions
daeisbae 8659bdc
fix: vulnerable dependencies
jbriones1 e32e3cd
fix: change raw SQL query to use the SQLAlchemy function
jbriones1 dfca2b8
chore: bump dependency version
jbriones1 1d85697
Allow known Opengrep parser warnings
daeisbae 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,26 @@ | ||
| version: 2 | ||
|
|
||
| updates: | ||
| - package-ecosystem: uv | ||
| directory: / | ||
| schedule: | ||
| interval: weekly | ||
| day: monday | ||
| time: "09:00" | ||
| timezone: America/Vancouver | ||
| groups: | ||
| python-dependencies: | ||
| patterns: | ||
| - "*" | ||
|
|
||
| - package-ecosystem: github-actions | ||
| directory: / | ||
| schedule: | ||
| interval: weekly | ||
| day: monday | ||
| time: "09:15" | ||
| timezone: America/Vancouver | ||
| 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
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 |
|---|---|---|
| @@ -1,6 +1,9 @@ | ||
| name: Unit Tests | ||
| on: pull_request | ||
|
|
||
| permissions: | ||
| contents: read | ||
|
|
||
| jobs: | ||
| unit_tests: | ||
| runs-on: ubuntu-latest | ||
|
|
||
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 |
|---|---|---|
| @@ -1,5 +1,9 @@ | ||
| name: Ruff | ||
| on: pull_request | ||
|
|
||
| permissions: | ||
| contents: read | ||
|
|
||
| jobs: | ||
| ruff: | ||
| runs-on: ubuntu-latest | ||
|
|
||
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,112 @@ | ||
| name: Security | ||
|
|
||
| on: | ||
| pull_request: | ||
| push: | ||
| branches: | ||
| - main | ||
| schedule: | ||
| - cron: "17 9 * * 1" | ||
| workflow_dispatch: | ||
|
|
||
| permissions: | ||
| contents: read | ||
|
Comment on lines
+12
to
+13
|
||
|
|
||
| env: | ||
| OPENGREP_VERSION: v1.27.1 | ||
| TRIVY_VERSION: v0.74.0 | ||
|
|
||
| jobs: | ||
| sast: | ||
| name: Opengrep SAST | ||
| runs-on: ubuntu-latest | ||
| timeout-minutes: 15 | ||
|
|
||
| steps: | ||
| - name: Checkout repository | ||
| uses: actions/checkout@v7.0.1 | ||
| with: | ||
| persist-credentials: false | ||
|
|
||
| - name: Install Opengrep | ||
| run: | | ||
| curl --fail --location --silent --show-error \ | ||
| "https://github.com/opengrep/opengrep/releases/download/${OPENGREP_VERSION}/opengrep_manylinux_x86" \ | ||
| --output "$RUNNER_TEMP/opengrep" | ||
| chmod 0555 "$RUNNER_TEMP/opengrep" | ||
| "$RUNNER_TEMP/opengrep" --version | ||
|
Comment on lines
+33
to
+37
|
||
|
|
||
| - name: Scan source code | ||
| run: | | ||
| mkdir -p reports | ||
| "$RUNNER_TEMP/opengrep" scan \ | ||
| --config auto \ | ||
| --no-rewrite-rule-ids \ | ||
| --disable-version-check \ | ||
| --error \ | ||
| --sarif-output=reports/opengrep.sarif \ | ||
| src/ | ||
|
|
||
| - name: Upload Opengrep report | ||
| if: always() | ||
| uses: actions/upload-artifact@v7.0.1 | ||
| with: | ||
| name: opengrep-sarif | ||
| path: reports/opengrep.sarif | ||
| if-no-files-found: error | ||
| retention-days: 14 | ||
|
Comment on lines
+50
to
+57
|
||
|
|
||
| sca: | ||
| name: Trivy SCA | ||
| runs-on: ubuntu-latest | ||
| timeout-minutes: 15 | ||
|
|
||
| steps: | ||
| - name: Checkout repository | ||
| uses: actions/checkout@v7.0.1 | ||
| with: | ||
| persist-credentials: false | ||
|
|
||
| - name: Install Trivy | ||
| uses: aquasecurity/setup-trivy@v0.3.1 | ||
| with: | ||
| version: ${{ env.TRIVY_VERSION }} | ||
| cache: true | ||
|
|
||
| - name: Scan locked dependencies | ||
| run: | | ||
| mkdir -p reports | ||
|
|
||
| trivy fs \ | ||
| --scanners vuln \ | ||
| --include-dev-deps \ | ||
| --format sarif \ | ||
| --output reports/trivy.sarif \ | ||
| uv.lock | ||
|
|
||
| trivy fs \ | ||
| --scanners vuln \ | ||
| --include-dev-deps \ | ||
| --skip-db-update \ | ||
| --format cyclonedx \ | ||
| --output reports/sbom.cdx.json \ | ||
| uv.lock | ||
|
|
||
| trivy fs \ | ||
| --scanners vuln \ | ||
| --include-dev-deps \ | ||
| --skip-db-update \ | ||
| --severity HIGH,CRITICAL \ | ||
| --exit-code 1 \ | ||
| uv.lock | ||
|
|
||
| - name: Upload Trivy reports | ||
| if: always() | ||
| uses: actions/upload-artifact@v7.0.1 | ||
| with: | ||
| name: trivy-reports | ||
| path: | | ||
| reports/trivy.sarif | ||
| reports/sbom.cdx.json | ||
| if-no-files-found: error | ||
| retention-days: 14 | ||
|
Comment on lines
+103
to
+112
|
||
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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Kind of a random time to scan, but I guess it doesn't really matter.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh it's Monday 2 minutes after Opengrep work
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah supply chain exist, but pinning commit SHA will be hard for devs?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wouldn't this run at at 9:17 AM UTC, not 9:00 AM America/Vancouver? Isn't this the cron job for Opengrep? I wasn't sure, because dependabot runs at 9:15AM America/Vancouver, but this runs UTC.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I guess.