diff options
| author | chrislu <chris.lu@gmail.com> | 2025-12-09 00:17:29 -0800 |
|---|---|---|
| committer | chrislu <chris.lu@gmail.com> | 2025-12-09 00:17:29 -0800 |
| commit | 4e6e7b6ac5eaf340a8755882c147fb2d7fac2714 (patch) | |
| tree | e133355e2651d0af1292cae57f264e642534db64 /weed/s3api/auth_credentials.go | |
| parent | 50eba1ecf8fc7ec46fb5f4e410cee4ee835828f5 (diff) | |
| download | seaweedfs-4e6e7b6ac5eaf340a8755882c147fb2d7fac2714.tar.xz seaweedfs-4e6e7b6ac5eaf340a8755882c147fb2d7fac2714.zip | |
Implement tag-based policy re-check in handlers
- Add checkPolicyWithEntry helper to S3ApiServer for handlers to re-check
policy after fetching object entry (for s3:ExistingObjectTag conditions)
- Add HasPolicyForBucket method to policy engine for efficient check
- Integrate policy re-check in GetObjectHandler after entry is fetched
- Integrate policy re-check in HeadObjectHandler after entry is fetched
- Update auth_credentials.go comments to explain two-phase evaluation
- Update documentation with supported operations for tag-based conditions
This implements 'Approach 1' where handlers re-check the policy with
the object entry after fetching it, allowing tag-based conditions to
be properly evaluated.
Diffstat (limited to 'weed/s3api/auth_credentials.go')
| -rw-r--r-- | weed/s3api/auth_credentials.go | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/weed/s3api/auth_credentials.go b/weed/s3api/auth_credentials.go index 378788084..3f4670a7e 100644 --- a/weed/s3api/auth_credentials.go +++ b/weed/s3api/auth_credentials.go @@ -582,7 +582,9 @@ func (iam *IdentityAccessManagement) authRequest(r *http.Request, action Action) // - No policy or indeterminate → fall through to IAM checks if iam.policyEngine != nil && bucket != "" { principal := buildPrincipalARN(identity) - // Evaluate bucket policy (objectEntry nil - not yet fetched at auth time) + // Phase 1: Evaluate bucket policy without object entry. + // Tag-based conditions (s3:ExistingObjectTag) are re-checked by handlers + // after fetching the entry, which is the Phase 2 check. allowed, evaluated, err := iam.policyEngine.EvaluatePolicy(bucket, object, string(action), principal, r, nil) if err != nil { |
