Skip to content
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

Snyk SBOM #8249

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions .github/actions/snyk-sbom/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: snyk-sbom
description: Snyk - Software Bill of Materials (SBOM)
inputs:
sbom_name:
description: 'SBOM file name'
required: true
snyk_token:
description: 'SNYK API token'
required: true
tag:
description: 'Git tag'
required: true

runs:
using: composite
steps:
- name: sbom/install-snyk
run: npm install -g snyk@1.1293.0

- name: sbom/generate
run: snyk sbom --format=cyclonedx1.5+json --all-projects > ${{ inputs.sbom_name }}
env:
SNYK_TOKEN: ${{ inputs.snyk_token }}

- name: sbom/upload
env:
GH_TOKEN: ${{ github.token }}
run: gh release upload "${{ inputs.tag }}" ${{ inputs.sbom_name }}
16 changes: 16 additions & 0 deletions .github/workflows/github-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,14 @@ jobs:
path: Mattermost-unsigned.ipa
name: Mattermost-unsigned.ipa

-name: ci/sbom-ios
uses: ./.github/actions/snyk-sbom
working-directory: ./ios
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(echoing my comment in the ticket)

Will this be able to pick up JS dependencies from the root (package*.json)? Same question with android.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It should.. npm will check in the parent folder if needed

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After checking with the generated SBOMs from @enzowritescode, the build-specific SBOMs did not contain npm packages. Here is the summary:

## sbom_ios.json
- purl (total) -- 178
- pkg:cocoapods -- 170
- pkg:swift -- 8

## sbom_android.json
- purl (total) -- 5953
- pkg:maven -- 5953

As compared to SBOM for the whole project:

## sbom.json
- purl (total) -- 7546
- pkg:gem -- 138
- pkg:npm -- 1120
- pkg:maven -- 6110
- pkg:cocoapods -- 170
- pkg:swift -- 8

with:
sbom_name: 'sbom_ios.json'
snyk_token: "${{ secrets.SNYK_TOKEN }}"
tag: "${{ github.ref_name }}"

build-android-unsigned:
runs-on: ubuntu-22.04
needs:
Expand All @@ -73,6 +81,14 @@ jobs:
path: Mattermost-unsigned.apk
name: Mattermost-unsigned.apk

-name: ci/sbom-android
uses: ./.github/actions/snyk-sbom
working-directory: ./android
with:
sbom_name: 'sbom_android.json'
snyk_token: "${{ secrets.SNYK_TOKEN }}"
tag: "${{ github.ref_name }}"

release:
runs-on: ubuntu-22.04
needs:
Expand Down