This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
This is a composite GitHub Action (not a standalone application) that provides the Mission Critical Vulnerability Scanner (MCVS) for Python projects. The action performs security scanning, linting, testing, and optional binary building for Python codebases.
The action is defined in action.yml and executes as a series of composite steps:
- YAML Linting: Validates YAML files using yamllint
- Python Environment Setup: Installs Python version from
.python-version - Security Scanning: Uses Anchore scan-action to detect vulnerabilities
- Dependency Installation: Installs packages from
requirements.txtif present - Testing: Runs pytest if tests are detected
- Code Linting: Uses Flake8 with a configurable error threshold
- Binary Building: Conditionally builds PyInstaller binaries on tag releases
- Composite vs Docker: Uses
using: compositeto avoid Docker overhead and enable caching - Conditional Execution: Steps like testing and binary building only run when applicable
- Token Authentication: Requires GitHub token for package registry and Docker registry access
- Version Pinning: All tools are pinned to specific versions for reproducibility
CRITICAL: The following versions are pinned in action.yml:
yamllint==1.37.1(action.yml:21)actions/setup-python@v5.6.0(action.yml:28)anchore/scan-action@v6.2.0(action.yml:34)flake8==7.2.0(action.yml:75)pyinstaller==v6.13.0(action.yml:102)svenstaro/upload-release-action@2.9.0(action.yml:106)
When updating dependencies:
- Update the version in
action.yml - Dependabot automatically creates PRs for GitHub Actions updates (see
.github/dependabot.yml) - Python package versions must be updated manually
This action is tested via PR validation:
# Validation happens automatically on PRs via .github/workflows/mcvs-pr-validation.yml
# Uses schubergphilis/mcvs-pr-validation-action@v0.2.0To test locally before committing:
# Test YAML linting (matches action behavior)
pip install yamllint==1.37.1
yamllint .
# Validate action.yml structure
# No local validation tool - rely on PR validation workflowDependabot is configured for GitHub Actions only (.github/dependabot.yml):
- Runs weekly checks
- 5-day cooldown between updates
- Groups all GitHub Actions updates together
Note: Python package dependencies (yamllint, flake8, pyinstaller) are NOT managed by Dependabot and must be updated manually in action.yml.
The action has a configurable error threshold for Flake8:
# Current threshold: 4 errors/warnings maximum
--max-line-length=150
--exclude=client/,.venv/,venv/Pipeline fails if error count > 4 (action.yml:81-83). This threshold may need adjustment when adding strict linting rules.
Binary building is conditional and requires:
- Push event to a tag (
refs/tags/*) - Non-empty
pyinstaller-binary-nameinput
The binary is automatically attached to GitHub releases (action.yml:89-111).
Required inputs when using this action:
| Input | Required | Purpose |
|---|---|---|
token |
Yes | GitHub token for package registry and Docker login |
pyinstaller-binary-name |
No | If set, builds and releases a binary |
- Projects using this action must have a
.python-versionfile to specify Python version requirements.txtis optional - only installed if present- Tests only run if
import pytestis found in Python files - Security scanning uses severity cutoff of "high" (action.yml:39)
- Docker login required for security scanning (action.yml:40-44)