Skip to content

ci: add CodeQL and Grype image scan - #872

Open
ramantehlan wants to merge 4 commits into
mainfrom
sd/image-scan
Open

ramantehlan wants to merge 4 commits into
mainfrom
sd/image-scan

Conversation

@ramantehlan

@ramantehlan ramantehlan commented Sep 24, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Add CodeQL Advanced scanning for Actions, JavaScript/TypeScript, and Python (push/PR to main, weekly schedule).
  • Add daily Grype image scan via truefoundry/workflows update-grype-report.yml.
  • Temporary workflow_dispatch (and image-scan pull_request) so these can be tested on this PR; remove after the first successful run.

Test plan

  • Confirm CodeQL Advanced runs on this PR (actions, javascript-typescript, python).
  • Confirm Scan and Generate Grype Report runs on this PR and/or via workflow_dispatch.
  • After a successful run, drop the temporary triggers before merge (or in a follow-up).

Note

Low Risk
Changes are limited to new CI workflows and permissions for security scanning; no application or runtime behavior is modified.

Overview
Adds automated security scanning in GitHub Actions: a new CodeQL Advanced workflow and a Grype container image scan wired through existing TrueFoundry reusable workflows.

The CodeQL job runs on pushes and PRs to main, on a weekly schedule, and (temporarily) via workflow_dispatch. It analyzes Actions, JavaScript/TypeScript, and Python with build-mode: none, uploads results with security-events: write, and uses ubuntu-latest (or macos-latest for Swift if added later).

The Grype workflow resolves appVersion from charts/trueforge/Chart.yaml, then calls truefoundry/github-workflows-public’s update-grype-report.yml to build from the repo Dockerfile and scan the trueforge image using the org Artifactory URL variable. It runs daily on a schedule plus temporary pull_request and workflow_dispatch triggers so the pipeline can be validated on this PR before those extras are removed.

Reviewed by Cursor Bugbot for commit c42363f. Bugbot is set up for automated code reviews on this repo. Configure here.

Signed-off-by: Raman Tehlan <ramantehlan@gmail.com>
@changeset-bot

changeset-bot Bot commented Sep 24, 2026 •

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: c42363f

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@github-advanced-security

Copy link
Copy Markdown

You are seeing this message because GitHub Code Scanning has recently been set up for this repository, or this pull request contains the workflow file for the Code Scanning tool.

What Enabling Code Scanning Means:

  • The 'Security' tab will display more code scanning analysis results (e.g., for the default branch).
  • Depending on your configuration and choice of analysis tool, future pull requests will be annotated with code scanning analysis results.
  • You will be able to see the analysis results for the pull request's branch on this overview once the scans have completed and the checks have passed.

For more information about GitHub Code Scanning, check out the documentation.

Comment thread .github/workflows/image-scan.yml Fixed

@cursor cursor Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Stale Bugbot comment from a previous run.

Comment thread .github/workflows/image-scan.yml Outdated
with:
enable_ecr_auth: true
image_artifact_name: ${{ github.event.repository.name }}
artifactory_repository_url: ${{ vars.TRUEFOUNDRY_ARTIFACTORY_PRIVATE_REPOSITORY }}

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Image scan uses private registry

Medium Severity

artifactory_repository_url is set to TRUEFOUNDRY_ARTIFACTORY_PRIVATE_REPOSITORY, but every image build in this repo publishes to TRUEFOUNDRY_ARTIFACTORY_PUBLIC_REPOSITORY. The Grype job will resolve or tag trueforge in the wrong registry, so the daily scan misses the images this repo actually ships.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 6a5312e. Configure here.

Comment thread .github/workflows/image-scan.yml Outdated
Signed-off-by: Raman Tehlan <ramantehlan@gmail.com>
Signed-off-by: Raman Tehlan <ramantehlan@gmail.com>
Comment thread .github/workflows/image-scan.yml Fixed

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes using default effort and found 2 potential issues.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 6b07562. Configure here.

Comment thread .github/workflows/image-scan.yml
jobs:
image-scan:
name: Image Vulnerability Scan
uses: truefoundry/github-workflows-public/.github/workflows/update-grype-report.yml@main

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Grype report cannot update repository

High Severity

update-grype-report.yml commits .grype.yaml updates and opens a pull request. This caller no longer grants contents: write or passes workflow_repo_token, so those write steps cannot succeed even if a scan image is built.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 6b07562. Configure here.

Signed-off-by: Raman Tehlan <ramantehlan@gmail.com>
Comment on lines +12 to +23
name: Resolve APP_VERSION
runs-on: ubuntu-latest
outputs:
app_version: ${{ steps.app.outputs.app_version }}
steps:
- uses: actions/checkout@v7
- id: app
run: |
APP_VERSION=$(yq -r '.appVersion' charts/trueforge/Chart.yaml)
echo "app_version=$APP_VERSION" >> "$GITHUB_OUTPUT"

image-scan:
Comment on lines +24 to +32
name: Image Vulnerability Scan
needs: [resolve]
uses: truefoundry/github-workflows-public/.github/workflows/update-grype-report.yml@main
with:
dockerfile_path: 'Dockerfile'
image_artifact_name: 'trueforge'
artifactory_repository_url: ${{ vars.TRUEFOUNDRY_ARTIFACTORY_PUBLIC_REPOSITORY }}
image_build_args: |
APP_VERSION=${{ needs.resolve.outputs.app_version }}

This branch has not been deployed

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants