Skip to content

Conversation

@rolljee
Copy link
Member

@rolljee rolljee commented Dec 16, 2025

Overview

Add an SBOM workflow

Comment on lines 14 to 45
name: Publish SBOM to Dependency-Track
runs-on: ubuntu-24.04
steps:
- name: Checkout project
uses: actions/checkout@v4

- name: Install additional libraries
uses: ./.github/actions/install-packages

- name: Node version ${{ env.NODE_VERSION }}
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}

- run: npm install
- name: Create SBOM with CycloneDX
run: npx @cyclonedx/cyclonedx-npm -o bom.xml --of=XML

- name: Get the current project version from package.json
id: get-version
run: |
echo "version=$(jq -r .version package.json)" >> $GITHUB_OUTPUT

- name: Publish SBOM to Dependency-Track
uses: DependencyTrack/gh-upload-sbom@v3
with:
serverhostname: ${{ secrets.DEPENDENCYTRACK_HOSTNAME }}
apikey: ${{ secrets.DEPENDENCYTRACK_APIKEY }}
projectname: 'Kuzzle SDK JavaScript'
projectversion: '${{ steps.get-version.outputs.version }}'
bomfilename: "./bom.xml"
autocreate: true No newline at end of file

Check warning

Code scanning / CodeQL

Workflow does not contain permissions Medium

Actions job or workflow does not limit the permissions of the GITHUB_TOKEN. Consider setting an explicit permissions block, using the following as a minimal starting point: {contents: read}

Copilot Autofix

AI 7 days ago

To fix this issue, add a permissions block defining the minimal privilege set required for this workflow. According to the types of actions in the workflow (checking out the code, installing packages, running commands, uploading artifacts, and publishing to Dependency-Track), the only operation that might require the GITHUB_TOKEN is the actions/checkout step, which by default requires read access to repository contents. None of the other steps (including publishing to Dependency-Track) use the token. Thus, setting permissions: contents: read at the job level for publish-sbom-to-dtrack is appropriate and aligns with least privilege principles. You need to edit the workflow YAML to add this block under the job definition, directly above runs-on:.

Suggested changeset 1
.github/workflows/dtrack-sbom.workflow.yaml

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/.github/workflows/dtrack-sbom.workflow.yaml b/.github/workflows/dtrack-sbom.workflow.yaml
--- a/.github/workflows/dtrack-sbom.workflow.yaml
+++ b/.github/workflows/dtrack-sbom.workflow.yaml
@@ -12,6 +12,8 @@
 jobs:
   publish-sbom-to-dtrack:
     name: Publish SBOM to Dependency-Track
+    permissions:
+      contents: read
     runs-on: ubuntu-24.04
     steps:
       - name: Checkout project
EOF
@@ -12,6 +12,8 @@
jobs:
publish-sbom-to-dtrack:
name: Publish SBOM to Dependency-Track
permissions:
contents: read
runs-on: ubuntu-24.04
steps:
- name: Checkout project
Copilot is powered by AI and may make mistakes. Always verify output.
Copy link
Member

@alexandrebouthinon alexandrebouthinon left a comment

Choose a reason for hiding this comment

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

You could upgrade the checkout and node installation actions

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +6 to +10
on:
release:
types:
- released
- prereleased

Choose a reason for hiding this comment

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

P1 Badge Release workflow skips normal publish events

The workflow subscribes only to release event types released and prereleased, so a standard release creation (published action) never triggers this job. That means publishing a normal release will not generate or upload an SBOM, defeating the purpose of the workflow unless the release is first flagged as a prerelease and later promoted. Consider including the published type so SBOMs are produced for regular release publishes.

Useful? React with 👍 / 👎.

rolljee and others added 2 commits December 16, 2025 16:47
Co-authored-by: Alexandre Bouthinon <bouthinon.alexandre@gmail.com>
Co-authored-by: Alexandre Bouthinon <bouthinon.alexandre@gmail.com>
@rolljee rolljee merged commit 1935c5b into beta Dec 16, 2025
14 checks passed
@github-actions
Copy link

🎉 This PR is included in version 7.17.0-beta.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

@kuzzle
Copy link
Contributor

kuzzle commented Dec 16, 2025

🎉 This PR is included in version 7.17.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants