Skip to content

fix(github_actions): accept cache-mode key and report schema-invalid workflows - #7787

Open
Varshith-Kali wants to merge 1 commit into
bridgecrewio:mainfrom
Varshith-Kali:fix/gha-cache-mode-schema-7786
Open

Varshith-Kali wants to merge 1 commit into
bridgecrewio:mainfrom
Varshith-Kali:fix/gha-cache-mode-schema-7786

Conversation

@Varshith-Kali

Copy link
Copy Markdown

Fixes #7786.

GitHub Actions added a cache-mode key at workflow and job level (read, write, write-only, none), the recommended control against cache poisoning. Checkov's GitHub Actions schema did not know the key, so a workflow declaring it at the top level failed is_schema_valid and was skipped silently: no checks ran, no error, no warning, and the scan still exited 0. Adopting the key quietly turned off every CKV_GHA_* / CKV2_GHA_* check for that file.

This PR:

  • Adds cache-mode to the workflow schema and to both job kinds (normalJob and reusableWorkflowCallJob, which caps a reusable workflow's cache access), via a shared definition with the four documented values. An invalid value is rejected by the schema.
  • Reports workflow files that fail to load as parsing errors in the report, so a schema failure (or a YAML syntax error) can no longer silently disable the scan for that file. The error is visible in the summary line even under --compact --quiet, and in JSON output as parsing_errors.

Reproduction (checkov 3.4.3, the workflow from the issue):

  • Before: without the key, 11 passed / 1 failed (CKV_GHA_7); with top-level cache-mode: read, no output at all, exit 0.
  • After: with top-level cache-mode: read, 11 passed / 1 failed, exit 1. Same for job-level and both levels. With cache-mode: bogus, the run reports 1 parsing error naming the file.

Tests: 9 new schema-validation tests (all four values accepted at workflow and job level, invalid values rejected) and 2 new runner tests (cache-mode workflow scanned; bogus value reported as a parsing error). pytest tests/github_actions/: 54 passed. flake8 clean on the changed files.

…workflows (bridgecrewio#7786)

GitHub Actions added a cache-mode key at workflow and job level
(read, write, write-only, none). The workflow schema did not know it,
so a workflow declaring it failed is_schema_valid and was skipped
silently: no checks ran, no error, no warning, exit code 0.

Accept cache-mode at workflow level and on both job kinds via a shared
schema definition, and report workflow files that fail to load as
parsing errors in the report, so a future unknown key cannot quietly
disable the scan for that file.

Signed-off-by: Varshith Puli <pulivarshit@gmail.com>
@Varshith-Kali

Copy link
Copy Markdown
Author

Hi maintainers, the start-security-scan check on this PR is waiting on approval. Could someone approve the scan when you get a chance? Thanks!

This branch is waiting to be deployed

1 waiting deployment
scan-security — 90523810 Waiting Nov 5, 2026 by Varshith-Kali via start-security-scan #6778
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.

GitHub Actions: workflows using the new cache-mode key are silently skipped (schema validation)

1 participant