proofctl 0.6.0__tar.gz → 0.6.2__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.
- {proofctl-0.6.0/proofctl.egg-info → proofctl-0.6.2}/PKG-INFO +6 -6
- {proofctl-0.6.0 → proofctl-0.6.2}/README.md +5 -5
- proofctl-0.6.2/proofctl/__main__.py +4 -0
- {proofctl-0.6.0 → proofctl-0.6.2}/proofctl/checkers/hcl_utils.py +8 -7
- {proofctl-0.6.0 → proofctl-0.6.2}/proofctl/checkers/quality.py +2 -2
- {proofctl-0.6.0 → proofctl-0.6.2}/proofctl/checkers/security.py +28 -28
- {proofctl-0.6.0 → proofctl-0.6.2}/proofctl/checkers/terraform.py +90 -5
- {proofctl-0.6.0 → proofctl-0.6.2}/proofctl/checkers/yaml_checker.py +118 -6
- {proofctl-0.6.0 → proofctl-0.6.2}/proofctl/cli.py +4 -0
- {proofctl-0.6.0 → proofctl-0.6.2}/proofctl/registry.py +13 -3
- {proofctl-0.6.0 → proofctl-0.6.2/proofctl.egg-info}/PKG-INFO +6 -6
- {proofctl-0.6.0 → proofctl-0.6.2}/proofctl.egg-info/SOURCES.txt +1 -0
- {proofctl-0.6.0 → proofctl-0.6.2}/pyproject.toml +6 -4
- {proofctl-0.6.0 → proofctl-0.6.2}/LICENSE +0 -0
- {proofctl-0.6.0 → proofctl-0.6.2}/MANIFEST.in +0 -0
- {proofctl-0.6.0 → proofctl-0.6.2}/proofctl/__init__.py +0 -0
- {proofctl-0.6.0 → proofctl-0.6.2}/proofctl/_globmatch.py +0 -0
- {proofctl-0.6.0 → proofctl-0.6.2}/proofctl/baseline.py +0 -0
- {proofctl-0.6.0 → proofctl-0.6.2}/proofctl/checkers/__init__.py +0 -0
- {proofctl-0.6.0 → proofctl-0.6.2}/proofctl/checkers/base.py +0 -0
- {proofctl-0.6.0 → proofctl-0.6.2}/proofctl/checkers/dockerfile.py +0 -0
- {proofctl-0.6.0 → proofctl-0.6.2}/proofctl/checkers/imports.py +0 -0
- {proofctl-0.6.0 → proofctl-0.6.2}/proofctl/checkers/leakage.py +0 -0
- {proofctl-0.6.0 → proofctl-0.6.2}/proofctl/checkers/llm_integration.py +0 -0
- {proofctl-0.6.0 → proofctl-0.6.2}/proofctl/checkers/placeholders.py +0 -0
- {proofctl-0.6.0 → proofctl-0.6.2}/proofctl/checkers/secrets.py +0 -0
- {proofctl-0.6.0 → proofctl-0.6.2}/proofctl/checkers/shell_checker.py +0 -0
- {proofctl-0.6.0 → proofctl-0.6.2}/proofctl/checkers/terragrunt.py +0 -0
- {proofctl-0.6.0 → proofctl-0.6.2}/proofctl/checkers/variants.py +0 -0
- {proofctl-0.6.0 → proofctl-0.6.2}/proofctl/config.py +0 -0
- {proofctl-0.6.0 → proofctl-0.6.2}/proofctl/engine.py +0 -0
- {proofctl-0.6.0 → proofctl-0.6.2}/proofctl/fixer.py +0 -0
- {proofctl-0.6.0 → proofctl-0.6.2}/proofctl/models.py +0 -0
- {proofctl-0.6.0 → proofctl-0.6.2}/proofctl/reporters/__init__.py +0 -0
- {proofctl-0.6.0 → proofctl-0.6.2}/proofctl/reporters/html_reporter.py +0 -0
- {proofctl-0.6.0 → proofctl-0.6.2}/proofctl/reporters/json_reporter.py +0 -0
- {proofctl-0.6.0 → proofctl-0.6.2}/proofctl/reporters/terminal.py +0 -0
- {proofctl-0.6.0 → proofctl-0.6.2}/proofctl.egg-info/dependency_links.txt +0 -0
- {proofctl-0.6.0 → proofctl-0.6.2}/proofctl.egg-info/entry_points.txt +0 -0
- {proofctl-0.6.0 → proofctl-0.6.2}/proofctl.egg-info/requires.txt +0 -0
- {proofctl-0.6.0 → proofctl-0.6.2}/proofctl.egg-info/top_level.txt +0 -0
- {proofctl-0.6.0 → proofctl-0.6.2}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: proofctl
|
|
3
|
-
Version: 0.6.
|
|
3
|
+
Version: 0.6.2
|
|
4
4
|
Summary: DevOps linter and security scanner for AI slop and misconfigurations — runs in pre-commit, CI, or post-commit; no external tools required
|
|
5
5
|
Author: Kolawolu Odunola
|
|
6
6
|
License: MIT
|
|
@@ -35,7 +35,7 @@ Dynamic: license-file
|
|
|
35
35
|
|
|
36
36
|
# proofctl
|
|
37
37
|
|
|
38
|
-
A static-analysis linter and security scanner for the DevOps stack — Python, Terraform, Kubernetes, Helm, Dockerfiles, GitHub Actions, Shell — that catches the specific kinds of mistakes AI coding tools introduce. **
|
|
38
|
+
A static-analysis linter and security scanner for the DevOps stack — Python, Terraform, Kubernetes, Helm, Dockerfiles, GitHub Actions, Shell — that catches the specific kinds of mistakes AI coding tools introduce. **271 rules**, no external tools — about a second on a typical Terraform repo.
|
|
39
39
|
|
|
40
40
|
```
|
|
41
41
|
proofctl check .
|
|
@@ -172,7 +172,7 @@ git commit -m "chore: add proofctl baseline"
|
|
|
172
172
|
|
|
173
173
|
## Rules
|
|
174
174
|
|
|
175
|
-
|
|
175
|
+
271 rules across 13 families. Run `proofctl rules` after install to enumerate.
|
|
176
176
|
|
|
177
177
|
| Family | Count | What it covers |
|
|
178
178
|
|---|---|---|
|
|
@@ -182,12 +182,12 @@ git commit -m "chore: add proofctl baseline"
|
|
|
182
182
|
| Python — Other | 15 | Placeholders, leakage (cross-language idioms, PII), import hallucination, variant detection, LLM guardrails (OWASP LLM Top-10) |
|
|
183
183
|
| Terraform — General + AI (`TF-T`, `TF-AI`) | 25 | required_version, sensitive outputs, IAM wildcards, mutable git refs, deprecated resources, AWS-region-in-GCP, placeholder values, image-family pinning, sensitive vars in VM metadata, unused variable declarations |
|
|
184
184
|
| Terraform — AWS (`TF-A`) | 36 | EC2 IMDSv2, S3 public-access-block, EBS encryption, VPC flow logs, KMS rotation, RDS hardening, SG / NACL / EKS / DynamoDB / ElastiCache / CloudTrail / IAM |
|
|
185
|
-
| Terraform — GCP (`TF-G`) |
|
|
185
|
+
| Terraform — GCP (`TF-G`) | 48 | GKE hardening, GCS public-access prevention, IAM roles, KMS rotation, Cloud Function/Run public, BigQuery, Pub/Sub CMEK, Cloud SQL (TLS ssl_mode aware), firewall ingress, compute access scopes, Secret Manager CMEK consistency |
|
|
186
186
|
| Terraform — Azure (`TF-AZ`) | 14 | Storage public blob, SQL public network, AKS RBAC, Key Vault purge protection, NSG SSH/RDP, managed disk CMK |
|
|
187
187
|
| Terraform — Mechanics + Lifecycle (`TF-M`, `TF-V`) | 10 | SG inline mixing, `force_destroy`, mutable module refs, lifecycle antipatterns |
|
|
188
188
|
| Terragrunt (`TG`) | 6 | HCL inputs, mock_outputs, remote state encryption |
|
|
189
189
|
| Dockerfile (`DF`) | 15 | Latest tag, root user, secret leakage, OCI labels, HEALTHCHECK, legacy ENV form |
|
|
190
|
-
| Kubernetes YAML (`YAML`) |
|
|
190
|
+
| Kubernetes YAML (`YAML`) | 34 | Pod Security Standards, hostPath, default namespace, image digest pinning, RBAC wildcards |
|
|
191
191
|
| GitHub Actions (`YAML-GHA`) | 6 | SHA pinning, expression injection, missing permissions, secret env-var leakage, missing timeouts |
|
|
192
192
|
| Shell (`SH`) | 8 | Dangerous globbing, missing `set -euo pipefail` |
|
|
193
193
|
|
|
@@ -344,7 +344,7 @@ proofctl rules --severity ERROR
|
|
|
344
344
|
"severity": "ERROR",
|
|
345
345
|
"message": "SQL injection via string format in .execute()",
|
|
346
346
|
"hint": "Use parameterised queries: cursor.execute(sql, params)",
|
|
347
|
-
"authority": "OWASP
|
|
347
|
+
"authority": "OWASP A05:2025 – Injection / CWE-89"
|
|
348
348
|
}
|
|
349
349
|
]
|
|
350
350
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# proofctl
|
|
2
2
|
|
|
3
|
-
A static-analysis linter and security scanner for the DevOps stack — Python, Terraform, Kubernetes, Helm, Dockerfiles, GitHub Actions, Shell — that catches the specific kinds of mistakes AI coding tools introduce. **
|
|
3
|
+
A static-analysis linter and security scanner for the DevOps stack — Python, Terraform, Kubernetes, Helm, Dockerfiles, GitHub Actions, Shell — that catches the specific kinds of mistakes AI coding tools introduce. **271 rules**, no external tools — about a second on a typical Terraform repo.
|
|
4
4
|
|
|
5
5
|
```
|
|
6
6
|
proofctl check .
|
|
@@ -137,7 +137,7 @@ git commit -m "chore: add proofctl baseline"
|
|
|
137
137
|
|
|
138
138
|
## Rules
|
|
139
139
|
|
|
140
|
-
|
|
140
|
+
271 rules across 13 families. Run `proofctl rules` after install to enumerate.
|
|
141
141
|
|
|
142
142
|
| Family | Count | What it covers |
|
|
143
143
|
|---|---|---|
|
|
@@ -147,12 +147,12 @@ git commit -m "chore: add proofctl baseline"
|
|
|
147
147
|
| Python — Other | 15 | Placeholders, leakage (cross-language idioms, PII), import hallucination, variant detection, LLM guardrails (OWASP LLM Top-10) |
|
|
148
148
|
| Terraform — General + AI (`TF-T`, `TF-AI`) | 25 | required_version, sensitive outputs, IAM wildcards, mutable git refs, deprecated resources, AWS-region-in-GCP, placeholder values, image-family pinning, sensitive vars in VM metadata, unused variable declarations |
|
|
149
149
|
| Terraform — AWS (`TF-A`) | 36 | EC2 IMDSv2, S3 public-access-block, EBS encryption, VPC flow logs, KMS rotation, RDS hardening, SG / NACL / EKS / DynamoDB / ElastiCache / CloudTrail / IAM |
|
|
150
|
-
| Terraform — GCP (`TF-G`) |
|
|
150
|
+
| Terraform — GCP (`TF-G`) | 48 | GKE hardening, GCS public-access prevention, IAM roles, KMS rotation, Cloud Function/Run public, BigQuery, Pub/Sub CMEK, Cloud SQL (TLS ssl_mode aware), firewall ingress, compute access scopes, Secret Manager CMEK consistency |
|
|
151
151
|
| Terraform — Azure (`TF-AZ`) | 14 | Storage public blob, SQL public network, AKS RBAC, Key Vault purge protection, NSG SSH/RDP, managed disk CMK |
|
|
152
152
|
| Terraform — Mechanics + Lifecycle (`TF-M`, `TF-V`) | 10 | SG inline mixing, `force_destroy`, mutable module refs, lifecycle antipatterns |
|
|
153
153
|
| Terragrunt (`TG`) | 6 | HCL inputs, mock_outputs, remote state encryption |
|
|
154
154
|
| Dockerfile (`DF`) | 15 | Latest tag, root user, secret leakage, OCI labels, HEALTHCHECK, legacy ENV form |
|
|
155
|
-
| Kubernetes YAML (`YAML`) |
|
|
155
|
+
| Kubernetes YAML (`YAML`) | 34 | Pod Security Standards, hostPath, default namespace, image digest pinning, RBAC wildcards |
|
|
156
156
|
| GitHub Actions (`YAML-GHA`) | 6 | SHA pinning, expression injection, missing permissions, secret env-var leakage, missing timeouts |
|
|
157
157
|
| Shell (`SH`) | 8 | Dangerous globbing, missing `set -euo pipefail` |
|
|
158
158
|
|
|
@@ -309,7 +309,7 @@ proofctl rules --severity ERROR
|
|
|
309
309
|
"severity": "ERROR",
|
|
310
310
|
"message": "SQL injection via string format in .execute()",
|
|
311
311
|
"hint": "Use parameterised queries: cursor.execute(sql, params)",
|
|
312
|
-
"authority": "OWASP
|
|
312
|
+
"authority": "OWASP A05:2025 – Injection / CWE-89"
|
|
313
313
|
}
|
|
314
314
|
]
|
|
315
315
|
}
|
|
@@ -170,7 +170,9 @@ def _parse(lines: list[str], base: int, skip_outer: bool) -> list[HclBlock]:
|
|
|
170
170
|
|
|
171
171
|
delta = _brace_delta(line)
|
|
172
172
|
|
|
173
|
-
|
|
173
|
+
# A one-line block (`allow { protocol = "tcp" }`, `variable "x" {}`) nets
|
|
174
|
+
# to delta == 0, so it must be recognised here too, not only delta > 0.
|
|
175
|
+
if depth == 0 and delta >= 0 and "{" in _strip_comment(line):
|
|
174
176
|
m = _BLOCK_HEADER_RE.match(line)
|
|
175
177
|
if m:
|
|
176
178
|
block_kind = m.group(1)
|
|
@@ -178,17 +180,16 @@ def _parse(lines: list[str], base: int, skip_outer: bool) -> list[HclBlock]:
|
|
|
178
180
|
block_label1 = m.group(2) or m.group(3) or ""
|
|
179
181
|
# group 4 = quoted label2, group 5 = bare label2
|
|
180
182
|
block_label2 = m.group(4) or m.group(5) or ""
|
|
181
|
-
|
|
182
|
-
depth += delta
|
|
183
|
-
if depth == 0:
|
|
184
|
-
# Single-line block (opened and closed on same line)
|
|
183
|
+
if delta == 0:
|
|
185
184
|
blocks.append(HclBlock(
|
|
186
185
|
kind=block_kind, label1=block_label1, label2=block_label2,
|
|
187
186
|
start_line=lineno, end_line=lineno,
|
|
188
187
|
raw_lines=lines[i:i + 1],
|
|
189
188
|
))
|
|
190
|
-
|
|
191
|
-
|
|
189
|
+
else:
|
|
190
|
+
block_start_idx = i
|
|
191
|
+
depth += delta
|
|
192
|
+
continue
|
|
192
193
|
|
|
193
194
|
if depth > 0:
|
|
194
195
|
depth += delta
|
|
@@ -157,8 +157,8 @@ class _Q002Visitor(ast.NodeVisitor):
|
|
|
157
157
|
severity=sev,
|
|
158
158
|
message=msg,
|
|
159
159
|
hint=hint,
|
|
160
|
-
authority="
|
|
161
|
-
docs_url="https://owasp.org/
|
|
160
|
+
authority="OWASP A10:2025 – Mishandling of Exceptional Conditions",
|
|
161
|
+
docs_url="https://top10.owasp.org/2025/A10_2025-Mishandling_of_Exceptional_Conditions/",
|
|
162
162
|
))
|
|
163
163
|
self.generic_visit(node)
|
|
164
164
|
|
|
@@ -165,8 +165,8 @@ class _S001Visitor(ast.NodeVisitor):
|
|
|
165
165
|
"call — SQL injection risk"
|
|
166
166
|
),
|
|
167
167
|
hint="Use parameterised queries: cursor.execute(sql, (value,))",
|
|
168
|
-
authority="OWASP
|
|
169
|
-
docs_url="https://owasp.org/
|
|
168
|
+
authority="OWASP A05:2025 – Injection / CWE-89",
|
|
169
|
+
docs_url="https://top10.owasp.org/2025/A05_2025-Injection/",
|
|
170
170
|
))
|
|
171
171
|
self.generic_visit(node)
|
|
172
172
|
|
|
@@ -290,8 +290,8 @@ class _S003Visitor(ast.NodeVisitor):
|
|
|
290
290
|
"— remote code execution if input is untrusted"
|
|
291
291
|
),
|
|
292
292
|
hint="Use json.loads() or msgpack. Never deserialise untrusted pickle data.",
|
|
293
|
-
authority="OWASP A08:
|
|
294
|
-
docs_url="https://owasp.org/
|
|
293
|
+
authority="OWASP A08:2025 – Software or Data Integrity Failures / CWE-502",
|
|
294
|
+
docs_url="https://top10.owasp.org/2025/A08_2025-Software_or_Data_Integrity_Failures/",
|
|
295
295
|
))
|
|
296
296
|
|
|
297
297
|
def visit_Call(self, node: ast.Call) -> None:
|
|
@@ -567,7 +567,7 @@ class _S005Visitor(ast.NodeVisitor):
|
|
|
567
567
|
severity=Severity.ERROR,
|
|
568
568
|
message=f"{name}() with non-literal input executes arbitrary code",
|
|
569
569
|
hint="Avoid eval/exec on dynamic input. Use ast.literal_eval() for safe data parsing.",
|
|
570
|
-
authority="CWE-94 – Code Injection / OWASP
|
|
570
|
+
authority="CWE-94 – Code Injection / OWASP A05:2025",
|
|
571
571
|
docs_url="https://cwe.mitre.org/data/definitions/94.html",
|
|
572
572
|
))
|
|
573
573
|
self.generic_visit(node)
|
|
@@ -741,8 +741,8 @@ class _S007Visitor(ast.NodeVisitor):
|
|
|
741
741
|
severity=Severity.ERROR,
|
|
742
742
|
message=f"jwt.decode() with {detail} — signature verification bypassed",
|
|
743
743
|
hint="Never disable JWT signature verification. Use algorithms=['HS256'] with a verified secret.",
|
|
744
|
-
authority="OWASP
|
|
745
|
-
docs_url="https://owasp.org/
|
|
744
|
+
authority="OWASP A04:2025 – Cryptographic Failures / CWE-347",
|
|
745
|
+
docs_url="https://top10.owasp.org/2025/A04_2025-Cryptographic_Failures/",
|
|
746
746
|
))
|
|
747
747
|
|
|
748
748
|
def visit_Call(self, node: ast.Call) -> None:
|
|
@@ -1011,8 +1011,8 @@ class _S008Visitor(ast.NodeVisitor):
|
|
|
1011
1011
|
"Validate and sanitise file paths: use os.path.basename(), "
|
|
1012
1012
|
"pathlib.Path(...).resolve(), or restrict to an allowed directory."
|
|
1013
1013
|
),
|
|
1014
|
-
authority="OWASP A01:
|
|
1015
|
-
docs_url="https://owasp.org/
|
|
1014
|
+
authority="OWASP A01:2025 – Broken Access Control / CWE-22",
|
|
1015
|
+
docs_url="https://top10.owasp.org/2025/A01_2025-Broken_Access_Control/",
|
|
1016
1016
|
))
|
|
1017
1017
|
|
|
1018
1018
|
|
|
@@ -1091,8 +1091,8 @@ class _S010Visitor(ast.NodeVisitor):
|
|
|
1091
1091
|
severity=Severity.WARNING,
|
|
1092
1092
|
message=f"Logging call may expose secret '{name}' — visible in log aggregators and monitoring",
|
|
1093
1093
|
hint="Never log credential values. Log only non-sensitive metadata.",
|
|
1094
|
-
authority="OWASP A09:
|
|
1095
|
-
docs_url="https://owasp.org/
|
|
1094
|
+
authority="OWASP A09:2025 – Security Logging and Alerting Failures / CWE-532",
|
|
1095
|
+
docs_url="https://top10.owasp.org/2025/A09_2025-Security_Logging_and_Alerting_Failures/",
|
|
1096
1096
|
))
|
|
1097
1097
|
|
|
1098
1098
|
def _is_logging_call(self, node: ast.Call) -> bool:
|
|
@@ -1242,7 +1242,7 @@ class _S010Visitor(ast.NodeVisitor):
|
|
|
1242
1242
|
"Log the exception server-side; return a generic error message to the client "
|
|
1243
1243
|
"(e.g. 'Internal error' with a 500 status)."
|
|
1244
1244
|
),
|
|
1245
|
-
authority="OWASP
|
|
1245
|
+
authority="OWASP A10:2025 – Mishandling of Exceptional Conditions / CWE-209 / CWE-200",
|
|
1246
1246
|
docs_url="https://cwe.mitre.org/data/definitions/209.html",
|
|
1247
1247
|
))
|
|
1248
1248
|
|
|
@@ -1735,8 +1735,8 @@ class _S013Visitor(ast.NodeVisitor):
|
|
|
1735
1735
|
severity=Severity.WARNING,
|
|
1736
1736
|
message="Setting Location header from user-supplied URL — open redirect risk",
|
|
1737
1737
|
hint="Validate redirect URLs against an allowlist of trusted domains.",
|
|
1738
|
-
authority="OWASP A01:
|
|
1739
|
-
docs_url="https://owasp.org/
|
|
1738
|
+
authority="OWASP A01:2025 – Broken Access Control / CWE-601",
|
|
1739
|
+
docs_url="https://top10.owasp.org/2025/A01_2025-Broken_Access_Control/",
|
|
1740
1740
|
))
|
|
1741
1741
|
self.generic_visit(node)
|
|
1742
1742
|
|
|
@@ -1762,8 +1762,8 @@ class _S013Visitor(ast.NodeVisitor):
|
|
|
1762
1762
|
severity=Severity.WARNING,
|
|
1763
1763
|
message="redirect() called with an unvalidated URL from user input — open redirect risk",
|
|
1764
1764
|
hint="Validate redirect URLs against an allowlist of trusted domains before redirecting.",
|
|
1765
|
-
authority="OWASP A01:
|
|
1766
|
-
docs_url="https://owasp.org/
|
|
1765
|
+
authority="OWASP A01:2025 – Broken Access Control / CWE-601",
|
|
1766
|
+
docs_url="https://top10.owasp.org/2025/A01_2025-Broken_Access_Control/",
|
|
1767
1767
|
))
|
|
1768
1768
|
self.generic_visit(node)
|
|
1769
1769
|
|
|
@@ -1796,7 +1796,7 @@ class _S014Visitor(ast.NodeVisitor):
|
|
|
1796
1796
|
"disabled, allows MITM attacks"
|
|
1797
1797
|
),
|
|
1798
1798
|
hint="Remove verify=False. Use a trusted CA bundle or pin certificates.",
|
|
1799
|
-
authority="OWASP
|
|
1799
|
+
authority="OWASP A07:2025 – Authentication Failures / CWE-295",
|
|
1800
1800
|
docs_url="https://cwe.mitre.org/data/definitions/295.html",
|
|
1801
1801
|
))
|
|
1802
1802
|
break
|
|
@@ -2161,8 +2161,8 @@ class _S017Visitor(_BaseTaintVisitor):
|
|
|
2161
2161
|
"Escape HTML output with html.escape() / markupsafe.escape() / Jinja2 autoescape, "
|
|
2162
2162
|
"or use a templating engine with autoescape on by default."
|
|
2163
2163
|
),
|
|
2164
|
-
authority="OWASP
|
|
2165
|
-
docs_url="https://owasp.org/
|
|
2164
|
+
authority="OWASP A05:2025 – Injection / CWE-79",
|
|
2165
|
+
docs_url="https://top10.owasp.org/2025/A05_2025-Injection/",
|
|
2166
2166
|
))
|
|
2167
2167
|
|
|
2168
2168
|
def visit_Module(self, node: ast.Module) -> None:
|
|
@@ -2255,8 +2255,8 @@ class _S018Visitor(_BaseTaintVisitor):
|
|
|
2255
2255
|
"Validate URLs against an allowlist of trusted hosts. Reject internal IPs "
|
|
2256
2256
|
"(127.0.0.0/8, 169.254.0.0/16, 10.0.0.0/8, etc.) and resolve DNS before connecting."
|
|
2257
2257
|
),
|
|
2258
|
-
authority="OWASP
|
|
2259
|
-
docs_url="https://
|
|
2258
|
+
authority="OWASP A01:2025 – Broken Access Control / CWE-918",
|
|
2259
|
+
docs_url="https://cwe.mitre.org/data/definitions/918.html",
|
|
2260
2260
|
))
|
|
2261
2261
|
|
|
2262
2262
|
self._tainted = outer
|
|
@@ -2413,7 +2413,7 @@ class _S019Visitor(ast.NodeVisitor):
|
|
|
2413
2413
|
"Wrap with werkzeug.utils.secure_filename() and check the extension "
|
|
2414
2414
|
"against an allowlist (e.g. {'.png', '.jpg'})."
|
|
2415
2415
|
),
|
|
2416
|
-
authority="OWASP
|
|
2416
|
+
authority="OWASP A06:2025 / CWE-434",
|
|
2417
2417
|
docs_url="https://cwe.mitre.org/data/definitions/434.html",
|
|
2418
2418
|
))
|
|
2419
2419
|
|
|
@@ -2533,7 +2533,7 @@ class _S020Visitor(_BaseTaintVisitor):
|
|
|
2533
2533
|
severity=Severity.ERROR,
|
|
2534
2534
|
message=message,
|
|
2535
2535
|
hint=hint,
|
|
2536
|
-
authority="OWASP
|
|
2536
|
+
authority="OWASP A06:2025 / CWE-522",
|
|
2537
2537
|
docs_url="https://cwe.mitre.org/data/definitions/522.html",
|
|
2538
2538
|
))
|
|
2539
2539
|
|
|
@@ -2574,7 +2574,7 @@ class _S021Visitor(ast.NodeVisitor):
|
|
|
2574
2574
|
"Use the principle of least privilege: 0o600 for secrets, 0o644 for "
|
|
2575
2575
|
"shared read, 0o700 for directories owned by the user."
|
|
2576
2576
|
),
|
|
2577
|
-
authority="OWASP
|
|
2577
|
+
authority="OWASP A01:2025 / CWE-732",
|
|
2578
2578
|
docs_url="https://cwe.mitre.org/data/definitions/732.html",
|
|
2579
2579
|
))
|
|
2580
2580
|
|
|
@@ -2666,7 +2666,7 @@ class _S022Visitor(_BaseTaintVisitor):
|
|
|
2666
2666
|
"Use parameterised XPath: tree.xpath('//user[@name=$n]', n=user_input). "
|
|
2667
2667
|
"Never concatenate user input into the query string."
|
|
2668
2668
|
),
|
|
2669
|
-
authority="OWASP
|
|
2669
|
+
authority="OWASP A05:2025 / CWE-643",
|
|
2670
2670
|
docs_url="https://cwe.mitre.org/data/definitions/643.html",
|
|
2671
2671
|
))
|
|
2672
2672
|
|
|
@@ -2721,7 +2721,7 @@ class _S022Visitor(_BaseTaintVisitor):
|
|
|
2721
2721
|
severity=Severity.ERROR,
|
|
2722
2722
|
message="xpath() built via string formatting/concat — XPath injection risk",
|
|
2723
2723
|
hint="Use parameterised XPath (variables, e.g. xpath('//u[@n=$n]', n=value)).",
|
|
2724
|
-
authority="OWASP
|
|
2724
|
+
authority="OWASP A05:2025 / CWE-643",
|
|
2725
2725
|
docs_url="https://cwe.mitre.org/data/definitions/643.html",
|
|
2726
2726
|
))
|
|
2727
2727
|
|
|
@@ -2789,7 +2789,7 @@ class _S023Visitor(ast.NodeVisitor):
|
|
|
2789
2789
|
"Remove @csrf_exempt and ensure the form/template includes {% csrf_token %}; "
|
|
2790
2790
|
"or use a custom token-based authentication that is not cookie-bound."
|
|
2791
2791
|
),
|
|
2792
|
-
authority="OWASP A01:
|
|
2792
|
+
authority="OWASP A01:2025 / CWE-352",
|
|
2793
2793
|
docs_url="https://cwe.mitre.org/data/definitions/352.html",
|
|
2794
2794
|
))
|
|
2795
2795
|
|
|
@@ -2913,7 +2913,7 @@ class _S024Visitor(ast.NodeVisitor):
|
|
|
2913
2913
|
"Add an auth decorator (@login_required, @permission_required('app.delete_x'), "
|
|
2914
2914
|
"FastAPI Depends(get_current_user), etc.) or check current_user inside the handler."
|
|
2915
2915
|
),
|
|
2916
|
-
authority="OWASP A01:
|
|
2916
|
+
authority="OWASP A01:2025 – Broken Access Control / CWE-862",
|
|
2917
2917
|
docs_url="https://cwe.mitre.org/data/definitions/862.html",
|
|
2918
2918
|
))
|
|
2919
2919
|
|
|
@@ -121,6 +121,30 @@ _BROAD_GCP_ROLES = frozenset({
|
|
|
121
121
|
"roles/iam.serviceAccountAdmin",
|
|
122
122
|
})
|
|
123
123
|
|
|
124
|
+
# Project-scoped roles that grant data-plane access to EVERY resource of that
|
|
125
|
+
# service in the project. Resource-level IAM exists for all of them, so a
|
|
126
|
+
# project-wide grant is the cross-tenant blast-radius shape: one compromised
|
|
127
|
+
# principal reads (or rewrites) every tenant's data.
|
|
128
|
+
_PROJECT_WIDE_DATA_ROLES = frozenset({
|
|
129
|
+
"roles/secretmanager.admin",
|
|
130
|
+
"roles/secretmanager.secretAccessor",
|
|
131
|
+
"roles/secretmanager.secretVersionManager",
|
|
132
|
+
"roles/datastore.owner",
|
|
133
|
+
"roles/datastore.user",
|
|
134
|
+
"roles/datastore.viewer",
|
|
135
|
+
"roles/storage.objectAdmin",
|
|
136
|
+
"roles/storage.objectUser",
|
|
137
|
+
"roles/storage.objectViewer",
|
|
138
|
+
"roles/cloudkms.cryptoKeyDecrypter",
|
|
139
|
+
"roles/cloudkms.cryptoKeyEncrypterDecrypter",
|
|
140
|
+
"roles/bigquery.dataOwner",
|
|
141
|
+
"roles/bigquery.dataEditor",
|
|
142
|
+
"roles/bigquery.dataViewer",
|
|
143
|
+
})
|
|
144
|
+
|
|
145
|
+
# Any `roles/<service>.admin` at project scope (storage.admin, cloudsql.admin…).
|
|
146
|
+
_SERVICE_ADMIN_ROLE_RE = re.compile(r"^roles/[a-z][A-Za-z]*\.admin$")
|
|
147
|
+
|
|
124
148
|
_GCP_IAM_RESOURCES = frozenset({
|
|
125
149
|
"google_project_iam_binding",
|
|
126
150
|
"google_project_iam_member",
|
|
@@ -247,6 +271,8 @@ class TerraformChecker(HclFileChecker):
|
|
|
247
271
|
out += self._g019(path, blocks)
|
|
248
272
|
out += self._g020(path, blocks)
|
|
249
273
|
out += self._g021(path, blocks)
|
|
274
|
+
out += self._g049(path, blocks)
|
|
275
|
+
out += self._g050(path, blocks)
|
|
250
276
|
out += self._g023(path, blocks)
|
|
251
277
|
out += self._g024(path, blocks)
|
|
252
278
|
out += self._g025(path, blocks)
|
|
@@ -589,8 +615,8 @@ class TerraformChecker(HclFileChecker):
|
|
|
589
615
|
Severity.ERROR,
|
|
590
616
|
f'"{attr}" appears to contain a literal secret value',
|
|
591
617
|
hint="Use var.* references or a secrets manager. Never commit credentials.",
|
|
592
|
-
authority="OWASP
|
|
593
|
-
docs_url="https://owasp.org/
|
|
618
|
+
authority="OWASP A07:2025 – Authentication Failures / CWE-798",
|
|
619
|
+
docs_url="https://top10.owasp.org/2025/A07_2025-Authentication_Failures/",
|
|
594
620
|
))
|
|
595
621
|
return out
|
|
596
622
|
|
|
@@ -1359,6 +1385,65 @@ class TerraformChecker(HclFileChecker):
|
|
|
1359
1385
|
))
|
|
1360
1386
|
return out
|
|
1361
1387
|
|
|
1388
|
+
def _g049(self, path: Path, blocks: list[HclBlock]) -> list[Finding]:
|
|
1389
|
+
"""G-049 — Project-scoped role granting data access to every resource."""
|
|
1390
|
+
out = []
|
|
1391
|
+
for b in blocks:
|
|
1392
|
+
if b.kind != "resource" or b.label1 not in _GCP_IAM_RESOURCES:
|
|
1393
|
+
continue
|
|
1394
|
+
role = (b.attr_value("role") or "").strip('"')
|
|
1395
|
+
if not role or role in _BROAD_GCP_ROLES:
|
|
1396
|
+
continue # G-021 already covers the primitive/IAM-admin roles
|
|
1397
|
+
if role not in _PROJECT_WIDE_DATA_ROLES and not _SERVICE_ADMIN_ROLE_RE.match(role):
|
|
1398
|
+
continue
|
|
1399
|
+
out.append(self._f(
|
|
1400
|
+
path, b.attr_line("role") or b.start_line,
|
|
1401
|
+
"PROOFCTL-TF-G049", "Project-wide data-access role",
|
|
1402
|
+
Severity.WARNING,
|
|
1403
|
+
f'"{b.label1}" grants "{role}" at project scope — this principal can '
|
|
1404
|
+
f"reach every resource of that service in the project",
|
|
1405
|
+
hint=(
|
|
1406
|
+
"Bind the role on the specific resource instead — e.g. "
|
|
1407
|
+
"google_secret_manager_secret_iam_member / "
|
|
1408
|
+
"google_storage_bucket_iam_member — so one compromised principal "
|
|
1409
|
+
"cannot read every tenant's data."
|
|
1410
|
+
),
|
|
1411
|
+
authority="Google IAM — principle of least privilege",
|
|
1412
|
+
docs_url="https://cloud.google.com/iam/docs/best-practices-service-accounts",
|
|
1413
|
+
))
|
|
1414
|
+
return out
|
|
1415
|
+
|
|
1416
|
+
def _g050(self, path: Path, blocks: list[HclBlock]) -> list[Finding]:
|
|
1417
|
+
"""G-050 — Firewall rule allows unrestricted egress to the internet."""
|
|
1418
|
+
out = []
|
|
1419
|
+
for b in blocks:
|
|
1420
|
+
if b.kind != "resource" or b.label1 != "google_compute_firewall":
|
|
1421
|
+
continue
|
|
1422
|
+
if (b.attr_value("direction") or "").strip('"').upper() != "EGRESS":
|
|
1423
|
+
continue
|
|
1424
|
+
if not b.contains(r'destination_ranges\s*=\s*\[[^\]]*"0\.0\.0\.0/0"'):
|
|
1425
|
+
continue
|
|
1426
|
+
# A deny-all egress rule to 0.0.0.0/0 is the protective pattern, not a
|
|
1427
|
+
# finding. Match single-line and multi-line block forms.
|
|
1428
|
+
if b.has_nested("deny") or b.contains(r"\bdeny\s*\{"):
|
|
1429
|
+
continue
|
|
1430
|
+
if not (b.has_nested("allow") or b.contains(r"\ballow\s*\{")):
|
|
1431
|
+
continue
|
|
1432
|
+
out.append(self._f(
|
|
1433
|
+
path, b.start_line,
|
|
1434
|
+
"PROOFCTL-TF-G050", "Firewall allows egress to the internet",
|
|
1435
|
+
Severity.WARNING,
|
|
1436
|
+
f'google_compute_firewall "{b.label2}" allows egress to 0.0.0.0/0 — '
|
|
1437
|
+
f"a compromised workload can exfiltrate data anywhere",
|
|
1438
|
+
hint=(
|
|
1439
|
+
"Restrict destination_ranges to the CIDRs actually required, or keep "
|
|
1440
|
+
"an FQDN/CIDR allow-list above a low-priority deny-all egress rule."
|
|
1441
|
+
),
|
|
1442
|
+
authority="CIS GCP Benchmark 3.x / MITRE ATT&CK T1048",
|
|
1443
|
+
docs_url="https://cloud.google.com/vpc/docs/firewalls",
|
|
1444
|
+
))
|
|
1445
|
+
return out
|
|
1446
|
+
|
|
1362
1447
|
def _g023(self, path: Path, blocks: list[HclBlock]) -> list[Finding]:
|
|
1363
1448
|
"""G-023 — KMS key rotation not configured or > 90 days."""
|
|
1364
1449
|
out = []
|
|
@@ -2005,7 +2090,7 @@ class TerraformChecker(HclFileChecker):
|
|
|
2005
2090
|
Severity.ERROR,
|
|
2006
2091
|
f'Lambda "{b.label2}" environment variable appears to contain a literal secret',
|
|
2007
2092
|
hint="Use AWS Secrets Manager or SSM Parameter Store and retrieve at runtime.",
|
|
2008
|
-
authority="OWASP
|
|
2093
|
+
authority="OWASP A07:2025 – Authentication Failures / CWE-798",
|
|
2009
2094
|
))
|
|
2010
2095
|
break
|
|
2011
2096
|
return out
|
|
@@ -2153,8 +2238,8 @@ class TerraformChecker(HclFileChecker):
|
|
|
2153
2238
|
Severity.ERROR,
|
|
2154
2239
|
f"Lambda function '{b.label2}' has a hardcoded secret in environment variables",
|
|
2155
2240
|
hint="Store secrets in AWS Secrets Manager or SSM Parameter Store and retrieve at runtime.",
|
|
2156
|
-
authority="OWASP
|
|
2157
|
-
docs_url="https://owasp.org/
|
|
2241
|
+
authority="OWASP A06:2025 – Insecure Design / CWE-312",
|
|
2242
|
+
docs_url="https://top10.owasp.org/2025/A06_2025-Insecure_Design/",
|
|
2158
2243
|
))
|
|
2159
2244
|
break
|
|
2160
2245
|
if env_depth <= 0:
|
|
@@ -178,8 +178,8 @@ def _yaml001(root: yaml.Node, path: Path) -> list[Finding]:
|
|
|
178
178
|
severity=Severity.ERROR,
|
|
179
179
|
message=f"Key '{key}' contains a hardcoded secret value",
|
|
180
180
|
hint="Reference via environment variable: password: ${DB_PASSWORD}",
|
|
181
|
-
authority="OWASP
|
|
182
|
-
docs_url="https://owasp.org/
|
|
181
|
+
authority="OWASP A07:2025 – Authentication Failures / CWE-798 / 12-Factor III",
|
|
182
|
+
docs_url="https://top10.owasp.org/2025/A07_2025-Authentication_Failures/",
|
|
183
183
|
))
|
|
184
184
|
elif val is not None and _SECRET_VALUE_RE.search(val):
|
|
185
185
|
findings.append(Finding(
|
|
@@ -191,8 +191,8 @@ def _yaml001(root: yaml.Node, path: Path) -> list[Finding]:
|
|
|
191
191
|
severity=Severity.ERROR,
|
|
192
192
|
message=f"Value under '{key}' matches a known secret format",
|
|
193
193
|
hint="Remove the secret and reference it via a secret manager or env var.",
|
|
194
|
-
authority="OWASP
|
|
195
|
-
docs_url="https://owasp.org/
|
|
194
|
+
authority="OWASP A07:2025 – Authentication Failures / CWE-798",
|
|
195
|
+
docs_url="https://top10.owasp.org/2025/A07_2025-Authentication_Failures/",
|
|
196
196
|
))
|
|
197
197
|
_walk_mapping(v)
|
|
198
198
|
elif isinstance(node, yaml.SequenceNode):
|
|
@@ -812,6 +812,116 @@ def _yaml014_k8s(root: yaml.MappingNode, path: Path) -> list[Finding]:
|
|
|
812
812
|
return findings
|
|
813
813
|
|
|
814
814
|
|
|
815
|
+
def _netpol_meta(root: yaml.MappingNode) -> tuple[str, yaml.MappingNode | None]:
|
|
816
|
+
"""Return (name, spec) for a NetworkPolicy document, or ("", None)."""
|
|
817
|
+
if _scalar(_get_key(root, "kind")) != "NetworkPolicy":
|
|
818
|
+
return "", None
|
|
819
|
+
name = "unnamed"
|
|
820
|
+
meta = _get_key(root, "metadata")
|
|
821
|
+
if isinstance(meta, yaml.MappingNode):
|
|
822
|
+
name = _scalar(_get_key(meta, "name")) or "unnamed"
|
|
823
|
+
spec = _get_key(root, "spec")
|
|
824
|
+
return name, spec if isinstance(spec, yaml.MappingNode) else None
|
|
825
|
+
|
|
826
|
+
|
|
827
|
+
def _yaml027_netpol_no_egress(root: yaml.MappingNode, path: Path) -> list[Finding]:
|
|
828
|
+
"""PROOFCTL-YAML-027 — NetworkPolicy does not restrict egress.
|
|
829
|
+
|
|
830
|
+
Omitting `Egress` from policyTypes means Kubernetes defaults to
|
|
831
|
+
`policyTypes: [Ingress]`, leaving outbound traffic completely
|
|
832
|
+
unrestricted — the pod can still reach the cloud metadata endpoint
|
|
833
|
+
and any internet host.
|
|
834
|
+
"""
|
|
835
|
+
name, spec = _netpol_meta(root)
|
|
836
|
+
if spec is None:
|
|
837
|
+
return []
|
|
838
|
+
|
|
839
|
+
types_node = _get_key(spec, "policyTypes")
|
|
840
|
+
declared = []
|
|
841
|
+
if isinstance(types_node, yaml.SequenceNode):
|
|
842
|
+
declared = [_scalar(v) or "" for v in types_node.value]
|
|
843
|
+
if "Egress" in declared:
|
|
844
|
+
return []
|
|
845
|
+
# An explicit `egress:` block implies Egress even if policyTypes is absent.
|
|
846
|
+
if _get_key(spec, "egress") is not None:
|
|
847
|
+
return []
|
|
848
|
+
|
|
849
|
+
node = types_node or spec
|
|
850
|
+
return [Finding(
|
|
851
|
+
file=str(path),
|
|
852
|
+
line=node.start_mark.line + 1,
|
|
853
|
+
col=node.start_mark.column,
|
|
854
|
+
rule_id="PROOFCTL-YAML-027",
|
|
855
|
+
rule_name="NetworkPolicy does not restrict egress",
|
|
856
|
+
severity=Severity.WARNING,
|
|
857
|
+
message=(
|
|
858
|
+
f"NetworkPolicy '{name}' has no Egress policyType — outbound traffic is "
|
|
859
|
+
f"unrestricted, so a compromised pod can reach the metadata endpoint and "
|
|
860
|
+
f"exfiltrate to any host"
|
|
861
|
+
),
|
|
862
|
+
hint=(
|
|
863
|
+
"Add 'Egress' to policyTypes and an egress allow-list (DNS, the datastore "
|
|
864
|
+
"CIDR, required APIs). Default-deny egress also blocks 169.254.169.254."
|
|
865
|
+
),
|
|
866
|
+
authority="Kubernetes Network Policies / NSA-CISA Kubernetes Hardening",
|
|
867
|
+
docs_url="https://kubernetes.io/docs/concepts/services-networking/network-policies/",
|
|
868
|
+
)]
|
|
869
|
+
|
|
870
|
+
|
|
871
|
+
def _yaml028_netpol_broad_peer(root: yaml.MappingNode, path: Path) -> list[Finding]:
|
|
872
|
+
"""PROOFCTL-YAML-028 — NetworkPolicy peer selects a whole namespace, all ports.
|
|
873
|
+
|
|
874
|
+
A `from`/`to` peer carrying only a namespaceSelector admits every pod in any
|
|
875
|
+
matching namespace. With no `ports:` on the rule it is every port too, so any
|
|
876
|
+
workload landing in that namespace reaches the datastore tier directly.
|
|
877
|
+
"""
|
|
878
|
+
name, spec = _netpol_meta(root)
|
|
879
|
+
if spec is None:
|
|
880
|
+
return []
|
|
881
|
+
|
|
882
|
+
findings: list[Finding] = []
|
|
883
|
+
for direction, peer_key in (("ingress", "from"), ("egress", "to")):
|
|
884
|
+
rules_node = _get_key(spec, direction)
|
|
885
|
+
if not isinstance(rules_node, yaml.SequenceNode):
|
|
886
|
+
continue
|
|
887
|
+
for rule in rules_node.value:
|
|
888
|
+
if not isinstance(rule, yaml.MappingNode):
|
|
889
|
+
continue
|
|
890
|
+
has_ports = _get_key(rule, "ports") is not None
|
|
891
|
+
peers = _get_key(rule, peer_key)
|
|
892
|
+
if not isinstance(peers, yaml.SequenceNode):
|
|
893
|
+
continue
|
|
894
|
+
for peer in peers.value:
|
|
895
|
+
if not isinstance(peer, yaml.MappingNode):
|
|
896
|
+
continue
|
|
897
|
+
keys = {_scalar(k) for k, _ in peer.value}
|
|
898
|
+
# Only a namespaceSelector: no pod narrowing within the namespace.
|
|
899
|
+
if "namespaceSelector" not in keys or "podSelector" in keys:
|
|
900
|
+
continue
|
|
901
|
+
if has_ports:
|
|
902
|
+
continue # port-scoped: materially narrower, don't flag
|
|
903
|
+
findings.append(Finding(
|
|
904
|
+
file=str(path),
|
|
905
|
+
line=peer.start_mark.line + 1,
|
|
906
|
+
col=peer.start_mark.column,
|
|
907
|
+
rule_id="PROOFCTL-YAML-028",
|
|
908
|
+
rule_name="NetworkPolicy peer selects entire namespace",
|
|
909
|
+
severity=Severity.WARNING,
|
|
910
|
+
message=(
|
|
911
|
+
f"NetworkPolicy '{name}' {direction} rule admits every pod in the "
|
|
912
|
+
f"selected namespace on every port"
|
|
913
|
+
),
|
|
914
|
+
hint=(
|
|
915
|
+
"Pair the namespaceSelector with a podSelector in the same peer "
|
|
916
|
+
"(logical AND) and add a 'ports:' list, so only the intended "
|
|
917
|
+
"workload and port are reachable."
|
|
918
|
+
),
|
|
919
|
+
authority="Kubernetes Network Policies / NSA-CISA Kubernetes Hardening",
|
|
920
|
+
docs_url="https://kubernetes.io/docs/concepts/services-networking/network-policies/",
|
|
921
|
+
))
|
|
922
|
+
return findings
|
|
923
|
+
|
|
924
|
+
|
|
815
925
|
def _yaml015_k8s(root: yaml.MappingNode, path: Path) -> list[Finding]:
|
|
816
926
|
"""PROOFCTL-YAML-015 — ClusterRoleBinding with roleRef.name: cluster-admin."""
|
|
817
927
|
findings: list[Finding] = []
|
|
@@ -1016,8 +1126,8 @@ def _yaml021_k8s(root: yaml.MappingNode, path: Path) -> list[Finding]:
|
|
|
1016
1126
|
" — use secretKeyRef"
|
|
1017
1127
|
),
|
|
1018
1128
|
hint="Use env: - name: FOO valueFrom: secretKeyRef: name: my-secret key: foo",
|
|
1019
|
-
authority="OWASP
|
|
1020
|
-
docs_url="https://owasp.org/
|
|
1129
|
+
authority="OWASP A07:2025 – Authentication Failures / CWE-798",
|
|
1130
|
+
docs_url="https://top10.owasp.org/2025/A07_2025-Authentication_Failures/",
|
|
1021
1131
|
))
|
|
1022
1132
|
return findings
|
|
1023
1133
|
|
|
@@ -1793,6 +1903,8 @@ class _YamlCheckerImpl(YamlFileChecker):
|
|
|
1793
1903
|
findings.extend(_yaml024_runasuser_low(root, path))
|
|
1794
1904
|
findings.extend(_yaml025_rbac_wildcard_admin(root, path))
|
|
1795
1905
|
findings.extend(_yaml026_net_raw(root, path))
|
|
1906
|
+
findings.extend(_yaml027_netpol_no_egress(root, path))
|
|
1907
|
+
findings.extend(_yaml028_netpol_broad_peer(root, path))
|
|
1796
1908
|
# AI-slop: removed apiVersions, PSP, explicit root, deprecated annotations
|
|
1797
1909
|
findings.extend(_yaml_ai001_k8s_removed_api(root, path))
|
|
1798
1910
|
findings.extend(_yaml_ai002_pod_security_policy(root, path))
|
|
@@ -51,6 +51,11 @@ _HIDDEN_FAMILIES: frozenset[str] = frozenset({"INTERNAL"})
|
|
|
51
51
|
# expression rather than a literal Severity.X. Listed as the worst case the rule
|
|
52
52
|
# can fire at, since that is what `proofctl rules` should communicate.
|
|
53
53
|
_DYNAMIC_SEVERITY_OVERRIDES: dict[str, Severity] = {
|
|
54
|
+
"PROOFCTL-INTERNAL-001": Severity.ERROR, # INFO by default, ERROR under --strict
|
|
55
|
+
"PROOFCTL-Q-AI-006": Severity.ERROR, # ERROR for bare except, else WARNING/INFO
|
|
56
|
+
"PROOFCTL-S-016": Severity.WARNING, # INFO for common tools, else WARNING
|
|
57
|
+
"PROOFCTL-TF-G040": Severity.WARNING, # INFO on GKE Autopilot, else WARNING
|
|
58
|
+
"PROOFCTL-YAML-019": Severity.ERROR, # ERROR for sensitive host paths, else WARNING
|
|
54
59
|
"PROOFCTL-DF-001": Severity.ERROR, # ERROR for :latest, WARNING for tag-without-digest
|
|
55
60
|
"PROOFCTL-DF-005": Severity.ERROR, # ERROR for ENV, WARNING for ARG
|
|
56
61
|
"PROOFCTL-I-002": Severity.ERROR, # ERROR/WARNING by category
|
|
@@ -96,15 +101,20 @@ def _severity_label(node: ast.AST | None) -> str | None:
|
|
|
96
101
|
return None
|
|
97
102
|
|
|
98
103
|
|
|
104
|
+
# Positional finding-builder helpers: (…, "PROOFCTL-…", "Rule name", …, Severity.X, …).
|
|
105
|
+
# A helper missing from this set silently loses its rules' names and severities.
|
|
106
|
+
_HELPER_NAMES = frozenset({"_f", "_mk"})
|
|
107
|
+
|
|
108
|
+
|
|
99
109
|
def _is_finding_call(call: ast.Call) -> str | None:
|
|
100
|
-
"""'finding' for Finding(...), 'helper' for
|
|
110
|
+
"""'finding' for Finding(...), 'helper' for a known builder helper, else None."""
|
|
101
111
|
fn = call.func
|
|
102
112
|
if isinstance(fn, ast.Name):
|
|
103
113
|
if fn.id == "Finding":
|
|
104
114
|
return "finding"
|
|
105
|
-
if fn.id
|
|
115
|
+
if fn.id in _HELPER_NAMES:
|
|
106
116
|
return "helper"
|
|
107
|
-
if isinstance(fn, ast.Attribute) and fn.attr
|
|
117
|
+
if isinstance(fn, ast.Attribute) and fn.attr in _HELPER_NAMES:
|
|
108
118
|
return "helper"
|
|
109
119
|
return None
|
|
110
120
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: proofctl
|
|
3
|
-
Version: 0.6.
|
|
3
|
+
Version: 0.6.2
|
|
4
4
|
Summary: DevOps linter and security scanner for AI slop and misconfigurations — runs in pre-commit, CI, or post-commit; no external tools required
|
|
5
5
|
Author: Kolawolu Odunola
|
|
6
6
|
License: MIT
|
|
@@ -35,7 +35,7 @@ Dynamic: license-file
|
|
|
35
35
|
|
|
36
36
|
# proofctl
|
|
37
37
|
|
|
38
|
-
A static-analysis linter and security scanner for the DevOps stack — Python, Terraform, Kubernetes, Helm, Dockerfiles, GitHub Actions, Shell — that catches the specific kinds of mistakes AI coding tools introduce. **
|
|
38
|
+
A static-analysis linter and security scanner for the DevOps stack — Python, Terraform, Kubernetes, Helm, Dockerfiles, GitHub Actions, Shell — that catches the specific kinds of mistakes AI coding tools introduce. **271 rules**, no external tools — about a second on a typical Terraform repo.
|
|
39
39
|
|
|
40
40
|
```
|
|
41
41
|
proofctl check .
|
|
@@ -172,7 +172,7 @@ git commit -m "chore: add proofctl baseline"
|
|
|
172
172
|
|
|
173
173
|
## Rules
|
|
174
174
|
|
|
175
|
-
|
|
175
|
+
271 rules across 13 families. Run `proofctl rules` after install to enumerate.
|
|
176
176
|
|
|
177
177
|
| Family | Count | What it covers |
|
|
178
178
|
|---|---|---|
|
|
@@ -182,12 +182,12 @@ git commit -m "chore: add proofctl baseline"
|
|
|
182
182
|
| Python — Other | 15 | Placeholders, leakage (cross-language idioms, PII), import hallucination, variant detection, LLM guardrails (OWASP LLM Top-10) |
|
|
183
183
|
| Terraform — General + AI (`TF-T`, `TF-AI`) | 25 | required_version, sensitive outputs, IAM wildcards, mutable git refs, deprecated resources, AWS-region-in-GCP, placeholder values, image-family pinning, sensitive vars in VM metadata, unused variable declarations |
|
|
184
184
|
| Terraform — AWS (`TF-A`) | 36 | EC2 IMDSv2, S3 public-access-block, EBS encryption, VPC flow logs, KMS rotation, RDS hardening, SG / NACL / EKS / DynamoDB / ElastiCache / CloudTrail / IAM |
|
|
185
|
-
| Terraform — GCP (`TF-G`) |
|
|
185
|
+
| Terraform — GCP (`TF-G`) | 48 | GKE hardening, GCS public-access prevention, IAM roles, KMS rotation, Cloud Function/Run public, BigQuery, Pub/Sub CMEK, Cloud SQL (TLS ssl_mode aware), firewall ingress, compute access scopes, Secret Manager CMEK consistency |
|
|
186
186
|
| Terraform — Azure (`TF-AZ`) | 14 | Storage public blob, SQL public network, AKS RBAC, Key Vault purge protection, NSG SSH/RDP, managed disk CMK |
|
|
187
187
|
| Terraform — Mechanics + Lifecycle (`TF-M`, `TF-V`) | 10 | SG inline mixing, `force_destroy`, mutable module refs, lifecycle antipatterns |
|
|
188
188
|
| Terragrunt (`TG`) | 6 | HCL inputs, mock_outputs, remote state encryption |
|
|
189
189
|
| Dockerfile (`DF`) | 15 | Latest tag, root user, secret leakage, OCI labels, HEALTHCHECK, legacy ENV form |
|
|
190
|
-
| Kubernetes YAML (`YAML`) |
|
|
190
|
+
| Kubernetes YAML (`YAML`) | 34 | Pod Security Standards, hostPath, default namespace, image digest pinning, RBAC wildcards |
|
|
191
191
|
| GitHub Actions (`YAML-GHA`) | 6 | SHA pinning, expression injection, missing permissions, secret env-var leakage, missing timeouts |
|
|
192
192
|
| Shell (`SH`) | 8 | Dangerous globbing, missing `set -euo pipefail` |
|
|
193
193
|
|
|
@@ -344,7 +344,7 @@ proofctl rules --severity ERROR
|
|
|
344
344
|
"severity": "ERROR",
|
|
345
345
|
"message": "SQL injection via string format in .execute()",
|
|
346
346
|
"hint": "Use parameterised queries: cursor.execute(sql, params)",
|
|
347
|
-
"authority": "OWASP
|
|
347
|
+
"authority": "OWASP A05:2025 – Injection / CWE-89"
|
|
348
348
|
}
|
|
349
349
|
]
|
|
350
350
|
}
|
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "proofctl"
|
|
7
|
-
version = "0.6.
|
|
7
|
+
version = "0.6.2"
|
|
8
8
|
description = "DevOps linter and security scanner for AI slop and misconfigurations — runs in pre-commit, CI, or post-commit; no external tools required"
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
license = { text = "MIT" }
|
|
@@ -59,9 +59,11 @@ target-version = "py311"
|
|
|
59
59
|
line-length = 120
|
|
60
60
|
|
|
61
61
|
[tool.ruff.lint]
|
|
62
|
-
#
|
|
63
|
-
#
|
|
64
|
-
#
|
|
62
|
+
# Pinned explicitly, NOT left to ruff's default: the default set changes between
|
|
63
|
+
# ruff versions, and `ruff>=0.4` in [dev] would then silently move a hard CI gate.
|
|
64
|
+
# E4/E7/E9 + F are the bug-class rules (undefined names, unused imports/vars).
|
|
65
|
+
select = ["E4", "E7", "E9", "F"]
|
|
66
|
+
# E701 (compact one-line `if cond: return`) is intentional in the type-dispatch helpers.
|
|
65
67
|
ignore = ["E701"]
|
|
66
68
|
|
|
67
69
|
[tool.setuptools.packages.find]
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|