lab7: исправления по прогону своих тестов (таймаут Valkey с TLS 1,0 с, проверки по alias, GET вместо EXISTS), черновик REPORT, сборщик доказательств

This commit is contained in:
Alexey Bodanyuk
2026-11-28 01:33:01 +03:00
parent 84dbdb4735
commit b3ddcf25dc
6 changed files with 167 additions and 23 deletions
+2 -1
View File
@@ -120,7 +120,8 @@ def test_secrets_are_not_stored_in_plain_text(api):
hashed = "session:" + hashlib.sha256(actor["token"].encode()).hexdigest()
script = ('read -r REDISCLI_AUTH; export REDISCLI_AUTH; read -r k1; read -r k2; '
'c="valkey-cli --tls --cacert /run/secrets/internal-ca.crt -h localhost --user api --no-auth-warning"; '
'$c exists "$k1"; $c exists "$k2"')
# GET, not EXISTS: the ACL of `api` allows only the commands the API uses
'for k in "$k1" "$k2"; do [ -n "$($c get "$k")" ] && echo 1 || echo 0; done')
pw = (ROOT / "secrets" / "valkey_api_password").read_text(encoding="utf-8").strip()
out = subprocess.run(["docker", "compose", "exec", "-T", "valkey", "sh", "-c", script], cwd=ROOT, capture_output=True,
input=f"{pw}\n{hashed}\nsession:{actor['token']}\n".encode()).stdout.decode().split()