Use read-only Prometheus requests and record reproducible security measurements

This commit is contained in:
2026-11-16 13:13:46 +03:00
parent 4776d41dfe
commit 5aad71bdf9
4 changed files with 49 additions and 2 deletions
+3 -1
View File
@@ -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):
+44
View File
@@ -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()
+1
View File
@@ -326,6 +326,7 @@ def main():
}
if name == "prometheus":
item["isDefault"] = True
item["jsonData"]["httpMethod"] = "GET"
if name == "loki":
item["jsonData"]["derivedFields"] = [
{
+1 -1
View File
@@ -207,7 +207,7 @@ def main():
"--no-deps",
"-e",
"OTEL_ENABLED=0",
"worker",
"api",
"python",
"-m",
"messenger.kdf_probe",