tf-eu-guard 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- tf_eu_guard-0.1.0/.claude/settings.local.json +11 -0
- tf_eu_guard-0.1.0/.claude/skills/tf-eu-guard/SKILL.md +71 -0
- tf_eu_guard-0.1.0/.github/workflows/ci.yml +128 -0
- tf_eu_guard-0.1.0/.gitignore +54 -0
- tf_eu_guard-0.1.0/.pre-commit-hooks.yaml +7 -0
- tf_eu_guard-0.1.0/CONTRIBUTING.md +89 -0
- tf_eu_guard-0.1.0/Dockerfile +6 -0
- tf_eu_guard-0.1.0/LICENSE +21 -0
- tf_eu_guard-0.1.0/PKG-INFO +311 -0
- tf_eu_guard-0.1.0/README.md +283 -0
- tf_eu_guard-0.1.0/TASKS.md +382 -0
- tf_eu_guard-0.1.0/action.yml +35 -0
- tf_eu_guard-0.1.0/docs/DECISIONS.md +50 -0
- tf_eu_guard-0.1.0/docs/DEMO.md +232 -0
- tf_eu_guard-0.1.0/docs/check-mapping-table.md +189 -0
- tf_eu_guard-0.1.0/docs/checkov-schema.md +114 -0
- tf_eu_guard-0.1.0/docs/demo/tf-eu-guard-demo.cast +236 -0
- tf_eu_guard-0.1.0/docs/gdpr-mapping.md +171 -0
- tf_eu_guard-0.1.0/docs/nis2-mapping.md +211 -0
- tf_eu_guard-0.1.0/docs/roadmap.md +20 -0
- tf_eu_guard-0.1.0/docs/screenshots/auditor-report.html +260 -0
- tf_eu_guard-0.1.0/docs/screenshots/auditor-report.png +0 -0
- tf_eu_guard-0.1.0/docs/screenshots/compliant-scan.png +0 -0
- tf_eu_guard-0.1.0/docs/screenshots/scan-report.html +1140 -0
- tf_eu_guard-0.1.0/docs/screenshots/security-dashboard.png +0 -0
- tf_eu_guard-0.1.0/docs/screenshots/vulnerable-scan.png +0 -0
- tf_eu_guard-0.1.0/examples/compliant-aws/iam.tf +57 -0
- tf_eu_guard-0.1.0/examples/compliant-aws/main.tf +13 -0
- tf_eu_guard-0.1.0/examples/compliant-aws/network.tf +240 -0
- tf_eu_guard-0.1.0/examples/compliant-aws/outputs.tf +24 -0
- tf_eu_guard-0.1.0/examples/compliant-aws/rds.tf +71 -0
- tf_eu_guard-0.1.0/examples/compliant-aws/s3.tf +348 -0
- tf_eu_guard-0.1.0/examples/compliant-aws/variables.tf +16 -0
- tf_eu_guard-0.1.0/examples/end2end/EXPECTED_FINDINGS.md +172 -0
- tf_eu_guard-0.1.0/examples/end2end/README.md +66 -0
- tf_eu_guard-0.1.0/examples/end2end/consts.tf +49 -0
- tf_eu_guard-0.1.0/examples/end2end/db-app.tf +423 -0
- tf_eu_guard-0.1.0/examples/end2end/ec2.tf +308 -0
- tf_eu_guard-0.1.0/examples/end2end/ecr.tf +35 -0
- tf_eu_guard-0.1.0/examples/end2end/eks.tf +149 -0
- tf_eu_guard-0.1.0/examples/end2end/elb.tf +40 -0
- tf_eu_guard-0.1.0/examples/end2end/es.tf +44 -0
- tf_eu_guard-0.1.0/examples/end2end/iam.tf +54 -0
- tf_eu_guard-0.1.0/examples/end2end/kms.tf +21 -0
- tf_eu_guard-0.1.0/examples/end2end/lambda.tf +59 -0
- tf_eu_guard-0.1.0/examples/end2end/neptune.tf +44 -0
- tf_eu_guard-0.1.0/examples/end2end/providers.tf +18 -0
- tf_eu_guard-0.1.0/examples/end2end/rds.tf +144 -0
- tf_eu_guard-0.1.0/examples/end2end/s3.tf +141 -0
- tf_eu_guard-0.1.0/examples/vulnerable-aws/iam.tf +67 -0
- tf_eu_guard-0.1.0/examples/vulnerable-aws/main.tf +13 -0
- tf_eu_guard-0.1.0/examples/vulnerable-aws/network.tf +128 -0
- tf_eu_guard-0.1.0/examples/vulnerable-aws/outputs.tf +19 -0
- tf_eu_guard-0.1.0/examples/vulnerable-aws/rds.tf +39 -0
- tf_eu_guard-0.1.0/examples/vulnerable-aws/s3.tf +30 -0
- tf_eu_guard-0.1.0/examples/vulnerable-aws/variables.tf +18 -0
- tf_eu_guard-0.1.0/examples/vulnerable-azure/main.tf +62 -0
- tf_eu_guard-0.1.0/examples/vulnerable-gcp/main.tf +102 -0
- tf_eu_guard-0.1.0/install_and_test.sh +46 -0
- tf_eu_guard-0.1.0/pyproject.toml +61 -0
- tf_eu_guard-0.1.0/tests/README.md +86 -0
- tf_eu_guard-0.1.0/tests/cleanup_legacy_files.sh +52 -0
- tf_eu_guard-0.1.0/tests/conftest.py +67 -0
- tf_eu_guard-0.1.0/tests/fixtures/checkov-raw-output.json +4771 -0
- tf_eu_guard-0.1.0/tests/fixtures/checkov-vulnerable-tf.json +4387 -0
- tf_eu_guard-0.1.0/tests/results/.gitignore +4 -0
- tf_eu_guard-0.1.0/tests/run_all_tests.sh +376 -0
- tf_eu_guard-0.1.0/tests/test_checkov_runner.py +153 -0
- tf_eu_guard-0.1.0/tests/test_cli.py +143 -0
- tf_eu_guard-0.1.0/tests/test_custom_checks.py +121 -0
- tf_eu_guard-0.1.0/tests/test_mapping.py +55 -0
- tf_eu_guard-0.1.0/tests/test_registry.py +207 -0
- tf_eu_guard-0.1.0/tests/test_reporting_terminal.py +130 -0
- tf_eu_guard-0.1.0/tests/test_reports.py +225 -0
- tf_eu_guard-0.1.0/tf_eu_guard/__init__.py +3 -0
- tf_eu_guard-0.1.0/tf_eu_guard/checkov_runner.py +144 -0
- tf_eu_guard-0.1.0/tf_eu_guard/checks/__init__.py +1 -0
- tf_eu_guard-0.1.0/tf_eu_guard/checks/gdpr/__init__.py +1 -0
- tf_eu_guard-0.1.0/tf_eu_guard/checks/gdpr/data_residency.py +73 -0
- tf_eu_guard-0.1.0/tf_eu_guard/checks/nis2/__init__.py +1 -0
- tf_eu_guard-0.1.0/tf_eu_guard/checks/nis2/secrets_in_code.py +80 -0
- tf_eu_guard-0.1.0/tf_eu_guard/cli.py +239 -0
- tf_eu_guard-0.1.0/tf_eu_guard/mapping/__init__.py +1 -0
- tf_eu_guard-0.1.0/tf_eu_guard/mapping/loader.py +168 -0
- tf_eu_guard-0.1.0/tf_eu_guard/mapping/registry-aws.yaml +2511 -0
- tf_eu_guard-0.1.0/tf_eu_guard/mapping/registry-azure.yaml +407 -0
- tf_eu_guard-0.1.0/tf_eu_guard/mapping/registry-gcp.yaml +412 -0
- tf_eu_guard-0.1.0/tf_eu_guard/models.py +94 -0
- tf_eu_guard-0.1.0/tf_eu_guard/reporting/__init__.py +1 -0
- tf_eu_guard-0.1.0/tf_eu_guard/reporting/_html_common.py +114 -0
- tf_eu_guard-0.1.0/tf_eu_guard/reporting/auditor_report.py +292 -0
- tf_eu_guard-0.1.0/tf_eu_guard/reporting/base.py +24 -0
- tf_eu_guard-0.1.0/tf_eu_guard/reporting/dev_html_report.py +208 -0
- tf_eu_guard-0.1.0/tf_eu_guard/reporting/dev_report.py +163 -0
- tf_eu_guard-0.1.0/tf_eu_guard/reporting/security_report.py +233 -0
- tf_eu_guard-0.1.0/tools/README.md +19 -0
- tf_eu_guard-0.1.0/tools/ansi_to_image.py +47 -0
- tf_eu_guard-0.1.0/tools/make_cast.py +61 -0
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: tf-eu-guard
|
|
3
|
+
description: Scan Terraform/IaC for EU compliance gaps (NIS2 + GDPR) using the tf-eu-guard CLI, which wraps Checkov and maps each finding to specific NIS2 Art. 21(2) and GDPR Art. 32 articles. Use when the user asks to check Terraform for NIS2, GDPR, or EU compliance, map a Checkov scan to EU regulations, or produce a compliance report for infrastructure-as-code.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# tf-eu-guard — EU compliance scan for Terraform
|
|
7
|
+
|
|
8
|
+
`tf-eu-guard` runs Checkov against Terraform, keeps only the findings that map to an EU
|
|
9
|
+
compliance article, and enriches each with its **NIS2 Art. 21(2)** / **GDPR Art. 32** (and
|
|
10
|
+
44–49) reference, a plain-language risk, remediation, and a severity.
|
|
11
|
+
|
|
12
|
+
## When to use
|
|
13
|
+
- The user asks to check Terraform / IaC for **NIS2**, **GDPR**, or "EU compliance".
|
|
14
|
+
- The user has a Checkov JSON result and wants it mapped to EU regulatory requirements.
|
|
15
|
+
- The user wants a compliance report (terminal, HTML, or JSON) for a Terraform stack.
|
|
16
|
+
|
|
17
|
+
## Prerequisites
|
|
18
|
+
Run from the repo root. Install once (this also installs Checkov 3.3.13; requires Python ≥ 3.10):
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
pip install -e .
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
Verify with `tf-eu-guard version` (should print a version string).
|
|
25
|
+
|
|
26
|
+
## How to run
|
|
27
|
+
|
|
28
|
+
**Mode 1 — scan a Terraform directory** (tf-eu-guard runs Checkov itself):
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
tf-eu-guard scan <terraform-dir> --output json --framework all
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
**Mode 2 — reuse a Checkov JSON the user already has** (no re-scan):
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
# from a file
|
|
38
|
+
tf-eu-guard scan --checkov-json <file.json> --output json
|
|
39
|
+
|
|
40
|
+
# or piped from a fresh Checkov run (use '-' for stdin)
|
|
41
|
+
checkov -d <terraform-dir> --output json --framework terraform --quiet \
|
|
42
|
+
| tf-eu-guard scan --checkov-json - --output json
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
Flags:
|
|
46
|
+
- `--output` — `dev` (Rich terminal), `json` (machine-readable), `security` (HTML dashboard
|
|
47
|
+
with severity breakdown), `auditor` (HTML article-by-article compliance matrix), or `all`
|
|
48
|
+
(writes the dev, security, and auditor HTML reports together). For a compliance review,
|
|
49
|
+
recommend `--output auditor`; for full coverage, `--output all`.
|
|
50
|
+
- `--framework` — `nis2`, `gdpr`, or `all` (default). Filters to findings citing that framework.
|
|
51
|
+
- `--fail-on-severity {CRITICAL,HIGH,MEDIUM,LOW}` / `--fail-on-any` — exit code 1 when
|
|
52
|
+
findings meet the threshold (CI/CD gating).
|
|
53
|
+
|
|
54
|
+
Prefer `--output json` when you (Claude) will parse and summarize the result. HTML reports are
|
|
55
|
+
written to `reports/` (or `--output-dir`); mention the file paths to the user so they can open them.
|
|
56
|
+
|
|
57
|
+
## Interpreting the output
|
|
58
|
+
Each finding has `check_id`, `severity` (CRITICAL/HIGH/MEDIUM), `resource`, `file_path`, and one
|
|
59
|
+
or more `articles` (`{framework, article}`). Checkov findings with **no** EU mapping are dropped
|
|
60
|
+
by design, so an empty result means "no *mapped* compliance gaps", not "no Checkov findings".
|
|
61
|
+
|
|
62
|
+
When reporting back to the user:
|
|
63
|
+
1. Give counts by severity and by framework (NIS2 vs GDPR).
|
|
64
|
+
2. List the top findings (resource + file + the article each violates).
|
|
65
|
+
3. For remediation detail, point to `docs/nis2-mapping.md` and `docs/gdpr-mapping.md`.
|
|
66
|
+
|
|
67
|
+
## Notes
|
|
68
|
+
- The compliance mappings live in `tf_eu_guard/mapping/registry.yaml`.
|
|
69
|
+
- `examples/vulnerable-aws/` (and the broader `examples/end2end/` suite) are intentionally-insecure stacks you can use to demo the tool.
|
|
70
|
+
- If Bash permission prompts are noisy, the user can allow `Bash(tf-eu-guard scan:*)` and
|
|
71
|
+
`Bash(checkov:*)` in `.claude/settings.local.json`.
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [main]
|
|
6
|
+
pull_request:
|
|
7
|
+
branches: [main]
|
|
8
|
+
|
|
9
|
+
jobs:
|
|
10
|
+
lint:
|
|
11
|
+
runs-on: ubuntu-latest
|
|
12
|
+
|
|
13
|
+
steps:
|
|
14
|
+
- uses: actions/checkout@v4
|
|
15
|
+
|
|
16
|
+
- name: Set up Python
|
|
17
|
+
uses: actions/setup-python@v5
|
|
18
|
+
with:
|
|
19
|
+
python-version: "3.12"
|
|
20
|
+
|
|
21
|
+
- name: Install dependencies
|
|
22
|
+
run: |
|
|
23
|
+
pip install -e ".[dev]"
|
|
24
|
+
|
|
25
|
+
- name: Lint with ruff
|
|
26
|
+
run: |
|
|
27
|
+
ruff check tf_eu_guard/
|
|
28
|
+
|
|
29
|
+
test:
|
|
30
|
+
runs-on: ubuntu-latest
|
|
31
|
+
needs: lint
|
|
32
|
+
strategy:
|
|
33
|
+
fail-fast: false
|
|
34
|
+
matrix:
|
|
35
|
+
python-version: ["3.10", "3.11", "3.12", "3.13"]
|
|
36
|
+
|
|
37
|
+
steps:
|
|
38
|
+
- uses: actions/checkout@v4
|
|
39
|
+
|
|
40
|
+
- name: Set up Python ${{ matrix.python-version }}
|
|
41
|
+
uses: actions/setup-python@v5
|
|
42
|
+
with:
|
|
43
|
+
python-version: ${{ matrix.python-version }}
|
|
44
|
+
|
|
45
|
+
- name: Install dependencies
|
|
46
|
+
run: |
|
|
47
|
+
pip install -e ".[dev]"
|
|
48
|
+
|
|
49
|
+
- name: Run tests
|
|
50
|
+
run: |
|
|
51
|
+
pytest
|
|
52
|
+
|
|
53
|
+
- name: Validate registry schema
|
|
54
|
+
run: |
|
|
55
|
+
python -c "from tf_eu_guard.mapping.loader import validate_all; print(validate_all())"
|
|
56
|
+
|
|
57
|
+
example-scan:
|
|
58
|
+
runs-on: ubuntu-latest
|
|
59
|
+
needs: test
|
|
60
|
+
|
|
61
|
+
steps:
|
|
62
|
+
- uses: actions/checkout@v4
|
|
63
|
+
|
|
64
|
+
- name: Set up Python
|
|
65
|
+
uses: actions/setup-python@v5
|
|
66
|
+
with:
|
|
67
|
+
python-version: "3.12"
|
|
68
|
+
|
|
69
|
+
- name: Install tf-eu-guard
|
|
70
|
+
run: |
|
|
71
|
+
pip install -e .
|
|
72
|
+
|
|
73
|
+
- name: Scan vulnerable examples
|
|
74
|
+
run: |
|
|
75
|
+
tf-eu-guard scan examples/vulnerable-aws/ --output all
|
|
76
|
+
|
|
77
|
+
- name: Scan Azure/GCP examples
|
|
78
|
+
run: |
|
|
79
|
+
set -euo pipefail
|
|
80
|
+
for d in vulnerable-azure vulnerable-gcp; do
|
|
81
|
+
tf-eu-guard scan "examples/$d/" --output json > "scan-$d.json"
|
|
82
|
+
count=$(jq 'length' "scan-$d.json")
|
|
83
|
+
if [ "$count" -lt 1 ]; then
|
|
84
|
+
echo "::error::$d produced $count mapped findings (expected several)"
|
|
85
|
+
exit 1
|
|
86
|
+
fi
|
|
87
|
+
echo "OK: $d -> $count mapped findings"
|
|
88
|
+
done
|
|
89
|
+
|
|
90
|
+
- name: Scan end2end test suite
|
|
91
|
+
run: |
|
|
92
|
+
tf-eu-guard scan examples/end2end/ --output dev
|
|
93
|
+
|
|
94
|
+
- name: Assert custom EU-compliance checks fire
|
|
95
|
+
run: |
|
|
96
|
+
set -euo pipefail
|
|
97
|
+
tf-eu-guard scan examples/end2end/ --output json > scan.json
|
|
98
|
+
for id in EUGUARD_GDPR_001 EUGUARD_NIS2_001; do
|
|
99
|
+
if grep -q "\"$id\"" scan.json; then
|
|
100
|
+
echo "OK: $id fired and was enriched"
|
|
101
|
+
else
|
|
102
|
+
echo "::error::Custom check $id did not fire against examples/end2end/ (external-check loading may be broken)"
|
|
103
|
+
exit 1
|
|
104
|
+
fi
|
|
105
|
+
done
|
|
106
|
+
|
|
107
|
+
- name: Scan compliant examples (should be clean)
|
|
108
|
+
run: |
|
|
109
|
+
set -euo pipefail
|
|
110
|
+
tf-eu-guard scan examples/compliant-aws/ --output json > compliant-scan.json
|
|
111
|
+
# --output json emits a top-level array of enriched findings
|
|
112
|
+
finding_count=$(jq 'length' compliant-scan.json)
|
|
113
|
+
if [ "$finding_count" -le 2 ]; then
|
|
114
|
+
echo "OK: Compliant example has $finding_count mapped findings (acceptable threshold)"
|
|
115
|
+
else
|
|
116
|
+
echo "::warning::Compliant example has $finding_count mapped findings (expected 0-2)"
|
|
117
|
+
fi
|
|
118
|
+
|
|
119
|
+
- name: Upload HTML reports
|
|
120
|
+
if: always()
|
|
121
|
+
uses: actions/upload-artifact@v4
|
|
122
|
+
with:
|
|
123
|
+
name: compliance-reports
|
|
124
|
+
path: |
|
|
125
|
+
dev-report.html
|
|
126
|
+
scan-report.html
|
|
127
|
+
auditor-report.html
|
|
128
|
+
retention-days: 30
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
# Python bytecode
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[cod]
|
|
4
|
+
*$py.class
|
|
5
|
+
*.so
|
|
6
|
+
|
|
7
|
+
# Distribution / packaging
|
|
8
|
+
.Python
|
|
9
|
+
build/
|
|
10
|
+
develop-eggs/
|
|
11
|
+
dist/
|
|
12
|
+
downloads/
|
|
13
|
+
eggs/
|
|
14
|
+
.eggs/
|
|
15
|
+
lib/
|
|
16
|
+
lib64/
|
|
17
|
+
parts/
|
|
18
|
+
sdist/
|
|
19
|
+
var/
|
|
20
|
+
wheels/
|
|
21
|
+
*.egg-info/
|
|
22
|
+
.installed.cfg
|
|
23
|
+
*.egg
|
|
24
|
+
|
|
25
|
+
# Testing
|
|
26
|
+
.pytest_cache/
|
|
27
|
+
.coverage
|
|
28
|
+
htmlcov/
|
|
29
|
+
.tox/
|
|
30
|
+
|
|
31
|
+
# Virtual environments
|
|
32
|
+
venv/
|
|
33
|
+
env/
|
|
34
|
+
ENV/
|
|
35
|
+
|
|
36
|
+
# IDE
|
|
37
|
+
.vscode/
|
|
38
|
+
.idea/
|
|
39
|
+
*.swp
|
|
40
|
+
*.swo
|
|
41
|
+
|
|
42
|
+
# Project-specific
|
|
43
|
+
checkov-repo/
|
|
44
|
+
*.log
|
|
45
|
+
|
|
46
|
+
# Generated HTML reports (tf-eu-guard --output security|auditor|all)
|
|
47
|
+
# Stored in reports/ directory with timestamped format: dev_report_DDMMYYYYHHMM.html
|
|
48
|
+
reports/
|
|
49
|
+
tests/results/*.html
|
|
50
|
+
|
|
51
|
+
# OS
|
|
52
|
+
.DS_Store
|
|
53
|
+
Thumbs.db
|
|
54
|
+
.ruff_cache/
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
# Contributing to tf-eu-guard
|
|
2
|
+
|
|
3
|
+
Thanks for your interest in improving EU infrastructure compliance tooling!
|
|
4
|
+
|
|
5
|
+
## Ways to contribute
|
|
6
|
+
|
|
7
|
+
1. **Registry expansion** — map more Checkov checks to NIS2/GDPR articles (the highest-value contribution)
|
|
8
|
+
2. **New custom checks** — EU-specific patterns upstream Checkov doesn't cover
|
|
9
|
+
3. **Report improvements** — better visualizations, export formats
|
|
10
|
+
4. **Bug fixes & docs**
|
|
11
|
+
|
|
12
|
+
For registry expansion, please **open an issue first** describing the checks you
|
|
13
|
+
want to map — this avoids duplicate work and lets us discuss article choices
|
|
14
|
+
before you invest time in a PR.
|
|
15
|
+
|
|
16
|
+
## Proposing a new mapping
|
|
17
|
+
|
|
18
|
+
The registry is split per provider in `tf_eu_guard/mapping/`:
|
|
19
|
+
|
|
20
|
+
| File | Provider |
|
|
21
|
+
|------|----------|
|
|
22
|
+
| `registry-aws.yaml` | AWS (116 mappings) |
|
|
23
|
+
| `registry-azure.yaml` | Azure (23 mappings) |
|
|
24
|
+
| `registry-gcp.yaml` | GCP (22 mappings) |
|
|
25
|
+
|
|
26
|
+
### Schema
|
|
27
|
+
|
|
28
|
+
Every entry must have these fields (validated in CI by
|
|
29
|
+
`tf_eu_guard.mapping.loader.validate_all`):
|
|
30
|
+
|
|
31
|
+
```yaml
|
|
32
|
+
CKV_AWS_18:
|
|
33
|
+
check_name: "Ensure the S3 bucket has access logging enabled"
|
|
34
|
+
articles: # at least one; framework must be NIS2 or GDPR
|
|
35
|
+
- framework: NIS2
|
|
36
|
+
article: "Art. 21(2)(b)" # format: "Art. N(P)(letter)" or "Art. N"
|
|
37
|
+
title: "Incident handling"
|
|
38
|
+
- framework: GDPR
|
|
39
|
+
article: "Art. 32(1)(b)"
|
|
40
|
+
title: "Confidentiality, integrity and availability"
|
|
41
|
+
risk: "Plain-language explanation citing the specific legal requirement."
|
|
42
|
+
remediation: |
|
|
43
|
+
resource "aws_s3_bucket" "example" {
|
|
44
|
+
# copy-pasteable Terraform
|
|
45
|
+
}
|
|
46
|
+
severity: MEDIUM # CRITICAL | HIGH | MEDIUM | LOW
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
### Quality bar
|
|
50
|
+
|
|
51
|
+
- **Risk explanations must cite specific legal text.** Name the article and the
|
|
52
|
+
requirement it imposes; don't just restate the check. Cross-check sub-point
|
|
53
|
+
letters against the directive/regulation (see `docs/nis2-mapping.md` and
|
|
54
|
+
`docs/gdpr-mapping.md` for verified citations).
|
|
55
|
+
- **Remediation must be copy-paste Terraform code**, not a prose description.
|
|
56
|
+
- **Verify the Checkov ID against a real scan.** Run
|
|
57
|
+
`checkov -d <dir> --framework terraform --quiet -o json` against a stack that
|
|
58
|
+
triggers the check and confirm the ID appears. A mispredicted ID means a
|
|
59
|
+
silent miss — the finding will never be enriched. (The test suite enforces
|
|
60
|
+
that every registry ID exists in the installed Checkov.)
|
|
61
|
+
|
|
62
|
+
### Test requirements
|
|
63
|
+
|
|
64
|
+
Add a fixture that triggers your new check and assert it appears in the output:
|
|
65
|
+
|
|
66
|
+
1. Add or extend a Terraform file under `examples/` that fails the check.
|
|
67
|
+
2. Add an assertion in `tests/` that the check ID is present in the enriched
|
|
68
|
+
output of that example (see `tests/test_registry.py` for patterns).
|
|
69
|
+
|
|
70
|
+
Run the full suite before opening a PR:
|
|
71
|
+
|
|
72
|
+
```bash
|
|
73
|
+
bash install_and_test.sh
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
(creates a venv, installs dev extras, runs pytest with coverage, and smoke-tests
|
|
77
|
+
a scan of `examples/vulnerable-aws/`).
|
|
78
|
+
|
|
79
|
+
## Proposing a custom check
|
|
80
|
+
|
|
81
|
+
Custom `EUGUARD_*` checks live in `tf_eu_guard/checks/`. They must:
|
|
82
|
+
- target an EU-specific requirement stock Checkov doesn't cover,
|
|
83
|
+
- have a registry mapping (severity, articles, risk, remediation), and
|
|
84
|
+
- fire against a fixture in `examples/`.
|
|
85
|
+
|
|
86
|
+
## Labels
|
|
87
|
+
|
|
88
|
+
Look for `good first issue` on the issue tracker for entry-point tasks — mostly
|
|
89
|
+
registry expansion where the legal reasoning is already agreed.
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 44aayush
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|