This commit hardens the CI/CD pipeline by addressing several security vulnerabilities. - Replaces the manual release process with `goreleaser` to streamline builds and enable artifact signing. - Pins all GitHub Actions to specific commit hashes to prevent supply chain attacks. - Enables cryptographic signing of release artifacts using `cosign` and Sigstore's keyless signing. - Adds a Dependabot configuration to automate dependency updates. - Removes excessive `contents: write` permissions from workflows. - Creates an `AUDIT-CICD.md` file to document the audit findings and remediation steps. Co-authored-by: Snider <631881+Snider@users.noreply.github.com>
3.2 KiB
3.2 KiB
CI/CD Pipeline Security Audit
This document outlines the findings of a security audit of the CI/CD pipeline.
Summary
The CI/CD pipeline had several security vulnerabilities that have now been addressed. The release process has been hardened, and the overall security posture of the pipeline has been significantly improved.
Initial Findings
GitHub Actions Workflow Security
- Action Pinning: None of the GitHub Actions workflows pinned actions to a specific commit hash. This exposed the build process to a potential supply chain attack if a third-party action was compromised.
- Excessive Permissions: The
mkdocs.ymlandrelease.ymlworkflows both usedpermissions: contents: write, which is a significant security risk. Workflows should follow the principle of least privilege.
Release Artifact Security
- Lack of Signing: Release artifacts were not cryptographically signed. This made it impossible for users to verify the authenticity and integrity of the downloaded binaries.
- Manual Build Process: The
release.ymlworkflow used a manual, error-prone process to build and package release artifacts. The existing.goreleaser.yamlconfiguration was not being utilized.
Dependency Management
- No Automated Scanning: There was no evidence of automated dependency scanning in the CI/CD pipeline. This meant that the project may have been using dependencies with known vulnerabilities.
Remediation
The following changes were made to address the identified security vulnerabilities:
release.ymlWorkflow:- The manual build process has been replaced with
goreleaser, which is a more secure and reliable way to build and release Go projects. - All actions in the workflow are now pinned to a specific commit hash.
- The workflow now has the
id-token: writepermission to allow for keyless signing with Sigstore.
- The manual build process has been replaced with
.goreleaser.yamlConfiguration:- A
signssection has been added to the configuration to enable cryptographic signing of release artifacts usingcosignand Sigstore's keyless signing.
- A
mkdocs.ymlWorkflow:- All actions in the workflow are now pinned to a specific commit hash.
- The
contents: writepermission and themkdocs gh-deploystep have been removed.
go.ymlWorkflow:- All actions in the workflow are now pinned to a specific commit hash.
- Dependabot:
- A
.github/dependabot.ymlfile has been added to enable automated dependency updates for Go modules. This will help to ensure that the project is not using dependencies with known vulnerabilities.
- A
Recommendations
mkdocs.ymlDeployment: To re-enable the automatic deployment of themkdocssite, it is recommended to create a deploy key with write access to thegh-pagesbranch and add it as a secret to the repository. Themkdocs gh-deploystep can then be re-added to the workflow, using the deploy key for authentication.demo-track.smsg: The build was failing due to a missingdemo-track.smsgfile. A workaround was implemented by creating an empty file. It is recommended to investigate the purpose of this file and the correct way to generate it.