Skip to content

CI has no check that .pre-commit-config.yaml itself parses as valid YAML #571

Description

@phaedrus1992

Summary

Found by the security-audit analyzer during pre-pr-review of #570 (the cargo-hawk PR, which
also fixed a pre-existing malformed-YAML bug in validate-tag-changelog's entry: block). That
bug silently disabled every pre-push hook for anyone using a strict YAML parser (prek) — the
whole file failed to load before any hook could run. Nothing in CI would have caught it: the file
isn't validated anywhere (git grep 'pre-commit\|prek' -- .github/ finds nothing).

Proposed fix

Add a lightweight CI step (or a prek/pre-commit step in its own right) that just confirms
.pre-commit-config.yaml parses — e.g. python3 -c "import yaml; yaml.safe_load(open('.pre-commit-config.yaml'))"
or, more usefully, prek run --hook-stage pre-push --all-files in a fast/no-op mode if one
exists, so a broken config fails loudly in CI instead of only failing quietly for local prek
users while pre-commit's more lenient PyYAML parser stays oblivious.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions