Compare commits

..

2 Commits

Author SHA1 Message Date
Jon Chery 3d9dd06411 docs(P13): complete kyverno-kube-version-resolution phase (v1.13.16)
---ci---
project: acdl
phase: 13
milestone: v1.14
status: complete
requirements:
  covered: [REQ-147]
  partial: []
---/ci---
2026-07-29 21:07:10 +00:00
Jon Chery b257846981 docs(P12): complete gitignore-credential-hygiene phase (v1.13.15)
---ci---
project: acdl
phase: 12
milestone: v1.14
status: complete
requirements:
  covered: [REQ-146]
  partial: []
---/ci---
2026-07-29 21:00:34 +00:00
4 changed files with 59 additions and 17 deletions
+10
View File
@@ -19,3 +19,13 @@ terraform/bootstrap/.bootstrap_state.json
**/.terraform.lock.hcl **/.terraform.lock.hcl
**/tfplan **/tfplan
**/*.tfstate* **/*.tfstate*
# Credential patterns (v1.14, REQ-146)
*.pem
*.key
*.p12
*.pfx
*.cer
*.crt
*.jks
*.keystore
+8 -13
View File
@@ -8,13 +8,16 @@ v1.9 (REQ-111): the translator is fleshed out — full PolicyReport →
PolicyCheckResult mapping with severity + skip-with-reason handling. It PolicyCheckResult mapping with severity + skip-with-reason handling. It
remains inactive for Terraform-only stacks (guard preserved — emits a remains inactive for Terraform-only stacks (guard preserved — emits a
single SKIPPED `KYVERNO_INACTIVE_TF_STACK` record when no K8s manifests). single SKIPPED `KYVERNO_INACTIVE_TF_STACK` record when no K8s manifests).
A `--kube-version` stub is parsed but not yet used (for future GitOps). A `--kube-version` flag was previously parsed but never used. It has been
removed (v1.14, G-103) to resolve the stub. Version-aware policy selection
will be added when the GitOps reconciler emits K8s manifests (D-053
roadmap). The adapter is inactive for Terraform-only stacks today.
D-053: the platform emits Terraform, not K8s manifests. This adapter D-053: the platform emits Terraform, not K8s manifests. This adapter
activates when the GitOps reconciler (roadmap) emits K8s manifests. activates when the GitOps reconciler (roadmap) emits K8s manifests.
Sample policies are included as documentation at adapters/kyverno/policies/. Sample policies are included as documentation at adapters/kyverno/policies/.
CLI: kyverno_adapter.py <policyreport.json> <contract-id> [--kube-version <ver>] CLI: kyverno_adapter.py <policyreport.json> <contract-id>
""" """
import datetime import datetime
@@ -100,7 +103,7 @@ def _emit_inactive_tf(contract_id):
} }
def adapt(policyreport_json_path, contract_id, kube_version=None): def adapt(policyreport_json_path, contract_id):
with open(policyreport_json_path, "r", encoding="utf-8") as fh: with open(policyreport_json_path, "r", encoding="utf-8") as fh:
data = json.load(fh) data = json.load(fh)
out = [] out = []
@@ -112,8 +115,6 @@ def adapt(policyreport_json_path, contract_id, kube_version=None):
out.append(_to_pcr(entry, contract_id)) out.append(_to_pcr(entry, contract_id))
if not out: if not out:
out.append(_emit_inactive_tf(contract_id)) out.append(_emit_inactive_tf(contract_id))
# kube_version is parsed but not yet used (future GitOps reconciler).
_ = kube_version
return out return out
@@ -123,14 +124,8 @@ def adapt_inactive(contract_id):
if __name__ == "__main__": if __name__ == "__main__":
kube_ver = None
args = sys.argv[1:] args = sys.argv[1:]
if "--kube-version" in args:
idx = args.index("--kube-version")
if idx + 1 < len(args):
kube_ver = args[idx + 1]
args = args[:idx] + args[idx + 2:]
if len(args) != 2: if len(args) != 2:
print("usage: kyverno_adapter.py <policyreport.json> <contract-id> [--kube-version <ver>]", file=sys.stderr) print("usage: kyverno_adapter.py <policyreport.json> <contract-id>", file=sys.stderr)
sys.exit(2) sys.exit(2)
print(json.dumps(adapt(args[0], args[1], kube_version=kube_ver), indent=2)) print(json.dumps(adapt(args[0], args[1]), indent=2))
+5 -3
View File
@@ -211,11 +211,13 @@ class TestFleshedOutTranslator:
assert pcrs[0]["result"] == "skipped" assert pcrs[0]["result"] == "skipped"
assert "Terraform" in pcrs[0]["message"] assert "Terraform" in pcrs[0]["message"]
def test_kube_version_parsed(self, tmp_path): def test_kube_version_removed(self, tmp_path):
"""--kube-version is parsed but not yet used (future GitOps).""" """v1.14 (G-103): --kube-version flag removed; adapt() no longer
accepts kube_version parameter. Version-aware policy selection
deferred to GitOps reconciler (D-053)."""
f = tmp_path / "k.json" f = tmp_path / "k.json"
f.write_text(json.dumps({"results": [ f.write_text(json.dumps({"results": [
{"policy": "p", "rule": "r", "severity": "low", "result": "pass", "resource": "x"}, {"policy": "p", "rule": "r", "severity": "low", "result": "pass", "resource": "x"},
]})) ]}))
results = adapt(str(f), "c8", kube_version="1.28") results = adapt(str(f), "c8")
assert len(results) == 1 assert len(results) == 1
+35
View File
@@ -0,0 +1,35 @@
"""v1.14 (REQ-146): no credential-looking files are tracked by git."""
import subprocess
import sys
from pathlib import Path
import pytest
ROOT = Path(__file__).resolve().parent.parent
CREDENTIAL_EXTENSIONS = [".pem", ".key", ".p12", ".pfx", ".cer", ".crt", ".jks", ".keystore"]
def test_no_credential_files_tracked():
"""Assert no file with a credential extension is tracked by git."""
result = subprocess.run(
["git", "ls-files"],
cwd=str(ROOT),
capture_output=True,
text=True,
)
if result.returncode != 0:
pytest.skip("git not available or not a repo")
tracked = result.stdout.strip().split("\n")
cred_files = [
f for f in tracked
if any(f.endswith(ext) for ext in CREDENTIAL_EXTENSIONS)
]
assert cred_files == [], f"credential files tracked by git: {cred_files}"
def test_gitignore_has_credential_patterns():
"""Assert .gitignore contains the credential-pattern catch-all."""
gitignore = (ROOT / ".gitignore").read_text()
for ext in [".pem", ".key", ".p12", ".pfx"]:
assert f"*{ext}" in gitignore, f".gitignore missing credential pattern *{ext}"