на оценку 4

This commit is contained in:
2026-11-22 23:33:11 +03:00
parent 20afc2c790
commit cc41f601e3
207 changed files with 22098 additions and 120 deletions
+101
View File
@@ -0,0 +1,101 @@
# Sanitized grade-3 evidence — 2026-11-18
No passwords, tokens, private keys, Authorization headers or user content are included.
## Toolchain
- Go 1.27.4 linux/amd64
- Docker Engine 29.7.2; Compose 5.5.0
- OpenSSL 3.5.5
- Intel Core i5-1135G7, 8 vCPU exposed to WSL, 3.7 GiB RAM
## Checks
```text
make check
PASS: offline skeleton structure, local refs and Python syntax
PYTHON=/tmp/lab7-venv/bin/python make validate
PASS: full OpenAPI 3.1 and JSON Schema validation
go test ./...
PASS
go vet ./...
PASS
make test
PASS: lab7 public API scenario
make test-security
PASS: trusted HTTPS works; untrusted CA rejected
make test-security-grade3
PASS: missing/foreign/wrong-identity LB certificates rejected
PASS: allowed LB identity accepted
PASS: API replicas have no published bypass port
PASS: telemetry missing/wrong identity rejected; Grafana identity accepted
make test-rate-limit-grade3
PASS: login limit is shared across replicas and returns 429 with Retry-After
make test-openbao-policy
PASS: own path allow; foreign path, policy admin and write deny
./tests/minio_policy.sh
PASS: staging write-only; attachments read-only; bucket create/anonymous GET deny
go run golang.org/x/vuln/cmd/govulncheck@latest ./...
No vulnerabilities found. (govulncheck v1.10.0)
```
## Argon2id benchmark
```text
BenchmarkHashPasswordGrade3-8 5 32716606 ns/op
```
Parameters: Argon2id `m=19456 KiB`, `t=2`, `p=1`; five fixed iterations. This is a local latency observation, not a universal target.
## Closed-loop synthetic load
```json
{
"workload": "closed-loop POST messages; no automatic retries",
"requested_duration_seconds": 30,
"elapsed_seconds": 30.094,
"concurrency": 4,
"successful_requests": 1959,
"failed_requests": 0,
"error_ratio": 0.0,
"successful_rps": 65.095,
"successful_latency_ms": {"p50": 87.901, "p95": 100.057, "p99": 106.397}
}
```
One `docker stats --no-stream` sample during the run:
| Container | CPU | Memory |
| --- | ---: | ---: |
| API-1 | 10.19% | 16.38 MiB / 256 MiB |
| API-2 | 11.07% | 21.20 MiB / 256 MiB |
| ingress | 25.09% | 23.41 MiB / 128 MiB |
| PostgreSQL | 13.89% | 68.33 MiB / 512 MiB |
Closed-loop percentiles cover successful requests only and include client overhead/coordinated omission.
## Failure hooks
```text
make test-persistence ACTION_SCRIPT=scripts/restart.sh
PASS: persistence preserved confirmed data and existing session
make test-failover ACTION_SCRIPT=scripts/stop-one.sh
observed_instances_before=2
successful_writes=110
failed_attempts=8
first_recovery_seconds=4.932
PASS: confirmed data preserved; duplicate messages not observed
```
The persistence hook restarted PostgreSQL, Redis, MinIO, RabbitMQ, OpenBao and telemetry stores with volumes, performed operator unseal/bootstrap, then recreated the app processes. The failover hook stopped exactly the API instance named by its opaque `X-Instance-Id` and left the other replica serving.
+32
View File
@@ -0,0 +1,32 @@
# Санитизированное доказательство уровня 4
Дата воспроизведения: 2026-11-22. Стенд и ограничения нагрузки описаны в `REPORT.md`. Secret values, tokens, private keys и полные credential-bearing responses в этот файл не записывались.
## Identity, ACL и hardening
- `make test-security-grade4` — PASS. Broker отверг отсутствие client certificate, same-CA intruder и API identity без broker edge; принял отдельные worker/dispatcher identities. OTLP gateway отверг отсутствие cert и same-CA intruder; принял отдельные api/worker/dispatcher identities.
- Тот же сценарий подтвердил read-only rootfs, `no-new-privileges`, `cap_drop: ALL` у application containers и ограничения worker: 1 CPU, 512 MiB, `GOMEMLIMIT=448MiB`, concurrency 1, timeout 60 s.
- `tests/attachment_boundaries.py` — PASS. Ровно 10 MiB и 40 000 000 pixels обработаны; сразу после проверки worker использовал 426.3 MiB/512 MiB, `OOMKilled=false`.
- `make test-acl-grade4` — PASS. PostgreSQL использует `verify-full`; dispatcher имеет `SELECT,UPDATE` только для recovery attachment, не читает users и не удаляет attachments. Redis API user ограничен cache prefix и не управляет ACL; RabbitMQ producer/consumer permissions ограничены одной attachment queue. Реальный reaper восстановил найденную просроченную job после точечного grant.
- `make test-telemetry-leak-grade4` — PASS. Loki содержит structured application events, но не содержит уникальный wrong-password probe, Authorization/Basic/Bearer, request bodies и значения ignored secret files.
## Credential lifecycle
- `make rotate-secret-grade4` — PASS. RabbitMQ worker password заменён в backend и scoped OpenBao KV; старый credential отвергнут, новый принят; worker пересоздан с `--no-build`, image ID не изменился.
- `make rotate-leaf-grade4` — PASS. Выпущена новая уникальная LB URI identity; предыдущий и `days=0` leaf отвергнуты, новый принят; app/ingress image IDs не изменились.
- `make test-openbao-lifecycle-grade4` — PASS. One-use SecretID нельзя использовать повторно; renewable token работает после исходного TTL и прекращает работать на max TTL; при seal уже работающий API продолжает использовать загруженные credentials, новый API fail-closed; operator unseal восстанавливает запуск без rebuild.
## Password и login DoS
- `go test ./internal/security ./student_tests` — PASS. Legacy Argon2id PHC `m=8192,t=1` после успешной проверки заменяется текущим hash через compare-and-set; wrong password не запускает rehash.
- `make login-dos-benchmark` — `23485943 ns/op` (23.485943 ms/op на этом стенде). Общий PostgreSQL limiter выполняется до KDF и допускает 5 попыток за 60 s: измеренный верхний бюджет около 117 ms Argon2 CPU/min на один normalized identifier.
- `make test-rate-limit-grade3` — PASS: запросы распределились по обеим API replicas, первые пять дали 401, шестой — 429 с `Retry-After`.
- `make test-state-pruning-grade4` — PASS: bounded indexed cleanup удалил истёкшую limiter row, но сохранил активное окно с attempts=4. Session/idempotency и limiter batch ограничен 256 rows и запускается не чаще раза на 128 операций после первого запуска.
## Регрессия и сканирование
- `go test ./...`, `go vet ./...`, `make check`, полная `make validate`, `docker compose config --quiet` и `git diff --check` — PASS.
- `make test`, `make test-security-grade3`, `make test-openbao-policy`, `./tests/minio_policy.sh` — PASS; публичный контракт, предыдущий mTLS boundary и scoped policies не ослаблены.
- `make scan-grade4` — PASS по заявленной политике. `govulncheck v1.10.0`: no reachable vulnerabilities; strict Trivy 0.76.2: 0 HIGH/CRITICAL fixed для app и ingress. Обязательный informational scan архивированного upstream показал MinIO 40 HIGH/4 CRITICAL и `mc` 26 HIGH/1 CRITICAL; применимость, компенсирующие меры и production-блокер зафиксированы в `security/SCAN_TRIAGE.md`.
Все команды воспроизводимы из `REPORT.md`. Это локальная evidence summary, а не CI attestation или cryptographic provenance.