Skip to content

fix(objectstorage): tighten public read bucket policy#7066

Merged
dinoallo merged 3 commits into
labring:mainfrom
nowinkeyy:fix/objectstorage-public-read-policy
Jul 20, 2026
Merged

fix(objectstorage): tighten public read bucket policy#7066
dinoallo merged 3 commits into
labring:mainfrom
nowinkeyy:fix/objectstorage-public-read-policy

Conversation

@nowinkeyy

Copy link
Copy Markdown
Contributor

No description provided.

@nowinkeyy
nowinkeyy requested a review from a team as a code owner July 17, 2026 03:50
@nowinkeyy nowinkeyy changed the title fix: tighten public read bucket policy fix(objectstorage): tighten public read bucket policy Jul 17, 2026
@nowinkeyy
nowinkeyy force-pushed the fix/objectstorage-public-read-policy branch from 6ce418f to edaee13 Compare July 17, 2026 04:04
@nowinkeyy
nowinkeyy force-pushed the fix/objectstorage-public-read-policy branch from edaee13 to 9998231 Compare July 17, 2026 06:59

@dinoallo dinoallo left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ListBucket should also be disabled in PublicReadWrite

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR tightens the generated S3 bucket policies for “public” buckets in the objectstorage controller, primarily removing anonymous bucket-list/location permissions while adding/adjusting policy tests to prevent regressions.

Changes:

  • Restrict PublicReadBucketPolicy and PublicReadwriteBucketPolicy to avoid anonymous bucket listing/location actions (keep object-level actions only).
  • Refactor BucketServiceAccountPolicy statements to separate bucket-level vs object-level resources/actions more cleanly.
  • Add unit tests for buildPolicy(...) to validate the intended action/resource split and the tightened public policies.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
controllers/objectstorage/main.go Import/flag formatting changes; introduces an unused CLI flag and removes kubebuilder scaffold marker.
controllers/objectstorage/controllers/suite_test.go Test file import/var formatting; removes kubebuilder scaffold marker.
controllers/objectstorage/controllers/objectstorageuser_controller.go Mostly formatting and minor error/string conversion adjustments.
controllers/objectstorage/controllers/objectstoragebucket_controller.go Tightens public bucket policy generation and refactors service account policy statements.
controllers/objectstorage/controllers/objectstoragebucket_controller_test.go Adds unit tests covering policy JSON and action/resource expectations.

Comment thread controllers/objectstorage/main.go
Comment thread controllers/objectstorage/main.go
Comment thread controllers/objectstorage/controllers/suite_test.go
Comment thread controllers/objectstorage/main.go Outdated
@dinoallo dinoallo added this to the v5.2 milestone Jul 20, 2026
@dinoallo
dinoallo merged commit 53c913f into labring:main Jul 20, 2026
13 of 14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants