Skip to content

Add Security Scan workflow as part of the SSDLC requirements #603

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

Open
wants to merge 25 commits into
base: main
Choose a base branch
from

Conversation

srbouffard
Copy link

@srbouffard srbouffard commented Jul 28, 2025

Applicable spec: SSDLC - Vulnerability Identification

Overview

This pull request introduces a dedicated security_scan.yaml GitHub Actions workflow. This workflow is designed to automate vulnerability management for the GitHub Runner charm, fulfilling the current SSDLC requirements.

The new workflow includes the following jobs:

  • A vulnerability and secret scan of the charm's filesystem using Trivy.
  • A Software Bill of Materials (SBOM) generation job.
  • Conditional logic to upload the scan results to the GitHub Security tab (example) and the SBOM as a build artifact. The upload can be triggered automatically on pushes to main or manually via a workflow_dispatch event.

Rationale

The primary motivation for this change is to meet the vulnerability identification requirements outlined in this cycle's SSDLC policy for our GitHub Runner product. This workflow automates the required security scans directly within our CI pipeline.

Why a Dedicated Workflow?

While the existing integration_tests workflow includes a Trivy scan, a dedicated security workflow was because security scanning is a distinct concern from integration testing. Decoupling them allows for more focused, maintainable, and independent jobs that can be triggered separately if needed.

Why Not in operator-workflows (Yet)?

The current SSDLC requirements are specifically targeting the GitHub Runner product. The goal is to first implement and refine this security automation for the runner. Once the process is fully ironed out and proven effective, we can then look at generalizing this workflow and moving it to operator-workflows for all our projects to benefit from, especially as SSDLC requirements expand.

Checklist

  • The charm style guide was applied.
  • The contributing guide was applied.
  • The changes are compliant with ISD054 - Managing Charm Complexity
  • The documentation for charmhub is updated.
  • The PR is tagged with appropriate label (urgent, trivial, complex).
  • The changelog is updated with changes that affects the users of the charm.
  • The application version number is updated in github-runner-manager/pyproject.toml.

Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

license-eye has checked 311 files.

Valid Invalid Ignored Fixed
62 1 248 0
Click to see the invalid file list
  • trivy.yaml
Use this command to fix any missing license headers
```bash

docker run -it --rm -v $(pwd):/github/workspace apache/skywalking-eyes header fix

</details>

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
security-events: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
Copy link
Collaborator

Choose a reason for hiding this comment

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

I would recommend pinning the actions to an exact version and rely on renovate to update them so that workflows are not impeding reusable builds

Copy link
Author

@srbouffard srbouffard Jul 29, 2025

Choose a reason for hiding this comment

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

What should be the recommended approach with regards to the renovate config?
From what I have read the default renovate behavior is to pickup Github workflow files. Is there anything specific I need adjust in our renoate.json?

Copy link
Author

Choose a reason for hiding this comment

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

Ah ok, I see now ;) Updated the versions to exact versions to make sure renovate will pick them up


- name: Upload diagnostic SARIF artifact
if: (github.event_name == 'workflow_dispatch' && inputs.upload_results == true) || (github.event_name != 'workflow_dispatch' && env.UPLOAD_RESULTS == 'true')
uses: actions/upload-artifact@v4
Copy link
Collaborator

Choose a reason for hiding this comment

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

Same here

Copy link
Author

Choose a reason for hiding this comment

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

Done


- name: Upload SARIF to GitHub Security tab
if: (github.event_name == 'workflow_dispatch' && inputs.upload_results == true) || (github.event_name != 'workflow_dispatch' && env.UPLOAD_RESULTS == 'true')
uses: github/codeql-action/upload-sarif@v3
Copy link
Collaborator

Choose a reason for hiding this comment

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

Same here

Copy link
Author

Choose a reason for hiding this comment

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

Done

runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
Copy link
Collaborator

Choose a reason for hiding this comment

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

Same here

Copy link
Author

Choose a reason for hiding this comment

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

Done


env:
# This value is used for push and pull_request triggers
UPLOAD_RESULTS: true
Copy link
Collaborator

Choose a reason for hiding this comment

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

I don't see where this value might change so, why the env variable?

Copy link
Author

Choose a reason for hiding this comment

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

You are right, it serves nothing here. My initial thoughts was as a quick and "global" way to control the default upload behavior on the various jobs/steps. Using workflow_dispatch and workflow_call provides these global inputs and controls but having the workflow trigger on pushes and PRs, did not offer an inputs section.

I can remove it. But I have a followup question, what is the "upload" behavior you would expect when it's a "push to main", push to branch and a PR?

The Github security tab supports listing security events per branch so doing on upload on pushes to branch and PRs does not pollute anything or cause much noise.

@@ -0,0 +1,83 @@
name: Security Scan
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is there any reason for not defining this workflow as part of the operator workflows? It would be simpler to reuse by other repositories

Copy link
Author

Choose a reason for hiding this comment

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

100% with you on that and that is the longterm goal with this workflow.
The idea behind why I didn't go that route strait away was that the current SSDLC requirements are specifically targeting the GitHub Runner product.

  • The goal is to first implement and refine this security automation for the runner. Once the process is fully ironed out and proven effective (meets the requirements of the SSDLC process), we can then look at generalizing this workflow and moving it to operator-workflows for all our projects to benefit from, especially as SSDLC requirements expand.
  • Also, the workflow currently only does a fs scan, but I would want it to be more robust and support scanning a charm, rocks. Similar to what the data-platform team have done on their side.
  • Then there is the whole vulnerability response aspect that I think needs to be ironed out before we propagate the security checks to other project.

Does that make any sense, or you think it would still be more worthwhile to start directly within the operator-workflow?

@@ -0,0 +1,83 @@
name: Security Scan
Copy link
Collaborator

Choose a reason for hiding this comment

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

I don't see a license header in this file, not sure why

Copy link
Author

@srbouffard srbouffard Jul 29, 2025

Choose a reason for hiding this comment

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

Added the license header to the new workflow file. Seems that the whole of github folder is configured to be ignored for the license check

@srbouffard srbouffard requested a review from amandahla August 7, 2025 17:24
Copy link
Contributor

github-actions bot commented Aug 7, 2025

TICS Quality Gate

❌ Failed

The following errors have occurred during analysis:

❌ [ERROR 5333] Project database 'github-runner-operator' already is connected to a started TICSQServer process that has not registered a stop time. To avoid data corruption, analysis is aborted. Details of the other TICSQServer process: started at 2025-07-09 14:32:08.000 by user ubuntu.

.github/workflows/tics.yaml / TICS / TICS GitHub Action

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.

3 participants