Files
mtusi2026lab7-safronov/evidence/attachments/storage.md
T
ricoromaandClaude Opus 5.5 7b2defab01 feat: audit the whole trust matrix in one command and complete the threat model
- make security_audit runs the existing negative checks per trust-matrix
  row plus an ingress TLS probe and prints one summary
- close the threat model TODOs and stale references
- re-take the coverage exclusion evidence on the lab 7 stand

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-12-02 07:08:10 +03:00

8.1 KiB
Raw Blame History

Вложения: метаданные, байты и ограничения обработки

  • Команда: python3 .claude/skills/run-mtusi-messenger/driver.py --port 8443 attachment-storage
  • Дата: 2026-12-02, 03:42:50–03:42:57 UTC; код выхода 0
  • Commit: bb20855 (ветка feat/lab7-final); рабочее дерево — правки последнего шага, часть 2 (аудит матрицы, документы, файлы evidence/), код образа = HEAD
  • Стенд: проект compose mtusi-lab7, две реплики за HAProxy, телеметрия включена, собран make run_docker из рабочего дерева. Контейнеры docker diff: реплики 33d403c38cdd, 9e7d80b101e9 и worker b91ad296e6d8
  • Сценарии: attachments «Байты не в БД и не на диске API», data-storage «Ограничения обработки в схеме» (пробы в откатываемой транзакции, запись аудита с неизвестным заданием)
  • С лабы 7 в docker diff есть ещё файлы PKI стенда в /run/secrets (secrets compose: CA, CRL и пара identity сервиса — у реплик api и api-client, у worker — worker); в выводе — только имена файлов. Колонка lost_at — сверка bucket и БД (лаба 4), staging_key и error_code — конвейер лабы 5
  • Вывод сокращён: таблица второго вложения повторяет первую и совпала с ожидаемым

Итог: байты — только объекты приватного bucket (анонимный GET 403), в PostgreSQL — метаданные и SHA-256 (bytea, 32 байта), в файловых системах реплик и worker — только смонтированный config.toml и файлы PKI; четыре пробы ограничений дают названные коды, после отката — одно задание и три варианта.

columns of attachment tables:
  attachment_job_replays  id  uuid
  attachment_job_replays  job_id  uuid
  attachment_job_replays  operator  text
  attachment_job_replays  error_code  text
  attachment_job_replays  reason  text
  attachment_job_replays  attempt  integer
  attachment_job_replays  created_at  timestamp with time zone
  attachment_jobs  id  uuid
  attachment_jobs  attachment_id  uuid
  attachment_jobs  pipeline_version  integer
  attachment_jobs  state  text
  attachment_jobs  attempt  integer
  attachment_jobs  last_error_code  text
  attachment_jobs  next_attempt_at  timestamp with time zone
  attachment_jobs  lease_expires_at  timestamp with time zone
  attachment_jobs  published_at  timestamp with time zone
  attachment_jobs  updated_at  timestamp with time zone
  attachment_jobs  finished_at  timestamp with time zone
  attachment_jobs  created_at  timestamp with time zone
  attachment_jobs  attempt_base  integer
  attachment_jobs  traceparent  text
  attachment_jobs  tracestate  text
  attachment_variants  attachment_id  uuid
  attachment_variants  pipeline_version  integer
  attachment_variants  variant  text
  attachment_variants  object_key  text
  attachment_variants  content_type  text
  attachment_variants  size_bytes  integer
  attachment_variants  width  integer
  attachment_variants  height  integer
  attachment_variants  sha256  bytea
  attachment_variants  created_at  timestamp with time zone
  attachments  id  uuid
  attachments  chat_id  uuid
  attachments  owner_id  uuid
  attachments  filename  text
  attachments  content_type  text
  attachments  size_bytes  integer
  attachments  sha256  bytea
  attachments  object_key  text
  attachments  status  text
  attachments  updated_at  timestamp with time zone
  attachments  created_at  timestamp with time zone
  attachments  lost_at  timestamp with time zone
  attachments  staging_key  text
  attachments  error_code  text
  message_attachments  message_id  uuid
  message_attachments  position  smallint
  message_attachments  attachment_id  uuid
  message_attachments  created_at  timestamp with time zone
