forked from mtusi2026/mtusi2026lab7
feat: confine a compromised worker and drill its compromise end to end
- narrow the worker S3 user to staging reads and attachments writes - add database rules the worker role cannot bypass: no return to pending, variant keys of its own attachment, known error codes only - let the cleaner remove a ready source only after its own SHA-256 check - add make jobs_audit [REPAIR=1] to name and requeue damaged jobs - add make worker_compromise: isolated before/after stands, one operation table, response windows, job safety, controls and committed hypotheses Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -639,8 +639,11 @@ RETURNING object_key;
|
||||
"""
|
||||
# как условная отмена прежней версии: задание удалено, строка pending с
|
||||
# updated_at позже created_at (design change async-attachments, решение 3)
|
||||
# возврат в pending БД отвергает у любой роли (change track1-worker-compromise,
|
||||
# решение 6); строку прежней версии суперпользователь воспроизводит без триггеров
|
||||
CANCEL_TO_PENDING_SQL = """\
|
||||
BEGIN;
|
||||
SET LOCAL session_replication_role = replica;
|
||||
DELETE FROM attachment_jobs WHERE attachment_id = :'title'::uuid;
|
||||
UPDATE attachments
|
||||
SET status = 'pending', updated_at = updated_at + interval '1 microsecond'
|
||||
|
||||
@@ -272,6 +272,15 @@ EXCLUDED: dict[Scenario, Exclusion] = {
|
||||
("Брокер перезапущен под перегрузкой", "блок restart-broker, H8"),
|
||||
)
|
||||
},
|
||||
("storage-consistency", "Результат не сходится с исходником"): Exclusion(
|
||||
reason="ложный ready пишет в PostgreSQL только роль worker, а по "
|
||||
"HTTP его не создать; журнал уборщика наружу не виден",
|
||||
check="service-tests/unit/test_attachment_cleanup.py "
|
||||
"(test_ready_source_kept_without_matching_result: нет объекта, "
|
||||
"другой размер, другие байты) и make worker_compromise: ложный "
|
||||
"ready атакующего, исходник на месте — "
|
||||
"evidence/security/track1-worker-compromise.md",
|
||||
),
|
||||
}
|
||||
# ссылка исключения на доказательство в репозитории лабы
|
||||
EVIDENCE_RE = re.compile(r"evidence/[\w./-]+\.md")
|
||||
|
||||
Reference in New Issue
Block a user