Skip to content

Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.

chore(ci): keep Trivy findings inside the pipeline

Vlad Ligai8055756b1381
diff --git a/.github/workflows/release-standalone-docker-img-postgres-offical.yml b/.github/workflows/release-standalone-docker-img-postgres-offical.yml
index 6b017e58c6..bbda1a85ee 100644
--- a/.github/workflows/release-standalone-docker-img-postgres-offical.yml
+++ b/.github/workflows/release-standalone-docker-img-postgres-offical.yml
@@ -8,7 +8,8 @@ on:
env:
# Pinned separately from the action, which carries its own older default.
- TRIVY_VERSION: v0.74.0
+ # Named out of Trivy's own TRIVY_* env namespace, which it would otherwise sit in.
+ TRIVY_CLI_VERSION: v0.74.0
jobs:
infisical-tests:
@@ -23,7 +24,6 @@ jobs:
permissions:
id-token: write # OIDC, to assume the ECR Public publish role
contents: read
- security-events: write # upload the Trivy SARIF report to code scanning
env:
# Surfaced so the ECR mirror steps can be skipped when the role is
# not configured, decoupling them from the Docker Hub release.
@@ -126,8 +126,8 @@ jobs:
image: infisical/infisical:${{ steps.extract_version.outputs.version }}
command: monitor
args: --file=Dockerfile.standalone-infisical --project-name="infisical-core-docker-image"
- # Reports through code scanning, never through the job status: the image
- # is already published by the time this runs.
+ # Reports into the run's artifacts, never through the job status: the
+ # image is already published by the time this runs.
- name: πŸ” Scan infisical/infisical with Trivy
id: trivy_infisical_core
continue-on-error: true
@@ -143,40 +143,55 @@ jobs:
with:
scan-type: image
image-ref: infisical/infisical@${{ steps.build.outputs.digest }}
- version: ${{ env.TRIVY_VERSION }}
+ version: ${{ env.TRIVY_CLI_VERSION }}
scanners: vuln
severity: CRITICAL,HIGH
- limit-severities-for-sarif: true
# Not actionable at release time; the Debian pins in
# Dockerfile.standalone-infisical cover what is.
ignore-unfixed: true
- format: sarif
- output: trivy-infisical-core.sarif
+ format: json
+ output: trivy-infisical-core.json
timeout: 15m
exit-code: "0"
- - name: πŸ“€ Upload Trivy results for infisical/infisical
+ # The only record of this release's fixable findings, so it outlives the
+ # default retention. Unfixed CVEs are filtered out above and are not in it.
+ - name: πŸ“€ Keep the Trivy report for infisical/infisical
id: trivy_upload_infisical_core
if: steps.trivy_infisical_core.outcome == 'success'
continue-on-error: true
- uses: github/codeql-action/upload-sarif@b96794f015dfd88f77b49b1c93e0fa7110f94c63 # v4.38.0
+ uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
- sarif_file: trivy-infisical-core.sarif
- # Code scanning reconciles per (ref, category): a newer analysis closes
- # any alert it omits. Nightlies share this trigger and this ref, so
- # without the suffix tonight's build would close the alerts describing
- # the stable image users are actually running.
- category: trivy-infisical-core${{ contains(github.ref_name, '-nightly-') && '-nightly' || '' }}
- # This workflow only runs on tag pushes, and the alerts UI is scoped to
- # branches: left on refs/tags/* the results would be uploaded where
- # nobody reads them. Assumes release tags are cut from main; one that
- # is not gets rejected, and the guard step below reports it.
- ref: refs/heads/main
- sha: ${{ github.sha }}
+ name: trivy-infisical-core-${{ steps.extract_version.outputs.version }}
+ path: trivy-infisical-core.json
+ retention-days: 90
+ if-no-files-found: error
+ # Nothing here touches job status, so without a summary the run looks the
+ # same whether the image shipped clean or with twenty criticals.
+ - name: πŸ“‹ Summarize Trivy findings for infisical/infisical
+ if: steps.trivy_infisical_core.outcome == 'success'
+ continue-on-error: true
+ env:
+ REPORT: trivy-infisical-core.json
+ run: |
+ set -euo pipefail
+ total=$(jq '[.Results[]?.Vulnerabilities[]?] | length' "$REPORT")
+ crit=$(jq '[.Results[]?.Vulnerabilities[]? | select(.Severity=="CRITICAL")] | length' "$REPORT")
+ cves=$(jq -r '[.Results[]?.Vulnerabilities[]?.VulnerabilityID] | unique | length' "$REPORT")
+ {
+ echo "### Trivy: infisical/infisical"
+ echo
+ echo "| findings | critical | unique CVEs |"
+ echo "| --- | --- | --- |"
+ echo "| $total | $crit | $cves |"
+ } >> "$GITHUB_STEP_SUMMARY"
+ if [ "$total" -gt 0 ]; then
+ echo "::warning::infisical/infisical: $total fixable CRITICAL/HIGH findings across $cves CVEs. See the trivy-infisical-core artifact."
+ fi
# A scan that breaks is otherwise indistinguishable from a clean one, since
- # both leave the job green with no new alerts.
+ # both leave the job green with no report attached.
- name: Flag an incomplete Trivy scan of infisical/infisical
if: steps.trivy_infisical_core.outcome == 'failure' || steps.trivy_upload_infisical_core.outcome == 'failure'
- run: echo "::warning::Trivy did not report on infisical/infisical for this release. No alerts does not mean no findings."
+ run: echo "::warning::Trivy did not report on infisical/infisical for this release. No report does not mean no findings."
infisical-fips-standalone:
name: Build infisical standalone image postgres
@@ -184,7 +199,6 @@ jobs:
needs: [infisical-tests]
permissions:
contents: read
- security-events: write # upload the Trivy SARIF report to code scanning
steps:
- name: Extract version from tag
id: extract_version
@@ -250,8 +264,8 @@ jobs:
image: infisical/infisical-fips:${{ steps.extract_version.outputs.version }}
command: monitor
args: --file=Dockerfile.fips.standalone-infisical --project-name="infisical-fips-docker-image"
- # Reports through code scanning, never through the job status: the image
- # is already published by the time this runs.
+ # Reports into the run's artifacts, never through the job status: the
+ # image is already published by the time this runs.
- name: πŸ” Scan infisical/infisical-fips with Trivy
id: trivy_infisical_fips
continue-on-error: true
@@ -267,40 +281,55 @@ jobs:
with:
scan-type: image
image-ref: infisical/infisical-fips@${{ steps.build_fips.outputs.digest }}
- version: ${{ env.TRIVY_VERSION }}
+ version: ${{ env.TRIVY_CLI_VERSION }}
scanners: vuln
severity: CRITICAL,HIGH
- limit-severities-for-sarif: true
# Not actionable at release time; the Debian pins in
# Dockerfile.fips.standalone-infisical cover what is.
ignore-unfixed: true
- format: sarif
- output: trivy-infisical-fips.sarif
+ format: json
+ output: trivy-infisical-fips.json
timeout: 15m
exit-code: "0"
- - name: πŸ“€ Upload Trivy results for infisical/infisical-fips
+ # The only record of this release's fixable findings, so it outlives the
+ # default retention. Unfixed CVEs are filtered out above and are not in it.
+ - name: πŸ“€ Keep the Trivy report for infisical/infisical-fips
id: trivy_upload_infisical_fips
if: steps.trivy_infisical_fips.outcome == 'success'
continue-on-error: true
- uses: github/codeql-action/upload-sarif@b96794f015dfd88f77b49b1c93e0fa7110f94c63 # v4.38.0
+ uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
- sarif_file: trivy-infisical-fips.sarif
- # Code scanning reconciles per (ref, category): a newer analysis closes
- # any alert it omits. Nightlies share this trigger and this ref, so
- # without the suffix tonight's build would close the alerts describing
- # the stable image users are actually running.
- category: trivy-infisical-fips${{ contains(github.ref_name, '-nightly-') && '-nightly' || '' }}
- # This workflow only runs on tag pushes, and the alerts UI is scoped to
- # branches: left on refs/tags/* the results would be uploaded where
- # nobody reads them. Assumes release tags are cut from main; one that
- # is not gets rejected, and the guard step below reports it.
- ref: refs/heads/main
- sha: ${{ github.sha }}
+ name: trivy-infisical-fips-${{ steps.extract_version.outputs.version }}
+ path: trivy-infisical-fips.json
+ retention-days: 90
+ if-no-files-found: error
+ # Nothing here touches job status, so without a summary the run looks the
+ # same whether the image shipped clean or with twenty criticals.
+ - name: πŸ“‹ Summarize Trivy findings for infisical/infisical-fips
+ if: steps.trivy_infisical_fips.outcome == 'success'
+ continue-on-error: true
+ env:
+ REPORT: trivy-infisical-fips.json
+ run: |
+ set -euo pipefail
+ total=$(jq '[.Results[]?.Vulnerabilities[]?] | length' "$REPORT")
+ crit=$(jq '[.Results[]?.Vulnerabilities[]? | select(.Severity=="CRITICAL")] | length' "$REPORT")
+ cves=$(jq -r '[.Results[]?.Vulnerabilities[]?.VulnerabilityID] | unique | length' "$REPORT")
+ {
+ echo "### Trivy: infisical/infisical-fips"
+ echo
+ echo "| findings | critical | unique CVEs |"
+ echo "| --- | --- | --- |"
+ echo "| $total | $crit | $cves |"
+ } >> "$GITHUB_STEP_SUMMARY"
+ if [ "$total" -gt 0 ]; then
+ echo "::warning::infisical/infisical-fips: $total fixable CRITICAL/HIGH findings across $cves CVEs. See the trivy-infisical-fips artifact."
+ fi
# A scan that breaks is otherwise indistinguishable from a clean one, since
- # both leave the job green with no new alerts.
+ # both leave the job green with no report attached.
- name: Flag an incomplete Trivy scan of infisical/infisical-fips
if: steps.trivy_infisical_fips.outcome == 'failure' || steps.trivy_upload_infisical_fips.outcome == 'failure'
- run: echo "::warning::Trivy did not report on infisical/infisical-fips for this release. No alerts does not mean no findings."
+ run: echo "::warning::Trivy did not report on infisical/infisical-fips for this release. No report does not mean no findings."
trigger-binary-release:
runs-on: ubuntu-latest
needs: [infisical-tests]