upload via 169929a788d4880a: object_key messenger/attachments/6c9479d5-86a5-4f70-a860-302b7fb813c5/original, staging_key messenger/staging/6c9479d5-86a5-4f70-a860-302b7fb813c5/original
  sha256 uploaded 99ea7533c441f79cd630d15ce4d58d1ec4e06f6f0efb3b77a5c088305cd1bd75, downloaded by a member (200) 99ea7533c441f79cd630d15ce4d58d1ec4e06f6f0efb3b77a5c088305cd1bd75
upload via 169929a788d4880a: object_key messenger/attachments/a30769b4-1521-4ce3-a7fd-e670b3229206/original, staging_key messenger/staging/a30769b4-1521-4ce3-a7fd-e670b3229206/original
  sha256 uploaded 99ea7533c441f79cd630d15ce4d58d1ec4e06f6f0efb3b77a5c088305cd1bd75, downloaded by a member (200) 99ea7533c441f79cd630d15ce4d58d1ec4e06f6f0efb3b77a5c088305cd1bd75
constraint probes (rolled back):
  second job of the version: 23505 uq_attachment_jobs_attachment_id_pipeline_version
  second variant of the name: 23505 pk_attachment_variants
  error_code on not failed: 23514 ck_attachments_error_code_failed
  replay audit of an unknown job: 23503 fk_attachment_job_replays_job_id_attachment_jobs
docker diff 33d403c38cdd: 10 changes
  C /run
  A /run/secrets
  A /run/secrets/api-client.crt
  A /run/secrets/api-client.key
  A /run/secrets/api.crt
  A /run/secrets/api.key
  A /run/secrets/ca.crt
  A /run/secrets/crl.pem
  C /app
  A /app/config.toml
docker diff 9e7d80b101e9: 10 changes
  C /app
  A /app/config.toml
  C /run
  A /run/secrets
  A /run/secrets/api.crt
  A /run/secrets/api.key
  A /run/secrets/ca.crt
  A /run/secrets/crl.pem
  A /run/secrets/api-client.crt
  A /run/secrets/api-client.key
docker diff b91ad296e6d8: 8 changes
  C /app
  A /app/config.toml
  C /run
  A /run/secrets
  A /run/secrets/ca.crt
  A /run/secrets/crl.pem
  A /run/secrets/worker.crt
  A /run/secrets/worker.key
bytea columns                          expected attachment_variants.sha256,attachments.sha256  got attachment_variants.sha256,attachments.sha256
octet_length(sha256)                   expected 32  got 32
object_key form                        expected messenger/attachments/6c9479d5-86a5-4f70-a860-302b7fb813c5/original  got messenger/attachments/6c9479d5-86a5-4f70-a860-302b7fb813c5/original
staging_key: its form or already empty expected yes  got yes
filename not in key                    expected no  got no
variant rows                           expected crop,optimized,thumbnail  got crop,optimized,thumbnail
crop in bucket                         expected yes  got yes
anonymous GET of crop                  expected 403  got 403
optimized in bucket                    expected yes  got yes
anonymous GET of optimized             expected 403  got 403
thumbnail in bucket                    expected yes  got yes
anonymous GET of thumbnail             expected 403  got 403
object in bucket, bytes                expected 111817  got 111817
anonymous GET of the key               expected 403  got 403
downloaded sha256 = uploaded           expected yes  got yes
… (второе вложение, a30769b4-…: те же 13 строк, все совпали)
probe: second job of the version       expected 23505 uq_attachment_jobs_attachment_id_pipeline_version  got 23505 uq_attachment_jobs_attachment_id_pipeline_version
probe: second variant of the name      expected 23505 pk_attachment_variants  got 23505 pk_attachment_variants
probe: error_code on not failed        expected 23514 ck_attachments_error_code_failed  got 23514 ck_attachments_error_code_failed
probe: replay audit of an unknown job  expected 23503 fk_attachment_job_replays_job_id_attachment_jobs  got 23503 fk_attachment_job_replays_job_id_attachment_jobs
jobs | variants after the probes       expected 1|3  got 1|3
original files in 33d403c38cdd         expected 0  got 0
original files in 9e7d80b101e9         expected 0  got 0
original files in b91ad296e6d8         expected 0  got 0
sha256 of the fixture: 99ea7533c441f79cd630d15ce4d58d1ec4e06f6f0efb3b77a5c088305cd1bd75
PASS: metadata in PostgreSQL, bytes only in the private bucket messenger, none in the API containers