-
Notifications
You must be signed in to change notification settings - Fork 71
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
Showing
10 changed files
with
116 additions
and
8 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,50 @@ | ||
name: Local security scan | ||
on: | ||
pull_request: | ||
paths: | ||
- "requiremests*.txt" | ||
- ".github/workflows/local-security-scan.yaml" | ||
- "*.lock" | ||
- "pyproject.toml" | ||
push: | ||
tags: | ||
# These tags should be protected, remember to enable the rule: | ||
# https://github.com/canonical/starbase/settings/tag_protection | ||
- "[0-9]+.[0-9]+.[0-9]+" | ||
|
||
jobs: | ||
security-scans: | ||
runs-on: [self-hosted, noble] | ||
steps: | ||
- name: Install tools | ||
run: | | ||
sudo snap install --no-wait osv-scanner trivy > ${{ runner.temp }}/snap.watch | ||
sudo snap install --no-wait --classic astral-uv >> ${{ runner.temp }}/snap.watch | ||
sudo apt-get update | ||
sudo apt-get --yes install python3-venv python3-build python-apt-dev | ||
xargs --arg-file=${{ runner.temp }}/snap.watch -n 1 snap watch | ||
- uses: actions/checkout@v4 | ||
- name: Prepare venv | ||
run: | | ||
pyproject-build | ||
- name: Scan requirements with osv-scanner | ||
if: ${{ !cancelled() }} | ||
run: | | ||
ls -1 requirements*.txt | xargs -I{} osv-scanner --config=.osv-config.toml --lockfile=requirements.txt:{} | ||
- name: Scan source directory with osv-scanner | ||
if: ${{ !cancelled() }} | ||
run: osv-scanner --config=.osv-config.toml --recursive . | ||
- name: Scan requirements with trivy | ||
if: ${{ !cancelled() }} | ||
run: | | ||
ls -1 requirements*.txt | xargs -n 1 trivy filesystem --ignorefile .trivyignore.yaml | ||
trivy filesystem --ignorefile .trivyignore.yaml pyproject.toml | ||
- name: Scan installed venv with trivy | ||
if: ${{ !cancelled() }} | ||
run: | | ||
uv venv | ||
uv pip install -r requirements-dev.txt -r requirements-noble.txt -e .[dev] | ||
trivy filesystem --ignorefile .trivyignore.yaml .venv | ||
- name: Scan distributable files with trivy | ||
if: ${{ !cancelled() }} | ||
run: ls -1 dist/* | xargs -n 1 trivy filesystem --ignorefile .trivyignore.yaml |
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,50 @@ | ||
# # NOTE: This job is currently commented out, as the self-hosted runners don't have | ||
# # access to the internal security scanning API. | ||
# | ||
# name: Security Scan | ||
# on: | ||
# schedule: | ||
# - cron: "0 0 13 * *" # Midnight UTC on the 13th of the month | ||
# workflow_dispatch: # Allow manual run too. | ||
# push: | ||
# branches: | ||
# - work/secscan # Allow checks to happen on this branch for workflow development | ||
# | ||
# concurrency: # No concurrency for this workflow. We don't need to overload the server. | ||
# group: ${{ github.workflow }} | ||
# cancel-in-progress: true | ||
# | ||
# jobs: | ||
# standalone-secscan: | ||
# runs-on: [self-hosted, X64] # The client is currently only published for amd64 | ||
# strategy: | ||
# max-parallel: 1 # We'll be queueing anyway, so only run one job at a time. | ||
# matrix: | ||
# scanner: | ||
# - blackduck | ||
# - osv | ||
# - trivy | ||
# channel: | ||
# - latest | ||
# - 3.x | ||
# - 2.x | ||
# steps: | ||
# - name: Begin snap install | ||
# id: snap-install | ||
# run: | | ||
# echo -n "secscan_snap=" >> "$GITHUB_OUTPUT" | ||
# sudo snap install --no-wait canonical-secscan-client >> "$GITHUB_OUTPUT" | ||
# - name: Download snaps | ||
# run: | | ||
# for arch in amd64 arm64 s390x ppc64el riscv64; do | ||
# for risk in stable candidate beta edge; do | ||
# UBUNTU_STORE_ARCH=${arch} snap download --channel=${{ matrix.channel }}/${risk} charmcraft | ||
# done | ||
# done | ||
# - name: Wait for snap | ||
# run: | | ||
# snap watch ${{ steps.snap-install.outputs.secscan_snap }} | ||
# sudo snap connect canonical-secscan-client:home system:home | ||
# - name: Scan channel ${{ matrix.channel }} with ${{ matrix.scanner }} | ||
# run: | | ||
# ls -1 *.snap | xargs -I {} secscan-client submit --scanner ${{ matrix.scanner }} --type package --format snap --wait-and-print {} |
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,4 @@ | ||
[[IgnoredVulns]] | ||
id = "CVE-2024-35195" | ||
ignoreUntil = "2025-01-01T00:00:00Z" | ||
reason = "Needed for requests-unixsocket, which we're replacing with requests-unixsocket2" |
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,4 @@ | ||
vulnerabilities: | ||
- id: CVE-2024-35195 | ||
expired_at: "2025-01-01T00:00:00Z" | ||
statement: Needed for requests-unixsocket, which we're replacing with requests-unixsocket2 |
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
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
2 changes: 1 addition & 1 deletion
2
tests/spread/dependencies/strict-dependencies-errors/extra-binary-packages/requirements.txt
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 |
---|---|---|
@@ -1 +1 @@ | ||
ops==2.5.1 | ||
ops==2.15.0 |
2 changes: 1 addition & 1 deletion
2
tests/spread/dependencies/strict-dependencies-errors/extra-packages/requirements.txt
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 |
---|---|---|
@@ -1 +1 @@ | ||
ops==2.5.1 | ||
ops==2.15.0 |
2 changes: 1 addition & 1 deletion
2
tests/spread/dependencies/strict-dependencies/charm/requirements.txt
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 |
---|---|---|
@@ -1,3 +1,3 @@ | ||
ops==2.5.1 | ||
ops==2.15.0 | ||
pyyaml==6.0.1 | ||
websocket-client==1.8.0 |
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