fix: deny public read on MinIO signatures prefix #209
No reviewers
Labels
No labels
domain:backend
domain:devops
domain:frontend
status:approved
status:in-progress
status:needs-fix
status:qa
type:bug
type:devops
type:feature
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
forgejo_admin/pal-e-platform!209
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "186-minio-signature-policy-fix"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Contract signature images in
assets/westside/signatures/were publicly accessible via the MinIO CDN because the bucket policy granteds3:GetObjectonarn:aws:s3:::assets/*with no exclusions. This adds an explicit Deny statement for the signatures prefix so they return 403, while all other CDN assets (branding, coaches, sponsors, email images) remain publicly readable.Changes
terraform/modules/storage/main.tf:75-96-- Replaced single Allow-all statement with a two-statement policy: an explicitDenyPublicSignaturesonassets/westside/signatures/*followed byAllowPublicAssetsonassets/*. In S3 policy evaluation, explicit Deny always overrides Allow.tofu plan Output
Test Plan
tofu applythe changecurl -sI "https://minio-api.tail5b443a.ts.net/assets/westside/signatures/108_1774343239303.png"returns 403curl -sI "https://minio-api.tail5b443a.ts.net/assets/westside/branding/logo.png"returns 200 (public assets unaffected)Review Checklist
tofu fmtandtofu validateRelated Notes
project-westside-basketball-- the project this work belongs toarch-deployment-westside-basketball-- related architectureQA Review -- PR #209
Diff Analysis
Single file change:
terraform/modules/storage/main.tf(+16, -6). Replaces a single Allow-all bucket policy statement with a two-statement policy adding an explicit Deny onassets/westside/signatures/*.Findings
Policy correctness: The S3/MinIO policy evaluation model grants explicit Deny absolute precedence over Allow, regardless of statement ordering. This is the correct and idiomatic approach -- no edge cases where Allow could override.
Authenticated access unaffected: The Deny targets
Principal: { AWS: ["*"] }(anonymous public access only). Service accounts authenticating via IAM credentials (e.g., the westside-contracts upload user) are governed by their own IAM policy, not this anonymous bucket policy. Write path is safe.Formatting and validation:
tofu fmtproduced no changes,tofu validatepassed. Plan output included and shows exactly 1 in-place update.Scope: Tight -- 1 resource, 1 file, no blast radius. No changes to other buckets, IAM users, or policies.
Nits
None.
VERDICT: APPROVE
Clean security fix. Explicit Deny is the correct S3 policy pattern. No regressions possible on the public CDN paths or the authenticated upload path.