diff options
| author | Chris Lu <chrislusf@users.noreply.github.com> | 2025-10-30 11:00:31 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-10-30 11:00:31 -0700 |
| commit | d00a2a87074f5cc2dd13f54fcf861d2dda318b35 (patch) | |
| tree | 436ee65ccfd5bed87a5edc08384f4a48cc159103 /k8s/charts | |
| parent | 8a032bf57db2e29cf636be954da8c0cbdf2f10b0 (diff) | |
| download | seaweedfs-d00a2a87074f5cc2dd13f54fcf861d2dda318b35.tar.xz seaweedfs-d00a2a87074f5cc2dd13f54fcf861d2dda318b35.zip | |
Fix S3 bucket policy ARN validation to accept AWS ARNs and simplified formats (#7409)
* Fix S3 bucket policy ARN validation to accept AWS ARNs and simplified formats
Fixes #7252
The bucket policy validation was rejecting valid AWS-style ARNs and
simplified resource formats, causing validation failures with the
error 'resource X does not match bucket X' even when they were
identical strings.
Changes:
- Updated validateResourceForBucket() to accept three formats:
1. AWS-style ARNs: arn:aws:s3:::bucket-name[/*|/path]
2. SeaweedFS ARNs: arn:seaweed:s3:::bucket-name[/*|/path]
3. Simplified formats: bucket-name[/*|/path]
- Added comprehensive test coverage for all three formats
- Added specific test cases from issue #7252 to prevent regression
This ensures compatibility with standard AWS S3 bucket policies
while maintaining support for SeaweedFS-specific ARN format.
* Refactor validateResourceForBucket to reduce code duplication
Simplified the validation logic by stripping ARN prefixes first,
then performing validation on the remaining resource path.
This reduces code duplication and improves maintainability while
maintaining identical functionality.
Addresses review feedback from Gemini Code Assist.
* Use strings.CutPrefix for cleaner ARN prefix stripping
Replace strings.HasPrefix checks with strings.CutPrefix for more
idiomatic Go code. This function is available in Go 1.20+ and
provides cleaner conditional logic with the combined check and
extraction.
Addresses review feedback from Gemini Code Assist.
Diffstat (limited to 'k8s/charts')
0 files changed, 0 insertions, 0 deletions
