Skip to content

ci(checkov): silence errors on forks - #968

Open
marcleblanc2 wants to merge 2 commits into
mainfrom
marc/checkov-commit-skip-config
Open

marcleblanc2 wants to merge 2 commits into
mainfrom
marc/checkov-commit-skip-config

Conversation

@marcleblanc2

@marcleblanc2 marcleblanc2 commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

Problem

The Checkov workflow writes .checkov.yaml from ${{ vars.CHECKOV_SKIP_CHECKS }} at runtime. Fork PRs don't receive repository variables, so the file ends up empty and checkov exits 2:

checkov: error: The config file doesn't appear to contain 'key: value' pairs (aka. a YAML mapping). yaml.load('.../.checkov.yaml') returned type 'NoneType' instead of 'dict'.

The SARIF upload step then fails because results.sarif was never written. Example: https://github.com/sourcegraph/deploy-sourcegraph-helm/actions/runs/39357525392/job/118415955536?pr=902

Fix

Commit the skip list as .checkov.yaml (same contents as the repo variable, sorted) and drop the runtime step. Checkov loads .checkov.yaml from the working directory automatically. This matches how deploy-sourcegraph-managed already does it.

The CHECKOV_SKIP_CHECKS repo variable can be deleted once this merges.

Test plan

Review

Reviewed on 2026-11-13 (review thread). No open issues.

  • The committed .checkov.yaml parses as a mapping with 2 skip-path and 26 skip-check entries, the same set as the CHECKOV_SKIP_CHECKS repository variable
  • Reproduced the fork failure locally with an empty config file (checkov 3.4.5 exits 2 and writes no results.sarif), and a local scan with the committed file gives the same result as main: helm 1442 passed, 0 failed
  • Not proven until after merge: the SARIF upload on a pull request from a fork. Every fork run so far failed before reaching the upload. PR fix(executor): render tolerations as json #902 is from a fork and can confirm it with a new push
  • No chart changes, so there was nothing to test on a cluster
  • The title says "silence errors"; nothing is silenced, the cause of the error is removed

Fork PRs do not receive repository variables, so the
'Write skip checks config' step wrote an empty .checkov.yaml and
checkov exited 2 with 'config file ... returned type NoneType'.

Move the skip list into a committed .checkov.yaml, which checkov loads
automatically, and drop the step and the CHECKOV_SKIP_CHECKS variable.

Verified locally with checkov 3.3.29: --show-config loads the file and
the chart scan reports 1442 passed / 0 failed, same as main.

Amp-Thread-ID: https://ampcode.com/threads/T-01a1571c-39af-708a-a421-a575d606dae7
Co-authored-by: Amp <amp@ampcode.com>
@github-actions

Copy link
Copy Markdown

@marcleblanc2 marcleblanc2 changed the title ci(checkov): commit skip config instead of reading a repo variable ci(checkov): silence errors on forks Oct 30, 2026
@marcleblanc2
marcleblanc2 requested a review from a team October 30, 2026 21:24
@marcleblanc2
marcleblanc2 enabled auto-merge (squash) October 30, 2026 21:24

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.

1 participant