Conversation
…n mapping Fix three S3 compatibility bugs: 1. Policy StringNotEquals/StringNotEqualsIgnoreCase conditions were double-negated: once via the `negate` parameter in evaluate_with_resolver and again via is_negate(), making them behave like StringEquals. Remove the redundant negation in is_negate() for string conditions (NotIpAddress still correctly uses is_negate() as its sole negation mechanism). 2. delete_objects used a HashMap<object_name, index> to map results back, causing only the last version per key to be recorded when deleting multiple versions of the same object. Replace with a Vec<usize> for position-based mapping. 3. Add missing S3 policy condition keys (x-amz-grant-*) for ACL grant conditions. Made-with: Cursor
Contributor
There was a problem hiding this comment.
Pull request overview
Fixes S3-compatibility issues in policy condition evaluation and multi-object delete responses, and updates the s3-tests tracking lists accordingly.
Changes:
- Correct
StringNotEquals*condition evaluation by removing unintended double-negation. - Fix
DeleteObjectsresponse index mapping for multiple versions of the same key. - Add missing S3 policy condition keys for ACL grant headers and expand policy test coverage.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| scripts/s3-tests/unimplemented_tests.txt | Updates the “failed tests” list/count after fixing previously failing cases. |
| scripts/s3-tests/implemented_tests.txt | Moves newly passing tests into the implemented list and updates totals/notes. |
| rustfs/src/app/object_usecase.rs | Reworks DeleteObjects index mapping to handle duplicate keys (multiple versions) correctly. |
| crates/policy/src/policy/policy.rs | Adds an integration-style test for deny logic using StringNotEquals + Null. |
| crates/policy/src/policy/function/key_name.rs | Adds missing s3:x-amz-grant-* condition key definitions. |
| crates/policy/src/policy/function/condition.rs | Fixes negation logic for StringNotEquals* and adds unit tests for condition evaluation. |
Address review: object_sizes was keyed by object_name alone, causing size overwrites when deleting multiple versions of the same key. Replace HashMap<String, i64> with Vec<i64> parallel to object_to_delete so each entry tracks its own size independently. Made-with: Cursor
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
Fix three S3 compatibility bugs that caused 3 s3-tests to fail:
1. Policy
StringNotEqualsdouble negation (condition.rs)StringNotEqualsandStringNotEqualsIgnoreCaseconditions were being negated twice:negate=trueparameter passed toevaluate_with_resolveris_negate()inCondition::evaluate_with_resolverThis double negation made
StringNotEqualsbehave identically toStringEquals, breaking any bucket policy that usedStringNotEqualsconditions (e.g., deny PutObject unless encryption matches a specific algorithm).Fix: Remove
StringNotEqualsandStringNotEqualsIgnoreCasefromis_negate(), since they already handle negation via thenegateparameter.NotIpAddressstill correctly usesis_negate()as its sole negation mechanism.Tests fixed:
test_bucket_policy_put_obj_kms_s3,test_bucket_policy_put_obj_s3_kms2.
delete_objectsversion mapping bug (object_usecase.rs)execute_delete_objectsusedHashMap<object_name, index>to map deletion results back to the original request indices. When deleting multiple versions of the same key, only the last version's index was stored — previous versions were silently lost from the response.Fix: Replace
HashMap<String, usize>withVec<usize>for position-based index mapping, correctly tracking each version independently.Test fixed:
test_versioning_concurrent_multi_object_delete3. Missing S3 policy condition keys (key_name.rs)
Added
s3:x-amz-grant-full-control,s3:x-amz-grant-read,s3:x-amz-grant-write,s3:x-amz-grant-read-acp,s3:x-amz-grant-write-acpcondition key definitions to support ACL grant policy conditions.Checklist
make pre-commitImpact
Additional Notes
StringNotEqualscondition evaluation incondition.rs(3 tests)BucketPolicydeny withStringNotEqualsandNullconditions inpolicy.rsimplemented_tests.txt(228 → 231) andunimplemented_tests.txt(17 → 11 failed)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.
Made with Cursor