Merged
Conversation
994f689 to
e3fcc46
Compare
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds support for tag-based bucket policy conditions (specifically s3:ExistingObjectTag/<tag-key>) to enable per-object access control through bucket policies. This addresses issue #1874, which requested the ability to allow anonymous public access to specific objects in a bucket while keeping others private, based on object tags.
Changes:
- Added
get_object_tag_conditions_for_policymethod to fetch and format object tags as policy condition values - Introduced
ObjectTagConditionsstruct to pass tag conditions through the authorization flow - Integrated object tag condition evaluation into GetObject, HeadObject, and GetObjectAttributes authorization checks
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 7 comments.
| File | Description |
|---|---|
| rustfs/src/storage/ecfs.rs | Added method to fetch object tags and format them as ExistingObjectTag conditions for policy evaluation |
| rustfs/src/storage/access.rs | Added ObjectTagConditions struct and integrated tag condition fetching into authorization flow for GetObject, HeadObject, and GetObjectAttributes operations |
b96dcdd to
54f9e60
Compare
72bb5dc to
f258118
Compare
…ject Move req_info bucket/object/version_id update before fetch_tag_conditions for consistency with other S3 operations (delete_object, get_object, etc.).
f258118 to
821dfc1
Compare
loverustfs
approved these changes
Feb 27, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 3 out of 3 changed files in this pull request and generated no new comments.
Comments suppressed due to low confidence (1)
rustfs/src/storage/access.rs:610
- In
copy_object, after authorizing GetObject on the source with source object tags, the sameObjectTagConditionsremain inreq.extensionswhen authorizing PutObject on the destination. This means the destination PutObject authorization will incorrectly use the source object's tags in its policy conditions instead of no tags (since the destination doesn't exist yet) or the destination's tags (if copying to an existing object). Consider removing or replacing the tag conditions before the second authorization, or fetch destination tags if the destination object exists.
let tag_conds = self
.fetch_tag_conditions(&src_bucket, &src_key, version_id.as_deref(), "copy_object_src")
.await?;
req.extensions.insert(tag_conds);
authorize_request(req, Action::S3Action(S3Action::GetObjectAction)).await?;
}
let req_info = req.extensions.get_mut::<ReqInfo>().expect("ReqInfo not found");
req_info.bucket = Some(req.input.bucket.clone());
req_info.object = Some(req.input.key.clone());
req_info.version_id = req.input.version_id.clone();
authorize_request(req, Action::S3Action(S3Action::PutObjectAction)).await
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Type of Change
Related Issues
Summary of Changes
#1874 (comment)
Checklist
make pre-commitImpact
Additional Notes
Thank you for your contribution! Please ensure your PR follows the community standards (CODE_OF_CONDUCT.md) and sign the CLA if this is your first contribution.