-
Notifications
You must be signed in to change notification settings - Fork 37
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
5 changed files
with
140 additions
and
11 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,24 @@ | ||
on: | ||
workflow_dispatch: {} | ||
pull_request: {} | ||
push: | ||
branches: | ||
- main | ||
- master | ||
paths: | ||
- .github/workflows/semgrep.yml | ||
schedule: | ||
# random HH:MM to avoid a load spike on GitHub Actions at 00:00 | ||
- cron: 12 1 * * * | ||
name: Semgrep | ||
jobs: | ||
semgrep: | ||
name: semgrep/ci | ||
runs-on: ubuntu-20.04 | ||
env: | ||
SEMGREP_APP_TOKEN: ${{ secrets.SEMGREP_APP_TOKEN }} | ||
container: | ||
image: returntocorp/semgrep | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- run: semgrep ci |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,104 @@ | ||
name: SBOM generation mod | ||
|
||
on: | ||
workflow_dispatch: | ||
|
||
jobs: | ||
sbom: | ||
name: Generate app SBOM | ||
runs-on: ubuntu-latest | ||
container: quay.io/pluribus_one/sbom_vex_scanner:latest | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
project: ["dvna", "vulnado"] | ||
|
||
steps: | ||
- name: Checkout Repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Generate SBOMs | ||
run: | | ||
cd vuln_apps/${{ matrix.project }} | ||
cdxgen --format json -o "${{ matrix.project }}_bom.json" | ||
- name: Upload results | ||
if: always() | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: sbom-${{matrix.project}} | ||
path: vuln_apps/${{ matrix.project }}/${{ matrix.project }}_bom.json | ||
retention-days: 5 | ||
if-no-files-found: error | ||
|
||
sbom-docker: | ||
name: Generate docker SBOM | ||
runs-on: ubuntu-latest | ||
container: quay.io/pluribus_one/sbom_vex_scanner:latest | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
project: ["dvna", "vulnado"] | ||
|
||
steps: | ||
- name: Checkout Repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
|
||
- name: Build Docker image | ||
id: build-image | ||
uses: docker/build-push-action@v5 | ||
with: | ||
context: "${{ github.workspace }}/vuln_apps/${{ matrix.project }}" | ||
push: false | ||
load: true | ||
tags: ${{ matrix.project }}:latest | ||
|
||
- name: Generate docker SBOMs | ||
run: | | ||
cdxgen --type docker -o "${{ matrix.project }}-docker_bom.json" ${{ matrix.project }}:latest | ||
- name: upload Artifacts | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: sbom-${{matrix.project}}-docker | ||
path: ${{ matrix.project }}-docker_bom.json | ||
retention-days: 5 | ||
if-no-files-found: error | ||
|
||
merge-sbom: | ||
name: Merge previously generated SBOM | ||
runs-on: ubuntu-latest | ||
needs: ["sbom", "sbom-docker"] | ||
container: cyclonedx/cyclonedx-cli:0.25.0 | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
project: ["dvna", "vulnado"] | ||
|
||
steps: | ||
- name: Download artifact sbom | ||
uses: actions/download-artifact@v4 | ||
with: | ||
name: sbom-${{matrix.project}} | ||
path: ./sboms-${{matrix.project}} | ||
|
||
- name: Download artifact sbom-docker | ||
uses: actions/download-artifact@v4 | ||
with: | ||
name: sbom-${{matrix.project}}-docker | ||
path: ./sboms-${{matrix.project}} | ||
|
||
- name: Merge previously generated sboms | ||
run: | | ||
cyclonedx merge --input-files sboms-${{matrix.project}}/${{ matrix.project }}_bom.json sboms-${{matrix.project}}/${{ matrix.project }}-docker_bom.json --output-file ${{ matrix.project }}_merged_sbom.json --hierarchical --name ${{ matrix.project }} --version ${{ github.run_number }} --group devsecops-exercises | ||
- name: upload Artifacts | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: sbom-${{matrix.project}}-merged | ||
path: ${{ matrix.project }}_merged_sbom.json | ||
retention-days: 5 | ||
if-no-files-found: error |
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