# lab7-security: lab7: HTTPS only, headers, outsider ACL, logout, shared login rate limit, size limits, Argon2id, rehash, no credential leaks
# date: 2026-11-07 19:08:02, commit: 20afc2c + uncommitted changes
# command: python.exe student-tests/test_lab7_security.py
# exit code: 0, 17.3 s

port 8080: closed
empty trust store: rejected by certificate verification (unable to get local issuer certificate)
foreign CA: rejected by certificate verification (unable to get local issuer certificate)
wrong host name: rejected by certificate verification (Hostname mismatch, certificate is not valid for 'evil.example'.)
PASS: only HTTPS on 8443; untrusted CA and wrong host name fail certificate verification
HSTS, nosniff, no Server header; X-Instance-Id is an opaque alias (c4ba1764f1a3)
PASS: security headers
outsider: 6 attempts on a foreign chat/attachment -> 404 (existence not revealed); X-User-Id of the victim is ignored
PASS: ACL — outsider reads/writes nothing, cannot attach a foreign file
PASS: logout -> the same token is 401 on every replica (session deleted in shared Redis)
codes [401, 401, 401, 401, 401, 401, 401, 401, 401, 429, 429, 429, 429, 429]; answered by replicas ['76a44da5ae93', 'c4ba1764f1a3']; Retry-After 60 s
PASS: login rate limit is shared by all replicas (Redis), 429 + Retry-After, before Argon2id
JSON > 64 KiB -> 413 (with Content-Length and chunked); upload Content-Length 50 MB -> 413 at the LB
PASS: request size limits
stored: $argon2id$v=19$m=32768,t=2,p=1$<16-byte salt>$<hash>; two users with the same password have different hashes
PASS: Argon2id with salt and parameters in the stored string
legacy hash m=12288,t=3 -> after successful login m=32768,t=2,p=1; the new hash still verifies
PASS: old password hash is upgraded on successful login
errors do not echo credentials; Redis stores session:<SHA-256(token)> only; DB stores only the hash
PASS: credentials and session tokens are not revealed
9 passed, 0 failed
