fix(s3): ListObjectsV2 must not surface delete markers as live objects (#316)#317
Merged
Conversation
ListObjectsV2 (and ListObjects) surfaced delete markers as live objects on versioning-enabled buckets. DeleteObjects correctly inserted delete markers but loadObjectEntry did not skip entries where IsDeleteMarker is true, so aws s3 ls showed objects that GetObject correctly returned 404 for. Adds the same IsDeleteMarker guard that getObject already carries, and a regression test (TestS3_DeleteObjects_Versioned_HiddenFromList) that verifies ListObjectsV2 returns zero objects after a multi-delete on a versioned bucket.
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
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.
Summary
loadObjectEntry(used byListObjectsV2andListObjects) did not filter entries whereIsDeleteMarkeris trueDeleteObjectsinserts delete markers rather than removing the state key; without the filter,aws s3 lsshowed objects thatGetObjectcorrectly returned 404 forIsDeleteMarkerguard thatgetObjectalready carriesChanges
emulator/s3_plugin.go: three-line fix inloadObjectEntry— returnnil, nilwhenobj.IsDeleteMarkeris trueemulator/s3_plugin_test.go: regression testTestS3_DeleteObjects_Versioned_HiddenFromListCHANGELOG.md: move entry to[v0.68.1]Test plan
go test ./emulator/ -run TestS3_DeleteObjects_Versioned_HiddenFromList— new regression test passesgo test ./emulator/ -run TestS3— all existing S3 tests still passgo test ./emulator/ -count=1— full suite cleanCloses #316