# s3-security: lab4: private bucket outside API, limited API key, no console/ports, idempotent bootstrap
# date: 2026-11-07 19:40:34, commit: 20afc2c + uncommitted changes
# command: python.exe student-tests/test_s3_security.py
# exit code: 0, 9.6 s

anonymous get_object directly to S3 (from the data network) -> 403 AccessDenied
anonymous head_object directly to S3 (from the data network) -> 403 
anonymous list_bucket directly to S3 (from the data network) -> 403 AccessDenied
anonymous put_object directly to S3 (from the data network) -> 403 AccessDenied
anonymous get_bucket_policy directly to S3 (from the data network) -> 403 AccessDenied
the same file through the API for a chat member -> 200
PASS: the bucket is private: no anonymous read, list, write or policy read
API key: list buckets                     -> []
API key: get own object                   -> allowed
API key: put object                       -> allowed
API key: delete object                    -> allowed
API key: put into attachments/ (worker's prefix) -> denied: AccessDenied
API key: list bucket                      -> denied: AccessDenied
API key: create another bucket            -> denied: AccessDenied
API key: make bucket public (put policy)  -> denied: AccessDenied
API key: read bucket policy               -> denied: AccessDenied
API key: delete bucket                    -> denied: AccessDenied
API key: change versioning                -> denied: AccessDenied
PASS: the API key can only read finished files and put/delete upload sources in staging/; listing, other prefixes, bucket admin, policy and other buckets are denied
compose: s3 has no published ports, only the internal network 'data' (S3 8333, master UI 9333, filer UI 8888 are reachable only inside the stand)
127.0.0.1:8333 from the host -> connection refused
127.0.0.1:18333 from the host -> connection refused
file secrets of grafana: ['grafana_admin_password']
file secrets of postgres: ['postgres_password']
file secrets of rabbitmq: ['rabbitmq_definitions']
file secrets of s3: ['s3_config']
PASS: S3 is reachable only inside the stand (HTTPS); the key config is only in s3; services get their own limited keys from OpenBao, the admin key only s3-init
s3-init: s3-init: bucket messenger-attachments exists
s3-init: s3-init: bucket is private (anonymous list/get/put -> [403])
after the repeated bootstrap: old file downloads, new upload works
PASS: bucket/user/policy bootstrap can be repeated safely
4 passed, 0 failed
