Development Setup
Clone and install
git clone https://github.com/ugiordan/helm-guard.git
cd helm-guard
pip install -e .
Run tests
PYTHONPATH=. pytest tests/ -v
Lint
Adding a new check
- Create or edit a check module in
helm_guard/checks/
- Use the
@register_check decorator
- Start the docstring with the check ID and colon (e.g.,
"""HLM-XXX-001: Description.""")
- Return a list of findings using the
_finding() helper
- Add test fixtures in
tests/fixtures/
- Add tests in
tests/
- Update
_EXPECTED_MIN_CHECKS in helm_guard/checks/__init__.py
Check function template
from helm_guard.checks._common import _finding, register_check
from helm_guard.config import ScannerConfig
from helm_guard.parser import ChartInfo
@register_check
def check_my_new_check(chart: ChartInfo, config: ScannerConfig) -> list[dict]:
"""HLM-XXX-001: Description of the check."""
findings = []
# ... detection logic ...
if detected:
findings.append(_finding(
rule_id="HLM-XXX-001",
severity="HIGH",
title="Short title",
chart_dir=chart.chart_dir,
file_path="...",
line=1,
message="What was found and why it matters.",
cwe="CWE-NNN",
remediation="How to fix it",
))
return findings
Project structure
helm_guard/ # Source code
tests/ # Test files
tests/fixtures/ # Chart fixtures for testing
site/ # MkDocs documentation site