База lab7: контракт 1.7.0 и реализация lab1–lab6

Перенесены cmd/internal/config, compose.yaml, Dockerfile, скрипты, student-tests и evidence из mtusi-messenger (master, lab6). Skeleton lab7 (openapi/infrastructure 1.7.0, trust-matrix.md, security/THREAT_MODEL.md, infra/openbao, tests/security.py) сохранён; make test-security добавлен в Makefile.
This commit is contained in:
Vladislav Kunetskiy
2026-11-09 13:03:49 +03:00
parent 20afc2c790
commit 3d216fbd50
479 changed files with 84512 additions and 50 deletions
+27
View File
@@ -0,0 +1,27 @@
# SeaweedFS identities
`infra/s3/s3.json` is mounted read-only into the `seaweedfs` container and is
the single source of truth for S3 credentials and permissions.
- `admin` is used only by the one-shot `s3-init` service (bucket creation and
probing). It is never given to the API and must not be placed in `.env`:
the API service loads `.env` as an environment file. Compose supplies the
synthetic admin values to `s3-init` directly.
- `app` is used by the API and by presigned uploads. It can read/write only
`messenger-attachments/attachments/*` and `messenger-attachments/staging/*`,
and list the bucket for the orphan sweeper.
The credentials are synthetic values for the local stand. `.env.example`
carries the same values for the API and `scripts/check_s3_creds.py` fails the
offline check if they drift. Replace them in `.env` for any non-local run.
Verify manually:
```sh
# anonymous requests are denied
docker compose exec -T seaweedfs \
wget -qO- http://127.0.0.1:8333/messenger-attachments/attachments/missing
# the app identity cannot write outside its prefixes
docker compose run --rm s3-init # probes this and exits non-zero on violation
```
+24
View File
@@ -0,0 +1,24 @@
{
"identities": [
{
"name": "admin",
"credentials": [
{"accessKey": "lab4admin", "secretKey": "lab4admin-secret"}
],
"actions": ["Admin", "Read", "Write", "List", "Tagging"]
},
{
"name": "app",
"credentials": [
{"accessKey": "lab4app", "secretKey": "lab4app-secret"}
],
"actions": [
"Read:messenger-attachments/attachments/*",
"Write:messenger-attachments/attachments/*",
"Read:messenger-attachments/staging/*",
"Write:messenger-attachments/staging/*",
"List:messenger-attachments"
]
}
]
}