lab7: цикл обновления секретов не зависит от bootCtx, маркеры сбоев на volume, восстановление staging по HTTPS, purge — остаточный риск

This commit is contained in:
2026-11-12 19:27:20 +03:00
parent 627b7ee42f
commit 049b2867a6
11 changed files with 39 additions and 18 deletions
+2 -1
View File
@@ -124,7 +124,8 @@ def main():
'worker DB role too broad: %s' % a['db'])
check(denied(a['s3'].get('put s/*')) and denied(a['s3'].get('get o/*')) and denied(a['s3'].get('list bucket'))
and denied(a['s3'].get('delete o/*')), 'worker S3 key too broad: %s' % a['s3'])
check(denied(a['amqp'].get('publish attachments (job)')) and denied(a['amqp'].get('purge attachment.process')),
check(denied(a['amqp'].get('publish attachments (job)')) and denied(a['amqp'].get('declare queue evil'))
and denied(a['amqp'].get('consume attachment.dead (DLQ)')),
'worker broker rights too broad: %s' % a['amqp'])
check(denied(a['api_as_lb'].get('result')), 'worker certificate accepted by API')
+3 -2
View File
@@ -337,9 +337,10 @@ def scenario_failed_replay(c):
# Восстанавливаем исходник и делаем явный replay.
import subprocess
p = subprocess.run(['docker', 'compose', 'run', '--rm', '--no-deps', '-T', '--entrypoint', 'sh', 's3-init', '-c',
'mc alias set s3 http://s3:9000 "$(cat /run/secrets/s3_root_user)" "$(cat /run/secrets/s3_root_password)" >/dev/null; '
'mkdir -p /tmp/.mc/certs/CAs && cp /run/secrets/ca.crt /tmp/.mc/certs/CAs/ && '
'mc alias set s3 https://s3:9000 "$(cat /run/secrets/s3_root_user)" "$(cat /run/secrets/s3_root_password)" >/dev/null; '
'cat > /tmp/o && mc cp -q /tmp/o s3/%s/%s >/dev/null' % (BUCKET, key)], input=sample(), capture_output=True)
check(p.returncode == 0, 'restore staging failed')
check(p.returncode == 0, 'restore staging failed: %s' % p.stderr.decode(errors='replace')[-300:])
rp = compose('run', '--rm', '--no-deps', '-T', '--entrypoint', '/app/pipeline', 'relay', 'replay', att['id'],
'--actor', 'lab5-test', check=False)
check(rp.returncode == 0, 'replay failed: ' + rp.stdout + rp.stderr[-200:])
+3 -2
View File
@@ -135,7 +135,7 @@ def scenario_mtls(c):
check(denied(broker[k].get('connect')), 'broker %s not rejected: %s' % (k, broker[k]))
w, r = broker['worker'], broker['relay']
check(w.get('consume attachment.process') == 'allowed' and denied(w.get('publish attachments (job)'))
and denied(w.get('declare queue evil')) and denied(w.get('purge attachment.process')), 'worker ACL: %s' % w)
and denied(w.get('declare queue evil')) and denied(w.get('delete queue attachment.process')), 'worker ACL: %s' % w)
check(r.get('publish attachments (job)') == 'allowed' and denied(r.get('consume attachment.process')), 'relay ACL: %s' % r)
otel = {
@@ -195,7 +195,8 @@ def scenario_acl(c):
res = {}
res['outsider_metadata'] = c.call('GET', '/api/v1/attachments/' + att['id'], (404,), actor=eve)['status']
res['outsider_content'] = c.call('GET', '/api/v1/attachments/%s/content' % att['id'], (404,), actor=eve)['status']
echat = c.call('POST', '/api/v1/chats', 201, actor=eve, body={'title': 'e', 'member_ids': [eve['id']]})['json']
echat = c.call('POST', '/api/v1/chats', 201, actor=eve, body={'title': 'e', 'member_ids': [eve['id']]},
schema='Chat')['json']
res['attach_foreign_file'] = c.call('POST', '/api/v1/chats/%s/messages' % echat['id'], (404,), actor=eve,
body={'text': 'x', 'attachment_ids': [att['id']]},
headers={'Idempotency-Key': uuid.uuid4().hex})['status']