forked from mtusi2026/mtusi2026lab7
ЛР7
This commit is contained in:
@@ -0,0 +1,131 @@
|
||||
docker compose --profile tools run --rm sectest student-tests/acl_matrix.py
|
||||
Container mtusi-lab7-sectest-run-be9f379b896e Creating
|
||||
Container mtusi-lab7-sectest-run-be9f379b896e Created
|
||||
ACL matrix (lab7): what each identity may do
|
||||
============================================
|
||||
|
||||
## OpenBao: cert auth roles and KV policies
|
||||
OK api login role messenger-api expect allow got HTTP 200 policies=['default', 'messenger-api']
|
||||
OK api token has no root/admin policy expect own got default,messenger-api
|
||||
OK worker login role messenger-worker expect allow got HTTP 200 policies=['default', 'messenger-worker']
|
||||
OK worker token has no root/admin policy expect own got default,messenger-worker
|
||||
OK worker login role messenger-api expect deny got HTTP 400
|
||||
OK api login role messenger-worker expect deny got HTTP 400
|
||||
OK lb login role messenger-api expect deny got HTTP 400
|
||||
OK intruder login role messenger-api expect deny got HTTP 400
|
||||
OK intruder login role messenger-worker expect deny got HTTP 400
|
||||
OK api read own KV path expect allow got HTTP 200
|
||||
OK api read worker KV path expect deny got HTTP 403
|
||||
OK api write own KV path expect deny got HTTP 403
|
||||
OK api list KV paths expect deny got HTTP 403
|
||||
OK api read KV metadata/versions expect deny got HTTP 403
|
||||
OK api rewrite own policy expect deny got HTTP 403
|
||||
OK api read policies expect deny got HTTP 403
|
||||
OK api list secret engines expect deny got HTTP 403
|
||||
OK api list cert auth roles expect deny got HTTP 403
|
||||
OK api create token with more policies expect deny got HTTP 403
|
||||
OK worker read own KV path expect allow got HTTP 200
|
||||
OK worker read api KV path expect deny got HTTP 403
|
||||
OK worker write own KV path expect deny got HTTP 403
|
||||
OK worker list KV paths expect deny got HTTP 403
|
||||
OK worker read KV metadata/versions expect deny got HTTP 403
|
||||
OK worker rewrite own policy expect deny got HTTP 403
|
||||
OK worker read policies expect deny got HTTP 403
|
||||
OK worker list secret engines expect deny got HTTP 403
|
||||
OK worker list cert auth roles expect deny got HTTP 403
|
||||
OK worker create token with more policies expect deny got HTTP 403
|
||||
OK worker secret has no Valkey/admin credentials expect none got db_password,s3_access_key_id,s3_secret_access_key
|
||||
|
||||
## PostgreSQL: roles messenger_api / messenger_worker
|
||||
OK api connect as messenger_api (TLS verify-full) expect allow got connected
|
||||
OK api SELECT users expect allow got executed (rolled back)
|
||||
OK api SELECT messages expect allow got executed (rolled back)
|
||||
OK api SELECT sessions expect allow got executed (rolled back)
|
||||
OK api UPDATE chats expect allow got executed (rolled back)
|
||||
OK api DELETE outbox expect allow got executed (rolled back)
|
||||
OK api DELETE users expect deny got permission denied
|
||||
OK api DELETE messages expect deny got permission denied
|
||||
OK api DELETE schema_migrations expect deny got permission denied
|
||||
OK api TRUNCATE outbox expect deny got permission denied
|
||||
OK api CREATE TABLE expect deny got permission denied
|
||||
OK api ALTER TABLE users expect deny got permission denied
|
||||
OK api DROP TABLE expect deny got permission denied
|
||||
OK api CREATE ROLE expect deny got permission denied
|
||||
OK worker connect as messenger_worker (TLS verify-full) expect allow got connected
|
||||
OK worker SELECT attachments expect allow got executed (rolled back)
|
||||
OK worker SELECT attachment_jobs expect allow got executed (rolled back)
|
||||
OK worker UPDATE attachments expect allow got executed (rolled back)
|
||||
OK worker DELETE outbox expect allow got executed (rolled back)
|
||||
OK worker SELECT users (password hashes) expect deny got permission denied
|
||||
OK worker SELECT sessions expect deny got permission denied
|
||||
OK worker SELECT chats expect deny got permission denied
|
||||
OK worker SELECT chat_members expect deny got permission denied
|
||||
OK worker SELECT messages expect deny got permission denied
|
||||
OK worker SELECT message_attachments expect deny got permission denied
|
||||
OK worker DELETE attachments expect deny got permission denied
|
||||
OK worker TRUNCATE attachment_jobs expect deny got permission denied
|
||||
OK worker CREATE TABLE expect deny got permission denied
|
||||
OK worker ALTER TABLE attachments expect deny got permission denied
|
||||
OK api api password as role messenger_worker expect deny got authentication failed
|
||||
OK worker worker password as role messenger_api expect deny got authentication failed
|
||||
OK api api password as role messenger expect deny got authentication failed
|
||||
OK worker worker password as role messenger expect deny got authentication failed
|
||||
OK worker worker password as role postgres expect deny got rejected by pg_hba.conf
|
||||
|
||||
## S3: prefixes in bucket messenger-attachments
|
||||
OK api PUT staging/<id> expect allow got allowed
|
||||
OK api GET staging/<id> (unchecked upload) expect deny got AccessDenied
|
||||
OK api PUT originals/<id> (forge original) expect deny got AccessDenied
|
||||
OK api PUT variants/<id>/... (forge variant) expect deny got AccessDenied
|
||||
OK api LIST bucket expect deny got AccessDenied
|
||||
OK worker GET staging/<id> expect allow got allowed
|
||||
OK worker PUT originals/<id> expect allow got allowed
|
||||
OK worker PUT variants/<id>/... expect allow got allowed
|
||||
OK worker LIST bucket expect allow got allowed
|
||||
OK worker GET variants/<id>/... (not its job) expect deny got AccessDenied
|
||||
OK api GET originals/<id> expect allow got allowed
|
||||
OK api GET variants/<id>/... expect allow got allowed
|
||||
OK api DELETE originals/<id> expect deny got AccessDenied
|
||||
OK api CREATE bucket expect deny got AccessDenied
|
||||
OK api DELETE other bucket expect deny got AccessDenied
|
||||
OK worker CREATE bucket expect deny got AccessDenied
|
||||
OK worker DELETE other bucket expect deny got AccessDenied
|
||||
OK api see other buckets (ListBuckets) expect deny got sees []
|
||||
OK worker see other buckets (ListBuckets) expect deny got sees ['messenger-attachments']
|
||||
|
||||
## RabbitMQ: users = certificate CN (SASL EXTERNAL), vhost messenger
|
||||
OK api publish to exchange attachments expect allow got published (unroutable, dropped)
|
||||
OK api publish to exchange attachments.dlx expect deny got 403 ACCESS_REFUSED
|
||||
OK api publish to default exchange expect deny got 403 ACCESS_REFUSED
|
||||
OK api read queue attachments.process expect deny got 403 ACCESS_REFUSED
|
||||
OK api read queue attachments.dead expect deny got 403 ACCESS_REFUSED
|
||||
OK api declare own queue expect deny got 403 ACCESS_REFUSED
|
||||
OK api declare exchange expect deny got 403 ACCESS_REFUSED
|
||||
OK api delete queue attachments.process expect deny got 403 ACCESS_REFUSED
|
||||
OK worker read queue attachments.process expect allow got read allowed (queue empty)
|
||||
OK worker read queue attachments.dead expect deny got 403 ACCESS_REFUSED
|
||||
OK worker publish to exchange attachments expect deny got 403 ACCESS_REFUSED
|
||||
OK worker publish to exchange attachments.dlx expect deny got 403 ACCESS_REFUSED
|
||||
OK worker declare own queue expect deny got 403 ACCESS_REFUSED
|
||||
OK worker declare exchange expect deny got 403 ACCESS_REFUSED
|
||||
OK worker delete queue attachments.process expect deny got 403 ACCESS_REFUSED
|
||||
|
||||
## Valkey: ACL users messenger / health / default
|
||||
OK api SET/GET sess:* (session cache) expect allow got allowed
|
||||
OK api INCRBY rl:* (rate limit counter) expect allow got allowed
|
||||
OK api SET key outside sess:*/rl:* expect deny got NOPERM
|
||||
OK api KEYS * (enumerate sessions) expect deny got NOPERM
|
||||
OK api SCAN expect deny got NOPERM
|
||||
OK api FLUSHALL expect deny got NOPERM
|
||||
OK api CONFIG GET * expect deny got NOPERM
|
||||
OK api ACL LIST expect deny got NOPERM
|
||||
OK api EVAL (Lua) expect deny got NOPERM
|
||||
OK api PUBLISH expect deny got NOPERM
|
||||
OK health PING expect allow got allowed
|
||||
OK health GET sess:* expect deny got NOPERM
|
||||
OK anonymous PING without AUTH (default user off) expect deny got AuthenticationError
|
||||
OK anonymous GET sess:* without AUTH expect deny got AuthenticationError
|
||||
OK anonymous AUTH default <api password> expect deny got AuthenticationError
|
||||
OK worker worker has no Valkey credentials expect deny got absent
|
||||
|
||||
PASS: 114 checks
|
||||
@@ -0,0 +1,6 @@
|
||||
docker compose exec -T api python - < student-tests/argon2_bench.py
|
||||
m, MiB t p median ms p95 ms logins/s per core
|
||||
19 2 1 25.9 28.6 38.6
|
||||
19 3 1 37.6 46.7 26.6
|
||||
46 1 1 69.4 96.5 14.4
|
||||
64 2 1 127.2 159.1 7.9
|
||||
@@ -0,0 +1,30 @@
|
||||
python student-tests/check_stack.py
|
||||
docker: 29.6.2
|
||||
compose: 5.3.1
|
||||
api replicas running: 2; container_name not set anywhere
|
||||
|
||||
service cpus mem user ro caps added published
|
||||
api 1.00 384Mi 10001 yes - -
|
||||
loki 1.00 512Mi 10001 yes - -
|
||||
prometheus 1.00 512Mi 65534 yes - -
|
||||
openbao 0.50 256Mi 10001 yes - -
|
||||
otlp-gw 0.25 64Mi 99 yes - -
|
||||
grafana 1.00 512Mi 472 yes - 127.0.0.1:3000
|
||||
tsdb-gw 0.25 64Mi 99 yes - -
|
||||
broker 1.00 512Mi 0 no CHOWN,DAC_OVERRIDE,FOWNER,SETGID,SETUID -
|
||||
s3 0.50 512Mi 1000 yes - -
|
||||
tempo 1.00 512Mi 10001 yes - -
|
||||
postgres 1.00 512Mi 0 no CHOWN,DAC_OVERRIDE,FOWNER,SETGID,SETUID -
|
||||
valkey 0.50 128Mi 999 yes - -
|
||||
otel-collector 0.50 512Mi OCI runtime exec failed: exec failed: unable to start container process: exec: "id": executable file not found in $PATH yes - -
|
||||
worker 1.00 1024Mi 10001 yes - -
|
||||
api 1.00 384Mi 10001 yes - -
|
||||
lb 0.50 128Mi 99 yes - 127.0.0.1:8404, 127.0.0.1:8443, 127.0.0.1:8444
|
||||
|
||||
published: lb 127.0.0.1:8443 (HTTPS API), :8444 (short TTL), :8404 (stats, HTTPS); grafana 127.0.0.1:3000 (HTTPS). api, OpenBao, Prometheus, Loki, Tempo, Collector, stores: none
|
||||
hardening: no privileged/host namespaces/Docker socket; no-new-privileges and cap_drop ALL everywhere; cap_add only for broker, openbao-init, postgres, tempo-init; read-only root except broker, openbao-init, postgres, tempo-init; api/worker are not root; CPU/RAM limits everywhere
|
||||
networks: only public (lb) and ops (grafana) are not internal; lb: edge+public+telemetry; api: backend+edge+otlp+vault; worker: backend+otlp+vault; postgres: backend; valkey: backend; s3: backend; broker: backend; openbao: vault; otlp-gw: otlp+telemetry; prometheus: telemetry; tsdb-gw: telemetry; grafana: ops+telemetry
|
||||
balancer: every api server under the /health/ready check over mTLS, no backup servers
|
||||
secrets: api and worker get NO Docker secrets and no token variables (only their TLS identity -> OpenBao cert auth); migrate -> postgres_password; postgres -> db_api_password, db_worker_password, postgres_password; valkey -> valkey_acl; s3 -> s3_config; s3-init -> s3_root_password, s3_root_user; grafana -> grafana_admin_password
|
||||
images: broker rabbitmq:4.2.9-alpine; grafana grafana/grafana:12.2.1; lb haproxy:3.2.25-alpine; loki grafana/loki:3.5.8; openbao openbao/openbao:2.4.4; otel-collector otel/opentelemetry-collector-contrib:0.140.1; otlp-gw haproxy:3.2.25-alpine; postgres postgres:17.10-bookworm; prometheus prom/prometheus:v3.7.3; s3 chrislusf/seaweedfs:4.44; tempo grafana/tempo:2.9.0; tempo-init grafana/tempo:2.9.0; tsdb-gw haproxy:3.2.25-alpine; valkey valkey/valkey:8.1.9
|
||||
PASS: hardening, ports, networks, per-service secrets and TLS identities match the trust matrix
|
||||
@@ -0,0 +1,21 @@
|
||||
python -m pip_audit -r requirements.txt --no-deps --disable-pip --progress-spinner off
|
||||
WARNING:pip_audit._cli:--no-deps is supported, but users are encouraged to fully hash their pinned dependencies
|
||||
WARNING:pip_audit._cli:Consider using a tool like `pip-compile`: https://pip-tools.readthedocs.io/en/latest/#using-hashes
|
||||
Found 14 known vulnerabilities in 1 package
|
||||
Name Version ID Fix Versions
|
||||
--------- ------- --------------- ------------
|
||||
starlette 0.46.2 PYSEC-2026-1941 0.47.2
|
||||
starlette 0.46.2 PYSEC-2026-1942 0.49.1
|
||||
starlette 0.46.2 PYSEC-2026-161 1.0.1
|
||||
starlette 0.46.2 PYSEC-2026-161 1.0.1
|
||||
starlette 0.46.2 PYSEC-2026-2281 1.1.0
|
||||
starlette 0.46.2 PYSEC-2026-2280 1.1.0
|
||||
starlette 0.46.2 PYSEC-2026-249 1.3.1
|
||||
starlette 0.46.2 PYSEC-2026-248 1.3.0
|
||||
starlette 0.46.2 PYSEC-2026-249 1.3.1
|
||||
starlette 0.46.2 PYSEC-2026-248 1.3.0
|
||||
starlette 0.46.2 PYSEC-2026-1942 0.49.1
|
||||
starlette 0.46.2 PYSEC-2026-1941 0.47.2
|
||||
starlette 0.46.2 PYSEC-2026-2281 1.1.0
|
||||
starlette 0.46.2 PYSEC-2026-2280 1.1.0
|
||||
make: *** [Makefile:162: scan-deps] Error 1
|
||||
@@ -0,0 +1,4 @@
|
||||
python tests/resilience.py --mode failover --action-script "scripts/stop-one.cmd" --base-url "https://127.0.0.1:8443" --ca-file "secrets/tls/ca/ca.crt"
|
||||
Executing explicit failover hook; hook output suppressed to avoid leaking secrets.
|
||||
{"observed_instances_before": 2, "successful_writes": 113, "failed_attempts": 0, "first_recovery_seconds": 5.703}
|
||||
PASS: failover preserved confirmed data and existing session. Hook scope needs operator evidence.
|
||||
@@ -0,0 +1,175 @@
|
||||
|
||||
Report Summary
|
||||
|
||||
┌──────────────────────────────────────────────────────────────────────────────────┬────────────┬─────────────────┐
|
||||
│ Target │ Type │ Vulnerabilities │
|
||||
├──────────────────────────────────────────────────────────────────────────────────┼────────────┼─────────────────┤
|
||||
│ /scan/app.tar (debian 12.15) │ debian │ 0 │
|
||||
├──────────────────────────────────────────────────────────────────────────────────┼────────────┼─────────────────┤
|
||||
│ usr/local/lib/python3.12/site-packages/annotated_types-0.8.0.dist-info/METADATA │ python-pkg │ 0 │
|
||||
├──────────────────────────────────────────────────────────────────────────────────┼────────────┼─────────────────┤
|
||||
│ usr/local/lib/python3.12/site-packages/anyio-4.15.1.dist-info/METADATA │ python-pkg │ 0 │
|
||||
├──────────────────────────────────────────────────────────────────────────────────┼────────────┼─────────────────┤
|
||||
│ usr/local/lib/python3.12/site-packages/argon2_cffi-25.1.0.dist-info/METADATA │ python-pkg │ 0 │
|
||||
├──────────────────────────────────────────────────────────────────────────────────┼────────────┼─────────────────┤
|
||||
│ usr/local/lib/python3.12/site-packages/argon2_cffi_bindings-26.1.0.dist-info/ME- │ python-pkg │ 0 │
|
||||
│ TADATA │ │ │
|
||||
├──────────────────────────────────────────────────────────────────────────────────┼────────────┼─────────────────┤
|
||||
│ usr/local/lib/python3.12/site-packages/asgiref-3.13.0.dist-info/METADATA │ python-pkg │ 0 │
|
||||
├──────────────────────────────────────────────────────────────────────────────────┼────────────┼─────────────────┤
|
||||
│ usr/local/lib/python3.12/site-packages/boto3-1.43.116.dist-info/METADATA │ python-pkg │ 0 │
|
||||
├──────────────────────────────────────────────────────────────────────────────────┼────────────┼─────────────────┤
|
||||
│ usr/local/lib/python3.12/site-packages/botocore-1.43.116.dist-info/METADATA │ python-pkg │ 0 │
|
||||
├──────────────────────────────────────────────────────────────────────────────────┼────────────┼─────────────────┤
|
||||
│ usr/local/lib/python3.12/site-packages/certifi-2026.10.23.dist-info/METADATA │ python-pkg │ 0 │
|
||||
├──────────────────────────────────────────────────────────────────────────────────┼────────────┼─────────────────┤
|
||||
│ usr/local/lib/python3.12/site-packages/cffi-2.1.1.dist-info/METADATA │ python-pkg │ 0 │
|
||||
├──────────────────────────────────────────────────────────────────────────────────┼────────────┼─────────────────┤
|
||||
│ usr/local/lib/python3.12/site-packages/charset_normalizer-3.5.2.dist-info/METAD- │ python-pkg │ 0 │
|
||||
│ ATA │ │ │
|
||||
├──────────────────────────────────────────────────────────────────────────────────┼────────────┼─────────────────┤
|
||||
│ usr/local/lib/python3.12/site-packages/click-8.5.0.dist-info/METADATA │ python-pkg │ 0 │
|
||||
├──────────────────────────────────────────────────────────────────────────────────┼────────────┼─────────────────┤
|
||||
│ usr/local/lib/python3.12/site-packages/cryptography-50.0.2.dist-info/METADATA │ python-pkg │ 0 │
|
||||
├──────────────────────────────────────────────────────────────────────────────────┼────────────┼─────────────────┤
|
||||
│ usr/local/lib/python3.12/site-packages/fastapi-0.115.12.dist-info/METADATA │ python-pkg │ 0 │
|
||||
├──────────────────────────────────────────────────────────────────────────────────┼────────────┼─────────────────┤
|
||||
│ usr/local/lib/python3.12/site-packages/googleapis_common_protos-1.76.0.dist-inf- │ python-pkg │ 0 │
|
||||
│ o/METADATA │ │ │
|
||||
├──────────────────────────────────────────────────────────────────────────────────┼────────────┼─────────────────┤
|
||||
│ usr/local/lib/python3.12/site-packages/h11-0.16.0.dist-info/METADATA │ python-pkg │ 0 │
|
||||
├──────────────────────────────────────────────────────────────────────────────────┼────────────┼─────────────────┤
|
||||
│ usr/local/lib/python3.12/site-packages/idna-3.20.dist-info/METADATA │ python-pkg │ 0 │
|
||||
├──────────────────────────────────────────────────────────────────────────────────┼────────────┼─────────────────┤
|
||||
│ usr/local/lib/python3.12/site-packages/jmespath-1.1.0.dist-info/METADATA │ python-pkg │ 0 │
|
||||
├──────────────────────────────────────────────────────────────────────────────────┼────────────┼─────────────────┤
|
||||
│ usr/local/lib/python3.12/site-packages/numpy-2.3.5.dist-info/METADATA │ python-pkg │ 0 │
|
||||
├──────────────────────────────────────────────────────────────────────────────────┼────────────┼─────────────────┤
|
||||
│ usr/local/lib/python3.12/site-packages/opentelemetry_api-1.45.2.dist-info/METAD- │ python-pkg │ 0 │
|
||||
│ ATA │ │ │
|
||||
├──────────────────────────────────────────────────────────────────────────────────┼────────────┼─────────────────┤
|
||||
│ usr/local/lib/python3.12/site-packages/opentelemetry_exporter_http_transport-0.- │ python-pkg │ 0 │
|
||||
│ 66b2.dist-info/METADATA │ │ │
|
||||
├──────────────────────────────────────────────────────────────────────────────────┼────────────┼─────────────────┤
|
||||
│ usr/local/lib/python3.12/site-packages/opentelemetry_exporter_otlp_common-0.66b- │ python-pkg │ 0 │
|
||||
│ 2.dist-info/METADATA │ │ │
|
||||
├──────────────────────────────────────────────────────────────────────────────────┼────────────┼─────────────────┤
|
||||
│ usr/local/lib/python3.12/site-packages/opentelemetry_exporter_otlp_proto_common- │ python-pkg │ 0 │
|
||||
│ -1.45.2.dist-info/METADATA │ │ │
|
||||
├──────────────────────────────────────────────────────────────────────────────────┼────────────┼─────────────────┤
|
||||
│ usr/local/lib/python3.12/site-packages/opentelemetry_exporter_otlp_proto_http-1- │ python-pkg │ 0 │
|
||||
│ .45.2.dist-info/METADATA │ │ │
|
||||
├──────────────────────────────────────────────────────────────────────────────────┼────────────┼─────────────────┤
|
||||
│ usr/local/lib/python3.12/site-packages/opentelemetry_instrumentation-0.66b2.dis- │ python-pkg │ 0 │
|
||||
│ t-info/METADATA │ │ │
|
||||
├──────────────────────────────────────────────────────────────────────────────────┼────────────┼─────────────────┤
|
||||
│ usr/local/lib/python3.12/site-packages/opentelemetry_instrumentation_asgi-0.66b- │ python-pkg │ 0 │
|
||||
│ 2.dist-info/METADATA │ │ │
|
||||
├──────────────────────────────────────────────────────────────────────────────────┼────────────┼─────────────────┤
|
||||
│ usr/local/lib/python3.12/site-packages/opentelemetry_instrumentation_botocore-0- │ python-pkg │ 0 │
|
||||
│ .66b2.dist-info/METADATA │ │ │
|
||||
├──────────────────────────────────────────────────────────────────────────────────┼────────────┼─────────────────┤
|
||||
│ usr/local/lib/python3.12/site-packages/opentelemetry_instrumentation_dbapi-0.66- │ python-pkg │ 0 │
|
||||
│ b2.dist-info/METADATA │ │ │
|
||||
├──────────────────────────────────────────────────────────────────────────────────┼────────────┼─────────────────┤
|
||||
│ usr/local/lib/python3.12/site-packages/opentelemetry_instrumentation_fastapi-0.- │ python-pkg │ 0 │
|
||||
│ 66b2.dist-info/METADATA │ │ │
|
||||
├──────────────────────────────────────────────────────────────────────────────────┼────────────┼─────────────────┤
|
||||
│ usr/local/lib/python3.12/site-packages/opentelemetry_instrumentation_logging-0.- │ python-pkg │ 0 │
|
||||
│ 66b2.dist-info/METADATA │ │ │
|
||||
├──────────────────────────────────────────────────────────────────────────────────┼────────────┼─────────────────┤
|
||||
│ usr/local/lib/python3.12/site-packages/opentelemetry_instrumentation_psycopg-0.- │ python-pkg │ 0 │
|
||||
│ 66b2.dist-info/METADATA │ │ │
|
||||
├──────────────────────────────────────────────────────────────────────────────────┼────────────┼─────────────────┤
|
||||
│ usr/local/lib/python3.12/site-packages/opentelemetry_instrumentation_system_met- │ python-pkg │ 0 │
|
||||
│ rics-0.66b2.dist-info/METADATA │ │ │
|
||||
├──────────────────────────────────────────────────────────────────────────────────┼────────────┼─────────────────┤
|
||||
│ usr/local/lib/python3.12/site-packages/opentelemetry_propagator_aws_xray-1.0.2.- │ python-pkg │ 0 │
|
||||
│ dist-info/METADATA │ │ │
|
||||
├──────────────────────────────────────────────────────────────────────────────────┼────────────┼─────────────────┤
|
||||
│ usr/local/lib/python3.12/site-packages/opentelemetry_proto-1.45.2.dist-info/MET- │ python-pkg │ 0 │
|
||||
│ ADATA │ │ │
|
||||
├──────────────────────────────────────────────────────────────────────────────────┼────────────┼─────────────────┤
|
||||
│ usr/local/lib/python3.12/site-packages/opentelemetry_sdk-1.45.2.dist-info/METAD- │ python-pkg │ 0 │
|
||||
│ ATA │ │ │
|
||||
├──────────────────────────────────────────────────────────────────────────────────┼────────────┼─────────────────┤
|
||||
│ usr/local/lib/python3.12/site-packages/opentelemetry_semantic_conventions-0.66b- │ python-pkg │ 0 │
|
||||
│ 2.dist-info/METADATA │ │ │
|
||||
├──────────────────────────────────────────────────────────────────────────────────┼────────────┼─────────────────┤
|
||||
│ usr/local/lib/python3.12/site-packages/opentelemetry_util_http-0.66b2.dist-info- │ python-pkg │ 0 │
|
||||
│ /METADATA │ │ │
|
||||
├──────────────────────────────────────────────────────────────────────────────────┼────────────┼─────────────────┤
|
||||
│ usr/local/lib/python3.12/site-packages/packaging-26.3.dist-info/METADATA │ python-pkg │ 0 │
|
||||
├──────────────────────────────────────────────────────────────────────────────────┼────────────┼─────────────────┤
|
||||
│ usr/local/lib/python3.12/site-packages/pika-1.4.4.dist-info/METADATA │ python-pkg │ 0 │
|
||||
├──────────────────────────────────────────────────────────────────────────────────┼────────────┼─────────────────┤
|
||||
│ usr/local/lib/python3.12/site-packages/pillow-13.0.0.dist-info/METADATA │ python-pkg │ 0 │
|
||||
├──────────────────────────────────────────────────────────────────────────────────┼────────────┼─────────────────┤
|
||||
│ usr/local/lib/python3.12/site-packages/pip-24.3.1.dist-info/METADATA │ python-pkg │ 0 │
|
||||
├──────────────────────────────────────────────────────────────────────────────────┼────────────┼─────────────────┤
|
||||
│ usr/local/lib/python3.12/site-packages/protobuf-7.36.2.dist-info/METADATA │ python-pkg │ 0 │
|
||||
├──────────────────────────────────────────────────────────────────────────────────┼────────────┼─────────────────┤
|
||||
│ usr/local/lib/python3.12/site-packages/psutil-7.2.2.dist-info/METADATA │ python-pkg │ 0 │
|
||||
├──────────────────────────────────────────────────────────────────────────────────┼────────────┼─────────────────┤
|
||||
│ usr/local/lib/python3.12/site-packages/psycopg-3.3.6.dist-info/METADATA │ python-pkg │ 0 │
|
||||
├──────────────────────────────────────────────────────────────────────────────────┼────────────┼─────────────────┤
|
||||
│ usr/local/lib/python3.12/site-packages/psycopg_binary-3.3.6.dist-info/METADATA │ python-pkg │ 0 │
|
||||
├──────────────────────────────────────────────────────────────────────────────────┼────────────┼─────────────────┤
|
||||
│ usr/local/lib/python3.12/site-packages/psycopg_pool-3.3.3.dist-info/METADATA │ python-pkg │ 0 │
|
||||
├──────────────────────────────────────────────────────────────────────────────────┼────────────┼─────────────────┤
|
||||
│ usr/local/lib/python3.12/site-packages/pycparser-3.1.dist-info/METADATA │ python-pkg │ 0 │
|
||||
├──────────────────────────────────────────────────────────────────────────────────┼────────────┼─────────────────┤
|
||||
│ usr/local/lib/python3.12/site-packages/pydantic-2.13.5.dist-info/METADATA │ python-pkg │ 0 │
|
||||
├──────────────────────────────────────────────────────────────────────────────────┼────────────┼─────────────────┤
|
||||
│ usr/local/lib/python3.12/site-packages/pydantic_core-2.46.5.dist-info/METADATA │ python-pkg │ 0 │
|
||||
├──────────────────────────────────────────────────────────────────────────────────┼────────────┼─────────────────┤
|
||||
│ usr/local/lib/python3.12/site-packages/python_dateutil-2.9.0.post0.dist-info/ME- │ python-pkg │ 0 │
|
||||
│ TADATA │ │ │
|
||||
├──────────────────────────────────────────────────────────────────────────────────┼────────────┼─────────────────┤
|
||||
│ usr/local/lib/python3.12/site-packages/requests-2.34.2.dist-info/METADATA │ python-pkg │ 0 │
|
||||
├──────────────────────────────────────────────────────────────────────────────────┼────────────┼─────────────────┤
|
||||
│ usr/local/lib/python3.12/site-packages/s3transfer-0.19.3.dist-info/METADATA │ python-pkg │ 0 │
|
||||
├──────────────────────────────────────────────────────────────────────────────────┼────────────┼─────────────────┤
|
||||
│ usr/local/lib/python3.12/site-packages/simplejpeg-1.9.0.dist-info/METADATA │ python-pkg │ 0 │
|
||||
├──────────────────────────────────────────────────────────────────────────────────┼────────────┼─────────────────┤
|
||||
│ usr/local/lib/python3.12/site-packages/six-1.17.0.dist-info/METADATA │ python-pkg │ 0 │
|
||||
├──────────────────────────────────────────────────────────────────────────────────┼────────────┼─────────────────┤
|
||||
│ usr/local/lib/python3.12/site-packages/starlette-0.46.2.dist-info/METADATA │ python-pkg │ 3 │
|
||||
├──────────────────────────────────────────────────────────────────────────────────┼────────────┼─────────────────┤
|
||||
│ usr/local/lib/python3.12/site-packages/typing_extensions-4.16.0.dist-info/METAD- │ python-pkg │ 0 │
|
||||
│ ATA │ │ │
|
||||
├──────────────────────────────────────────────────────────────────────────────────┼────────────┼─────────────────┤
|
||||
│ usr/local/lib/python3.12/site-packages/typing_inspection-0.4.4.dist-info/METADA- │ python-pkg │ 0 │
|
||||
│ TA │ │ │
|
||||
├──────────────────────────────────────────────────────────────────────────────────┼────────────┼─────────────────┤
|
||||
│ usr/local/lib/python3.12/site-packages/urllib3-2.8.0.dist-info/METADATA │ python-pkg │ 0 │
|
||||
├──────────────────────────────────────────────────────────────────────────────────┼────────────┼─────────────────┤
|
||||
│ usr/local/lib/python3.12/site-packages/uvicorn-0.34.3.dist-info/METADATA │ python-pkg │ 0 │
|
||||
├──────────────────────────────────────────────────────────────────────────────────┼────────────┼─────────────────┤
|
||||
│ usr/local/lib/python3.12/site-packages/valkey-6.1.1.dist-info/METADATA │ python-pkg │ 0 │
|
||||
├──────────────────────────────────────────────────────────────────────────────────┼────────────┼─────────────────┤
|
||||
│ usr/local/lib/python3.12/site-packages/wrapt-2.5.2.dist-info/METADATA │ python-pkg │ 0 │
|
||||
└──────────────────────────────────────────────────────────────────────────────────┴────────────┴─────────────────┘
|
||||
Legend:
|
||||
- '-': Not scanned
|
||||
- '0': Clean (no security findings detected)
|
||||
|
||||
|
||||
Python (python-pkg)
|
||||
===================
|
||||
Total: 3 (HIGH: 3, CRITICAL: 0)
|
||||
|
||||
┌──────────────────────┬────────────────┬──────────┬────────┬───────────────────┬───────────────┬──────────────────────────────────────────────────────────────┐
|
||||
│ Library │ Vulnerability │ Severity │ Status │ Installed Version │ Fixed Version │ Title │
|
||||
├──────────────────────┼────────────────┼──────────┼────────┼───────────────────┼───────────────┼──────────────────────────────────────────────────────────────┤
|
||||
│ starlette (METADATA) │ CVE-2025-62727 │ HIGH │ fixed │ 0.46.2 │ 0.49.1 │ starlette: Starlette DoS via Range header merging │
|
||||
│ │ │ │ │ │ │ https://avd.aquasec.com/nvd/cve-2025-62727 │
|
||||
│ ├────────────────┤ │ │ ├───────────────┼──────────────────────────────────────────────────────────────┤
|
||||
│ │ CVE-2026-48818 │ │ │ │ 1.1.0 │ starlette: Starlette: SSRF and NTLM credential theft via UNC │
|
||||
│ │ │ │ │ │ │ paths in StaticFiles... │
|
||||
│ │ │ │ │ │ │ https://avd.aquasec.com/nvd/cve-2026-48818 │
|
||||
│ ├────────────────┤ │ │ ├───────────────┼──────────────────────────────────────────────────────────────┤
|
||||
│ │ CVE-2026-54283 │ │ │ │ 1.3.1 │ starlette: Starlette: request.form() limits silently ignored │
|
||||
│ │ │ │ │ │ │ for application/x-www-form-urlencoded enable DoS │
|
||||
│ │ │ │ │ │ │ https://avd.aquasec.com/nvd/cve-2026-54283 │
|
||||
└──────────────────────┴────────────────┴──────────┴────────┴───────────────────┴───────────────┴──────────────────────────────────────────────────────────────┘
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,24 @@
|
||||
python -m unittest discover -s student-tests -p "test_limits.py" -v
|
||||
test_big_body_rejected_before_authentication (test_limits.LimitsTest.test_big_body_rejected_before_authentication) ... ok
|
||||
test_body_over_limit_chunked_is_413 (test_limits.LimitsTest.test_body_over_limit_chunked_is_413) ... ok
|
||||
test_body_over_limit_with_content_length_is_413 (test_limits.LimitsTest.test_body_over_limit_with_content_length_is_413) ... ok
|
||||
test_body_under_limit_is_accepted (test_limits.LimitsTest.test_body_under_limit_is_accepted) ... ok
|
||||
test_limit_is_per_username (test_limits.LimitsTest.test_limit_is_per_username) ... ok
|
||||
test_login_failures_lead_to_429_with_retry_after_across_replicas (test_limits.LimitsTest.test_login_failures_lead_to_429_with_retry_after_across_replicas) ... ok
|
||||
test_old_hash_is_rehashed_on_login (test_limits.LimitsTest.test_old_hash_is_rehashed_on_login) ... ok
|
||||
test_success_resets_failure_counter (test_limits.LimitsTest.test_success_resets_failure_counter) ... ok
|
||||
test_wrong_password_does_not_rehash (test_limits.LimitsTest.test_wrong_password_does_not_rehash) ... ok
|
||||
|
||||
----------------------------------------------------------------------
|
||||
Ran 9 tests in 6.108s
|
||||
|
||||
OK
|
||||
|
||||
POST /users, chunked 66643 bytes without Content-Length -> 413 payload_too_large
|
||||
|
||||
POST /users, Content-Length 66643 -> 413 payload_too_large
|
||||
|
||||
10 wrong passwords -> 401, served by 2 of 2 replicas
|
||||
next login (even with the right password) -> 429 rate_limited, Retry-After: 299 s
|
||||
|
||||
stored hash params: m=8192,t=1,p=1 -> after login m=19456,t=2,p=1
|
||||
@@ -0,0 +1,24 @@
|
||||
== seal: API works on cached secrets
|
||||
docker compose --profile tools run --rm ops seal
|
||||
Container mtusi-lab7-ops-run-c7e1163bc17d Creating
|
||||
Container mtusi-lab7-ops-run-c7e1163bc17d Created
|
||||
sealed: services keep their cached secrets, new logins and reads fail until make bao-unseal
|
||||
api-1 | {"timestamp": "2026-11-07T21:05:20.486+00:00", "severity": "WARNING", "service.name": "messenger-api", "event": "secrets.refresh_failed", "logger": "messenger.secrets", "message": "OpenBao недоступен (HTTP 503): работаю на секретах в памяти, полученных 10 с назад", "secrets.state": "unavailable"}
|
||||
api-2 | {"timestamp": "2026-11-07T21:05:11.928+00:00", "severity": "WARNING", "service.name": "messenger-api", "event": "secrets.refresh_failed", "logger": "messenger.secrets", "message": "OpenBao недоступен (HTTP 503): работаю на секретах в памяти, полученных 10 с назад", "secrets.state": "unavailable"}
|
||||
PASS: lab7 public API scenario; infrastructure and grading evidence remain separate.
|
||||
== unseal
|
||||
docker compose --profile tools run --rm ops unseal
|
||||
Container mtusi-lab7-ops-run-84133e93d57d Creating
|
||||
Container mtusi-lab7-ops-run-84133e93d57d Created
|
||||
sealed=False (used 2 of 3 shares)
|
||||
api-1 | {"timestamp": "2026-11-07T21:05:40.522+00:00", "severity": "INFO", "service.name": "messenger-api", "event": "secrets.recovered", "logger": "messenger.secrets", "message": "OpenBao снова доступен"}
|
||||
api-2 | {"timestamp": "2026-11-07T21:05:41.971+00:00", "severity": "INFO", "service.name": "messenger-api", "event": "secrets.recovered", "logger": "messenger.secrets", "message": "OpenBao снова доступен"}
|
||||
== revoke tokens -> relogin by certificate
|
||||
docker compose --profile tools run --rm ops revoke-tokens
|
||||
Container mtusi-lab7-ops-run-4f188b7f2c5c Creating
|
||||
Container mtusi-lab7-ops-run-4f188b7f2c5c Created
|
||||
revoked all tokens issued by auth/cert: services must log in again with their certificates
|
||||
api-1 | {"timestamp": "2026-11-07T21:06:00.562+00:00", "severity": "WARNING", "service.name": "messenger-api", "event": "secrets.relogin", "logger": "messenger.secrets", "message": "OpenBao: токен больше не действует, новый вход"}
|
||||
api-1 | {"timestamp": "2026-11-07T21:06:00.582+00:00", "severity": "INFO", "service.name": "messenger-api", "event": "secrets.login", "logger": "messenger.secrets", "message": "OpenBao: вход по сертификату, роль messenger-api, политики default,messenger-api, токен на 900 с"}
|
||||
api-2 | {"timestamp": "2026-11-07T21:05:52.005+00:00", "severity": "WARNING", "service.name": "messenger-api", "event": "secrets.relogin", "logger": "messenger.secrets", "message": "OpenBao: токен больше не действует, новый вход"}
|
||||
api-2 | {"timestamp": "2026-11-07T21:05:52.080+00:00", "severity": "INFO", "service.name": "messenger-api", "event": "secrets.login", "logger": "messenger.secrets", "message": "OpenBao: вход по сертификату, роль messenger-api, политики default,messenger-api, токен на 900 с"}
|
||||
@@ -0,0 +1,3 @@
|
||||
python tests/resilience.py --mode persistence --action-script "scripts/restart.cmd" --base-url "https://127.0.0.1:8443" --ca-file "secrets/tls/ca/ca.crt"
|
||||
Executing explicit persistence hook; hook output suppressed to avoid leaking secrets.
|
||||
PASS: persistence preserved confirmed data and existing session. Hook scope needs operator evidence.
|
||||
@@ -0,0 +1,26 @@
|
||||
== rotate-db-secret
|
||||
docker compose --profile tools run --rm ops rotate-db
|
||||
Container mtusi-lab7-ops-run-d93b73787775 Creating
|
||||
Container mtusi-lab7-ops-run-d93b73787775 Created
|
||||
rotated DB password of messenger_api: PostgreSQL updated, KV secret/messenger/api now version 2 (value not printed)
|
||||
api-1 | {"timestamp": "2026-11-07T21:04:30.365+00:00", "severity": "WARNING", "service.name": "messenger-api", "event": "secrets.rotated", "logger": "messenger.secrets", "message": "OpenBao: новая версия секрета, изменились поля db_password"}
|
||||
api-1 | {"timestamp": "2026-11-07T21:04:30.376+00:00", "severity": "WARNING", "service.name": "messenger-api", "event": "db.pool_drained", "logger": "messenger.db", "message": "Пароль роли БД сменился: пулы соединений пересоздаются (1)"}
|
||||
api-2 | {"timestamp": "2026-11-07T21:04:31.810+00:00", "severity": "WARNING", "service.name": "messenger-api", "event": "secrets.rotated", "logger": "messenger.secrets", "message": "OpenBao: новая версия секрета, изменились поля db_password"}
|
||||
api-2 | {"timestamp": "2026-11-07T21:04:31.823+00:00", "severity": "WARNING", "service.name": "messenger-api", "event": "db.pool_drained", "logger": "messenger.db", "message": "Пароль роли БД сменился: пулы соединений пересоздаются (1)"}
|
||||
PASS: lab7 public API scenario; infrastructure and grading evidence remain separate.
|
||||
== rotate-lb-cert
|
||||
docker compose --profile tools run --rm pki issue lb
|
||||
Container mtusi-lab7-pki-run-eeae88882775 Creating
|
||||
Container mtusi-lab7-pki-run-eeae88882775 Created
|
||||
lb: issued serial 1D3D845E1AF594ABD70BC068EA871439966B52E4 (valid until 2026-12-07 21:04 UTC), previous serial 4880A64F68E8FD2A8B19E8482491A66EE8DC86BC
|
||||
docker compose kill -s USR2 lb
|
||||
Container mtusi-lab7-lb-1 Killing
|
||||
Container mtusi-lab7-lb-1 Killed
|
||||
sleep 5
|
||||
docker compose --profile tools run --rm pki revoke-previous lb
|
||||
Container mtusi-lab7-pki-run-2793ec0da54c Creating
|
||||
Container mtusi-lab7-pki-run-2793ec0da54c Created
|
||||
revoked lb serial 4880A64F68E8FD2A8B19E8482491A66EE8DC86BC; CRL now lists 1 serials
|
||||
api-2 | {"timestamp": "2026-11-07T21:04:58.024+00:00", "severity": "WARNING", "service.name": "messenger-api", "event": "tls.crl_loaded", "logger": "messenger.tls", "message": "CRL обновлён: отозвано 1 сертификатов"}
|
||||
api-1 | {"timestamp": "2026-11-07T21:05:00.832+00:00", "severity": "WARNING", "service.name": "messenger-api", "event": "tls.crl_loaded", "logger": "messenger.tls", "message": "CRL обновлён: отозвано 1 сертификатов"}
|
||||
PASS: lab7 public API scenario; infrastructure and grading evidence remain separate.
|
||||
@@ -0,0 +1,2 @@
|
||||
python tests/security.py --base-url "https://127.0.0.1:8443" --ca-file "secrets/tls/ca/ca.crt"
|
||||
PASS: trusted HTTPS works; untrusted CA rejected. This does NOT verify internal mTLS, OpenBao or hardening.
|
||||
@@ -0,0 +1,110 @@
|
||||
python -m unittest discover -s student-tests -p "test_*.py" -v
|
||||
test_auth_checked_before_access_and_body (test_api.MessengerApiTest.test_auth_checked_before_access_and_body) ... ok
|
||||
test_bad_cursor_returns_400 (test_api.MessengerApiTest.test_bad_cursor_returns_400) ... ok
|
||||
test_chat_list_pagination (test_api.MessengerApiTest.test_chat_list_pagination) ... ok
|
||||
test_chat_membership_rules (test_api.MessengerApiTest.test_chat_membership_rules) ... ok
|
||||
test_duplicate_username_returns_409 (test_api.MessengerApiTest.test_duplicate_username_returns_409) ... ok
|
||||
test_empty_blank_and_too_long_messages_return_400 (test_api.MessengerApiTest.test_empty_blank_and_too_long_messages_return_400) ... ok
|
||||
test_malformed_json_returns_400 (test_api.MessengerApiTest.test_malformed_json_returns_400) ... ok
|
||||
test_nul_character_is_stored (test_api.MessengerApiTest.test_nul_character_is_stored) ... ok
|
||||
test_outsider_gets_404_for_foreign_chat (test_api.MessengerApiTest.test_outsider_gets_404_for_foreign_chat) ... ok
|
||||
test_pagination_walks_several_pages (test_api.MessengerApiTest.test_pagination_walks_several_pages) ... ok
|
||||
test_unicode_roundtrip (test_api.MessengerApiTest.test_unicode_roundtrip) ... ok
|
||||
test_wrong_types_and_extra_fields_return_400 (test_api.MessengerApiTest.test_wrong_types_and_extra_fields_return_400) ... ok
|
||||
test_attachment_rules_without_500 (test_attachments.AttachmentTest.test_attachment_rules_without_500) ... ok
|
||||
test_broken_scan_becomes_failed_and_cannot_be_attached (test_attachments.AttachmentTest.test_broken_scan_becomes_failed_and_cannot_be_attached) ... ok
|
||||
test_corrupted_images_are_415 (test_attachments.AttachmentTest.test_corrupted_images_are_415) ... ok
|
||||
test_dangerous_filenames_are_400 (test_attachments.AttachmentTest.test_dangerous_filenames_are_400) ... ok
|
||||
test_exact_limits (test_attachments.AttachmentTest.test_exact_limits) ... ok
|
||||
test_idempotency_with_attachments (test_attachments.AttachmentTest.test_idempotency_with_attachments) ... ok
|
||||
test_large_real_image_within_limits_is_accepted (test_attachments.AttachmentTest.test_large_real_image_within_limits_is_accepted) ... ok
|
||||
test_message_with_attachments (test_attachments.AttachmentTest.test_message_with_attachments) ... ok
|
||||
test_mime_spoofing_is_415 (test_attachments.AttachmentTest.test_mime_spoofing_is_415) ... ok
|
||||
test_outsider_and_anonymous_cannot_upload (test_attachments.AttachmentTest.test_outsider_and_anonymous_cannot_upload) ... ok
|
||||
test_pixel_bomb_is_413 (test_attachments.AttachmentTest.test_pixel_bomb_is_413) ... ok
|
||||
test_png_and_jpeg_roundtrip_for_member (test_attachments.AttachmentTest.test_png_and_jpeg_roundtrip_for_member) ... ok
|
||||
test_structurally_broken_jpeg_is_415 (test_attachments.AttachmentTest.test_structurally_broken_jpeg_is_415) ... ok
|
||||
test_too_large_is_413_before_reading (test_attachments.AttachmentTest.test_too_large_is_413_before_reading) ... ok
|
||||
test_too_large_stream_is_413 (test_attachments.AttachmentTest.test_too_large_stream_is_413) ... ok
|
||||
test_valid_jpeg_variants_are_accepted (test_attachments.AttachmentTest.test_valid_jpeg_variants_are_accepted) ... ok
|
||||
test_variants_and_bad_ids (test_attachments.AttachmentTest.test_variants_and_bad_ids) ... ok
|
||||
test_variants_follow_the_contract (test_attachments.AttachmentTest.test_variants_follow_the_contract) ... ok
|
||||
test_bearer_required_on_business_endpoints (test_auth.AuthTest.test_bearer_required_on_business_endpoints) ... ok
|
||||
test_login_returns_opaque_token_with_expiry (test_auth.AuthTest.test_login_returns_opaque_token_with_expiry) ... ok
|
||||
test_logout_revokes_only_current_session (test_auth.AuthTest.test_logout_revokes_only_current_session) ... ok
|
||||
test_malformed_basic_returns_401 (test_auth.AuthTest.test_malformed_basic_returns_401) ... ok
|
||||
test_password_length_rules (test_auth.AuthTest.test_password_length_rules) ... ok
|
||||
test_password_with_colon_and_unicode (test_auth.AuthTest.test_password_with_colon_and_unicode) ... ok
|
||||
test_relogin_after_logout (test_auth.AuthTest.test_relogin_after_logout) ... ok
|
||||
test_user_never_contains_password (test_auth.AuthTest.test_user_never_contains_password) ... ok
|
||||
test_wrong_password_and_unknown_user_look_the_same (test_auth.AuthTest.test_wrong_password_and_unknown_user_look_the_same) ... ok
|
||||
test_x_user_id_does_not_change_identity (test_auth.AuthTest.test_x_user_id_does_not_change_identity) ... ok
|
||||
test_instance_id_on_errors_and_health (test_balancing.BalancingTest.test_instance_id_on_errors_and_health) ... ok
|
||||
test_logout_applies_on_every_replica (test_balancing.BalancingTest.test_logout_applies_on_every_replica) ... ok
|
||||
test_one_session_is_served_by_every_replica (test_balancing.BalancingTest.test_one_session_is_served_by_every_replica) ... ok
|
||||
test_session_cache_is_shared_between_replicas (test_balancing.BalancingTest.test_session_cache_is_shared_between_replicas) ... ok
|
||||
test_write_on_one_replica_read_on_another (test_balancing.BalancingTest.test_write_on_one_replica_read_on_another) ... ok
|
||||
test_failed_request_does_not_burn_key (test_idempotency.IdempotencyTest.test_failed_request_does_not_burn_key) ... ok
|
||||
test_json_formatting_does_not_matter (test_idempotency.IdempotencyTest.test_json_formatting_does_not_matter) ... ok
|
||||
test_key_is_required_and_validated (test_idempotency.IdempotencyTest.test_key_is_required_and_validated) ... ok
|
||||
test_key_scope_is_user_and_chat (test_idempotency.IdempotencyTest.test_key_scope_is_user_and_chat) ... ok
|
||||
test_parallel_different_bodies_same_key (test_idempotency.IdempotencyTest.test_parallel_different_bodies_same_key) ... ok
|
||||
test_parallel_same_key_through_replicas_creates_one_message (test_idempotency.IdempotencyTest.test_parallel_same_key_through_replicas_creates_one_message) ... ok
|
||||
test_replay_rechecks_session_and_access (test_idempotency.IdempotencyTest.test_replay_rechecks_session_and_access) ... ok
|
||||
test_replay_through_another_replica_returns_same_message (test_idempotency.IdempotencyTest.test_replay_through_another_replica_returns_same_message) ... ok
|
||||
test_same_key_other_body_is_409 (test_idempotency.IdempotencyTest.test_same_key_other_body_is_409) ... ok
|
||||
test_big_body_rejected_before_authentication (test_limits.LimitsTest.test_big_body_rejected_before_authentication) ... ok
|
||||
test_body_over_limit_chunked_is_413 (test_limits.LimitsTest.test_body_over_limit_chunked_is_413) ... ok
|
||||
test_body_over_limit_with_content_length_is_413 (test_limits.LimitsTest.test_body_over_limit_with_content_length_is_413) ... ok
|
||||
test_body_under_limit_is_accepted (test_limits.LimitsTest.test_body_under_limit_is_accepted) ... ok
|
||||
test_limit_is_per_username (test_limits.LimitsTest.test_limit_is_per_username) ... ok
|
||||
test_login_failures_lead_to_429_with_retry_after_across_replicas (test_limits.LimitsTest.test_login_failures_lead_to_429_with_retry_after_across_replicas) ... ok
|
||||
test_old_hash_is_rehashed_on_login (test_limits.LimitsTest.test_old_hash_is_rehashed_on_login) ... ok
|
||||
test_success_resets_failure_counter (test_limits.LimitsTest.test_success_resets_failure_counter) ... ok
|
||||
test_wrong_password_does_not_rehash (test_limits.LimitsTest.test_wrong_password_does_not_rehash) ... ok
|
||||
|
||||
----------------------------------------------------------------------
|
||||
Ran 63 tests in 55.072s
|
||||
|
||||
OK
|
||||
|
||||
10 485 760 байт и 6400×6250 = 40 000 000 px: 202 -> ready; на 1 байт/пиксель больше: 413
|
||||
|
||||
fixture 320×200 -> thumbnail 256×160 JPEG, crop 128×128 JPEG, optimized 320×200 WebP; 48×32 -> {'thumbnail': (48, 32), 'crop': (128, 128), 'optimized': (48, 32)}
|
||||
|
||||
X-Instance-Id есть в health, 404, 401 и 400
|
||||
|
||||
logout через одну реплику -> 401 на ['r-4265d3e11ef7', 'r-d2dbb84b8d7b']
|
||||
|
||||
20 x GET /users/me с одним токеном -> реплики {'r-d2dbb84b8d7b': 10, 'r-4265d3e11ef7': 10}; это alias запущенных реплик api (с lab7 — случайные, не hostname), повторный вход не нужен
|
||||
|
||||
10 x GET /users/me через реплики {'r-d2dbb84b8d7b': 5, 'r-4265d3e11ef7': 5}: попаданий в кэш +20, промахов +0 — кэш общий
|
||||
|
||||
сообщение записала реплика r-d2dbb84b8d7b, сразу прочитали ['r-4265d3e11ef7', 'r-d2dbb84b8d7b']
|
||||
|
||||
с тем же ключом: сначала 400 (пустой текст), потом 201 — ошибка ключ не заняла
|
||||
|
||||
тот же JSON с другими пробелами и переносами -> тот же 201 и то же сообщение
|
||||
|
||||
нет ключа, пустой, 129 символов, пробел, '/', кириллица -> 400; 128 символов и ._:- -> 201
|
||||
|
||||
тот же ключ у другого пользователя и в другом чате -> независимые сообщения
|
||||
|
||||
10 одновременных разных тел с одним ключом: 201 x1, 409 x9, в истории 1 сообщение
|
||||
|
||||
20 одновременных POST с одним ключом через реплики {'r-4265d3e11ef7': 10, 'r-d2dbb84b8d7b': 10}: все 201 с одним id, в истории 1 сообщение
|
||||
|
||||
повтор: посторонний -> 404, после logout -> 401, после нового входа -> то же сообщение
|
||||
|
||||
1 запрос + 4 повтора через реплики ['r-4265d3e11ef7', 'r-d2dbb84b8d7b']: 201 и то же сообщение, в истории 1
|
||||
|
||||
другой текст с тем же ключом -> 409 conflict, второе сообщение не создано
|
||||
|
||||
POST /users, chunked 66643 bytes without Content-Length -> 413 payload_too_large
|
||||
|
||||
POST /users, Content-Length 66643 -> 413 payload_too_large
|
||||
|
||||
10 wrong passwords -> 401, served by 2 of 2 replicas
|
||||
next login (even with the right password) -> 429 rate_limited, Retry-After: 298 s
|
||||
|
||||
stored hash params: m=8192,t=1,p=1 -> after login m=19456,t=2,p=1
|
||||
@@ -0,0 +1,2 @@
|
||||
python tests/smoke.py --base-url "https://127.0.0.1:8443" --ca-file "secrets/tls/ca/ca.crt"
|
||||
PASS: lab7 public API scenario; infrastructure and grading evidence remain separate.
|
||||
@@ -0,0 +1,146 @@
|
||||
docker compose --profile tools run --rm sectest student-tests/tls_matrix.py
|
||||
Container mtusi-lab7-sectest-run-304d2fb36af0 Creating
|
||||
Container mtusi-lab7-sectest-run-304d2fb36af0 Created
|
||||
TLS matrix (lab7): who may connect where
|
||||
========================================
|
||||
|
||||
## 1. client -> lb:8443 (external TLS; client verifies server identity lb)
|
||||
OK client our CA, hostname lb, GET /health/ready expect 200 got TLSv1.3 HTTP 200
|
||||
OK client empty trust store -> server cert expect verify-err got client rejected server cert: unable to get local issuer certificate
|
||||
OK client foreign CA trust store -> server cert expect verify-err got client rejected server cert: unable to get local issuer certificate
|
||||
OK client wrong hostname (not lb) expect verify-err got client rejected server cert: Hostname mismatch, certificate is not valid for 'wrong-name.invalid'.
|
||||
OK client plaintext HTTP on :8443 expect refuse got plaintext: closed by server
|
||||
|
||||
## 2. lb -> api:8080 (mTLS; replica allows ONLY identity lb, CRL checked)
|
||||
OK dns api replicas expect >=1 got 172.19.0.7, 172.19.0.8
|
||||
OK lb -> api@172.19.0.7 GET /health/ready expect 200 got TLSv1.3 HTTP 200
|
||||
OK lb -> api@172.19.0.7 expecting name lb expect verify-err got client rejected server cert: Hostname mismatch, certificate is not valid for 'lb'.
|
||||
OK no client cert -> api@172.19.0.7 expect refuse got TLSv1.3 ok, then closed by server
|
||||
OK rogue-lb -> api@172.19.0.7 expect refuse got TLSv1.3 ok, then closed by server
|
||||
OK lb-expired -> api@172.19.0.7 expect refuse got TLSv1.3 ok, then closed by server
|
||||
OK intruder -> api@172.19.0.7 expect refuse got TLSv1.3 ok, then closed by server
|
||||
OK worker -> api@172.19.0.7 expect refuse got TLSv1.3 ok, then closed by server
|
||||
OK api -> api@172.19.0.7 expect refuse got TLSv1.3 ok, then closed by server
|
||||
OK grafana -> api@172.19.0.7 expect refuse got TLSv1.3 ok, then closed by server
|
||||
OK otel-collector -> api@172.19.0.7 expect refuse got TLSv1.3 ok, then closed by server
|
||||
OK lb -> api@172.19.0.8 GET /health/ready expect 200 got TLSv1.3 HTTP 200
|
||||
OK lb -> api@172.19.0.8 expecting name lb expect verify-err got client rejected server cert: Hostname mismatch, certificate is not valid for 'lb'.
|
||||
OK no client cert -> api@172.19.0.8 expect refuse got TLSv1.3 ok, then closed by server
|
||||
OK rogue-lb -> api@172.19.0.8 expect refuse got TLSv1.3 ok, then closed by server
|
||||
OK lb-expired -> api@172.19.0.8 expect refuse got TLSv1.3 ok, then closed by server
|
||||
OK intruder -> api@172.19.0.8 expect refuse got TLSv1.3 ok, then closed by server
|
||||
OK worker -> api@172.19.0.8 expect refuse got TLSv1.3 ok, then closed by server
|
||||
OK api -> api@172.19.0.8 expect refuse got TLSv1.3 ok, then closed by server
|
||||
OK grafana -> api@172.19.0.8 expect refuse got TLSv1.3 ok, then closed by server
|
||||
OK otel-collector -> api@172.19.0.8 expect refuse got TLSv1.3 ok, then closed by server
|
||||
|
||||
## 3. api/worker -> otel-collector:4318 (mTLS gateway otlp-gw; allowlist CN api, worker)
|
||||
OK api -> otel-collector POST /v1/metrics expect 200 got TLSv1.3 HTTP 200
|
||||
OK worker -> otel-collector POST /v1/metrics expect 200 got TLSv1.3 HTTP 200
|
||||
OK api empty trust store -> server cert expect verify-err got client rejected server cert: unable to get local issuer certificate
|
||||
OK api foreign CA trust store -> server cert expect verify-err got client rejected server cert: unable to get local issuer certificate
|
||||
OK api wrong hostname (not otel-collector) expect verify-err got client rejected server cert: Hostname mismatch, certificate is not valid for 'wrong-name.invalid'.
|
||||
OK no client cert -> otel-collector expect refuse got server alert: TLSV13_ALERT_CERTIFICATE_REQUIRED
|
||||
OK rogue-lb -> otel-collector expect refuse got server alert: TLSV1_ALERT_UNKNOWN_CA
|
||||
OK lb-expired -> otel-collector expect refuse got server alert: SSLV3_ALERT_CERTIFICATE_EXPIRED
|
||||
OK intruder -> otel-collector expect refuse got TLSv1.3 HTTP 403
|
||||
OK lb -> otel-collector expect refuse got TLSv1.3 HTTP 403
|
||||
OK grafana -> otel-collector expect refuse got TLSv1.3 HTTP 403
|
||||
OK prometheus -> otel-collector expect refuse got TLSv1.3 HTTP 403
|
||||
OK any bypass gateway: otel-collector:14318 expect closed got port 14318 closed
|
||||
|
||||
## 4. otel-collector / grafana -> prometheus, loki, tempo (mTLS)
|
||||
OK otel-collector -> prometheus:9090 GET /-/ready expect 200 got TLSv1.3 HTTP 200
|
||||
OK grafana -> prometheus:9090 GET /-/ready expect 200 got TLSv1.3 HTTP 200
|
||||
OK otel-collector empty trust store -> server cert expect verify-err got client rejected server cert: unable to get local issuer certificate
|
||||
OK otel-collector foreign CA trust store -> server cert expect verify-err got client rejected server cert: unable to get local issuer certificate
|
||||
OK otel-collector wrong hostname (not prometheus) expect verify-err got client rejected server cert: Hostname mismatch, certificate is not valid for 'wrong-name.invalid'.
|
||||
OK no client cert -> prometheus:9090 expect refuse got server alert: TLSV13_ALERT_CERTIFICATE_REQUIRED
|
||||
OK rogue-lb -> prometheus:9090 expect refuse got server alert: TLSV1_ALERT_UNKNOWN_CA
|
||||
OK lb-expired -> prometheus:9090 expect refuse got server alert: SSLV3_ALERT_CERTIFICATE_EXPIRED
|
||||
OK intruder -> prometheus:9090 expect refuse got server alert: SSLV3_ALERT_BAD_CERTIFICATE
|
||||
OK api -> prometheus:9090 expect refuse got server alert: SSLV3_ALERT_BAD_CERTIFICATE
|
||||
OK lb -> prometheus:9090 expect refuse got server alert: SSLV3_ALERT_BAD_CERTIFICATE
|
||||
OK otel-collector -> loki:3100 GET /loki/api/v1/status/buildinfo expect 200 got TLSv1.3 HTTP 200
|
||||
OK grafana -> loki:3100 GET /loki/api/v1/status/buildinfo expect 200 got TLSv1.3 HTTP 200
|
||||
OK otel-collector empty trust store -> server cert expect verify-err got client rejected server cert: unable to get local issuer certificate
|
||||
OK otel-collector foreign CA trust store -> server cert expect verify-err got client rejected server cert: unable to get local issuer certificate
|
||||
OK otel-collector wrong hostname (not loki) expect verify-err got client rejected server cert: Hostname mismatch, certificate is not valid for 'wrong-name.invalid'.
|
||||
OK no client cert -> loki:3100 expect refuse got server alert: TLSV13_ALERT_CERTIFICATE_REQUIRED
|
||||
OK rogue-lb -> loki:3100 expect refuse got server alert: TLSV1_ALERT_UNKNOWN_CA
|
||||
OK lb-expired -> loki:3100 expect refuse got server alert: SSLV3_ALERT_CERTIFICATE_EXPIRED
|
||||
OK intruder -> loki:3100 expect refuse got TLSv1.3 HTTP 403
|
||||
OK api -> loki:3100 expect refuse got TLSv1.3 HTTP 403
|
||||
OK lb -> loki:3100 expect refuse got TLSv1.3 HTTP 403
|
||||
OK grafana -> tempo:3200 GET /api/status/buildinfo expect 200 got TLSv1.3 HTTP 200
|
||||
OK grafana empty trust store -> server cert expect verify-err got client rejected server cert: unable to get local issuer certificate
|
||||
OK grafana foreign CA trust store -> server cert expect verify-err got client rejected server cert: unable to get local issuer certificate
|
||||
OK grafana wrong hostname (not tempo) expect verify-err got client rejected server cert: Hostname mismatch, certificate is not valid for 'wrong-name.invalid'.
|
||||
OK no client cert -> tempo:3200 expect refuse got server alert: TLSV13_ALERT_CERTIFICATE_REQUIRED
|
||||
OK rogue-lb -> tempo:3200 expect refuse got server alert: TLSV1_ALERT_UNKNOWN_CA
|
||||
OK lb-expired -> tempo:3200 expect refuse got server alert: SSLV3_ALERT_CERTIFICATE_EXPIRED
|
||||
OK intruder -> tempo:3200 expect refuse got TLSv1.3 HTTP 403
|
||||
OK api -> tempo:3200 expect refuse got TLSv1.3 HTTP 403
|
||||
OK lb -> tempo:3200 expect refuse got TLSv1.3 HTTP 403
|
||||
OK otel-collector -> tempo:3200 expect refuse got TLSv1.3 HTTP 403
|
||||
OK otel-collector -> tempo:4318 POST /v1/traces expect 200 got TLSv1.3 HTTP 200
|
||||
OK no client cert -> tempo:4318 expect refuse got server alert: TLSV13_ALERT_CERTIFICATE_REQUIRED
|
||||
OK rogue-lb -> tempo:4318 expect refuse got server alert: TLSV1_ALERT_UNKNOWN_CA
|
||||
OK lb-expired -> tempo:4318 expect refuse got server alert: SSLV3_ALERT_CERTIFICATE_EXPIRED
|
||||
OK intruder -> tempo:4318 expect refuse got TLSv1.3 HTTP 403
|
||||
OK api -> tempo:4318 expect refuse got TLSv1.3 HTTP 403
|
||||
OK lb -> tempo:4318 expect refuse got TLSv1.3 HTTP 403
|
||||
OK grafana -> tempo:4318 expect refuse got TLSv1.3 HTTP 403
|
||||
|
||||
## 5. api/worker -> openbao:8200 (TLS + cert auth: role accepts only CN api / worker)
|
||||
OK api -> openbao GET /v1/sys/health expect 200 got TLSv1.3 HTTP 200
|
||||
OK api empty trust store -> server cert expect verify-err got client rejected server cert: unable to get local issuer certificate
|
||||
OK api foreign CA trust store -> server cert expect verify-err got client rejected server cert: unable to get local issuer certificate
|
||||
OK api wrong hostname (not openbao) expect verify-err got client rejected server cert: Hostname mismatch, certificate is not valid for 'wrong-name.invalid'.
|
||||
OK no client cert -> openbao login role messenger-api expect refuse got login HTTP 400: client certificate must be supplied
|
||||
OK rogue-lb -> openbao login role messenger-api expect refuse got login HTTP 400: invalid certificate or no client certificate supplied; addit
|
||||
OK lb-expired -> openbao login role messenger-api expect refuse got login HTTP 500: failed to verify client's certificate: x509: certificate has
|
||||
OK intruder -> openbao login role messenger-api expect refuse got login HTTP 400: no chain matching all constraints could be found for this lo
|
||||
OK lb -> openbao login role messenger-worker expect refuse got login HTTP 400: no chain matching all constraints could be found for this lo
|
||||
OK worker -> openbao login role messenger-api expect refuse got login HTTP 400: no chain matching all constraints could be found for this lo
|
||||
OK api -> openbao login role messenger-api expect 200 got login HTTP 200
|
||||
OK worker -> openbao login role messenger-worker expect 200 got login HTTP 200
|
||||
|
||||
## 6. api/worker -> broker:5671 (mTLS + SASL EXTERNAL: user = certificate CN)
|
||||
OK api -> broker login expect allow got SASL EXTERNAL login ok
|
||||
OK worker -> broker login expect allow got SASL EXTERNAL login ok
|
||||
OK api empty trust store -> server cert expect verify-err got client rejected server cert: self-signed certificate in certificate chain
|
||||
OK api foreign CA trust store -> server cert expect verify-err got client rejected server cert: self-signed certificate in certificate chain
|
||||
OK api wrong hostname (not broker) expect verify-err got client rejected server cert: Hostname mismatch, certificate is not valid for 'wrong-name.invalid'.
|
||||
OK no client cert -> broker (TLS) expect refuse got server alert: TLSV13_ALERT_CERTIFICATE_REQUIRED
|
||||
OK rogue-lb -> broker (TLS) expect refuse got server alert: TLSV1_ALERT_UNKNOWN_CA
|
||||
OK lb-expired -> broker (TLS) expect refuse got server alert: SSLV3_ALERT_CERTIFICATE_EXPIRED
|
||||
OK intruder -> broker login expect refuse got login refused: ProbableAuthenticationError
|
||||
OK lb -> broker login expect refuse got login refused: ProbableAuthenticationError
|
||||
OK grafana -> broker login expect refuse got login refused: ProbableAuthenticationError
|
||||
OK any plaintext AMQP broker:5672 expect closed got 5672 closed
|
||||
|
||||
## 7. api/worker -> postgres:5432 (TLS verify-full, hostssl only, SCRAM)
|
||||
OK api -> postgres as messenger_api (verify-full) expect allow got connected, TLSv1.3
|
||||
OK worker -> postgres as messenger_worker (verify-full) expect allow got connected, TLSv1.3
|
||||
OK api -> postgres without TLS (right password) expect refuse got pg_hba: no encryption -> reject
|
||||
OK api -> postgres, foreign CA trust store expect verify-err got server cert verify failed
|
||||
OK api -> postgres by IP 172.19.0.4 (name != SAN) expect verify-err got hostname mismatch
|
||||
|
||||
## 8. api -> valkey:6379 (TLS; identity = ACL user, checked in acl_matrix.py)
|
||||
OK api -> valkey TLS, PING without AUTH expect NOAUTH got TLSv1.3 ok, server answered
|
||||
OK api empty trust store -> server cert expect verify-err got client rejected server cert: self-signed certificate in certificate chain
|
||||
OK api foreign CA trust store -> server cert expect verify-err got client rejected server cert: self-signed certificate in certificate chain
|
||||
OK api wrong hostname (not valkey) expect verify-err got client rejected server cert: Hostname mismatch, certificate is not valid for 'wrong-name.invalid'.
|
||||
OK api -> valkey plaintext PING expect refuse got plaintext: ConnectionResetError: [Errno 104] Connection reset by peer
|
||||
|
||||
## 9. api/worker -> s3:9000 (HTTPS; identity = S3 keys, checked in acl_matrix.py)
|
||||
OK api -> s3 GET /healthz expect 200 got TLSv1.3 HTTP 200
|
||||
OK api empty trust store -> server cert expect verify-err got client rejected server cert: unable to get local issuer certificate
|
||||
OK api foreign CA trust store -> server cert expect verify-err got client rejected server cert: unable to get local issuer certificate
|
||||
OK api wrong hostname (not s3) expect verify-err got client rejected server cert: Hostname mismatch, certificate is not valid for 'wrong-name.invalid'.
|
||||
OK api -> s3 plaintext HTTP expect refuse got plaintext: HTTP/1.0 400 Bad Request
|
||||
|
||||
## 10. replication / cluster channels: N/A (single node PostgreSQL, Valkey, broker, OpenBao)
|
||||
|
||||
PASS: 119 checks
|
||||
Reference in New Issue
Block a user