diff --git a/research/auth_budget.py b/research/auth_budget.py index 4599799..638449f 100644 --- a/research/auth_budget.py +++ b/research/auth_budget.py @@ -66,7 +66,9 @@ def main(): time.sleep(10.2) wrong = ( "Basic " - + base64.b64encode((actor["registration"]["username"] + ":incorrect").encode()).decode() + + base64.b64encode( + (actor["registration"]["username"] + ":incorrect-password-for-budget").encode() + ).decode() ) rows = [] for _ in range(12): diff --git a/research/readiness.py b/research/readiness.py new file mode 100644 index 0000000..e84c8a4 --- /dev/null +++ b/research/readiness.py @@ -0,0 +1,44 @@ +#!/usr/bin/env python3 +"""Concurrent health probes detect starvation without retrying readiness failures.""" + +import collections +import concurrent.futures +import json +import ssl +import urllib.error +import urllib.request +from pathlib import Path + +ROOT = Path(__file__).resolve().parents[1] + + +def main(): + context = ssl.create_default_context(cafile=str(ROOT / "secrets/ca.pem")) + + def one(_): + try: + with urllib.request.urlopen( + "https://localhost:8447/health/ready", context=context, timeout=8 + ) as response: + return str(response.status) + except urllib.error.HTTPError as exc: + return str(exc.code) + except OSError: + return "connection_error" + + with concurrent.futures.ThreadPoolExecutor(max_workers=8) as pool: + counts = dict(collections.Counter(pool.map(one, range(64)))) + result = { + "concurrency": 8, + "requests": 64, + "status_counts": counts, + "passed": counts == {"200": 64}, + } + (ROOT / "evidence/readiness-concurrency.json").write_text(json.dumps(result, indent=2) + "\n") + print(json.dumps(result)) + if not result["passed"]: + raise SystemExit(1) + + +if __name__ == "__main__": + main() diff --git a/scripts/bootstrap.py b/scripts/bootstrap.py index 7234999..7642bbb 100644 --- a/scripts/bootstrap.py +++ b/scripts/bootstrap.py @@ -326,6 +326,7 @@ def main(): } if name == "prometheus": item["isDefault"] = True + item["jsonData"]["httpMethod"] = "GET" if name == "loki": item["jsonData"]["derivedFields"] = [ { diff --git a/scripts/security_checks.py b/scripts/security_checks.py index 40342f8..2445c08 100644 --- a/scripts/security_checks.py +++ b/scripts/security_checks.py @@ -207,7 +207,7 @@ def main(): "--no-deps", "-e", "OTEL_ENABLED=0", - "worker", + "api", "python", "-m", "messenger.kdf_probe",