Files
seaweedfs/weed/s3api/policy_engine
Chris LuandClaude Opus 5.5 8053e77813 s3api: decide existing-object-tag denies on the object's tags (#13038)
* s3api: report a bucket policy Deny on existing object tags

HasExistingObjectTagDeny tells whether a bucket policy has a Deny statement
conditioned on s3:ExistingObjectTag/<key>, so the auth layer knows when a
deny may turn on tags it has not read yet.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* s3api: decide existing-object-tag denies on the object's tags

The auth layer evaluates the bucket policy before the handler reads the
object, so s3:ExistingObjectTag/<key> resolves to a missing tag. A Deny
with a negated condition (StringNotEquals, StringNotLike,
StringNotEqualsIgnoreCase, Null true) then matched every object and was
final, even one whose tag satisfies it, as in the deny-until-scanned-clean
pattern.

When that early evaluation denies and the policy has such a Deny, look up
the object's entry and evaluate again with its tags. A missing object or a
failed lookup keeps the deny. Copy sources and per-key checks that go
through authorizeObjectKeyAction get the same treatment.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* s3api: give identity checks the object tags a Deny was decided on

With IAM integration, VerifyActionPermission evaluates the mirrored bucket
policy again alongside the identity's policies, from a condition context
built from the request alone. The negated existing-tag Deny matched there
once more and denied an object tagged to pass it.

evaluateBucketPolicy now returns the request carrying the tags it read,
and RequestConditionValues reports them as s3:ExistingObjectTag/<key>.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* s3api: recheck in-flight tag conditions on the version served

An in-flight request is authorized again when access changes. The entry
lookup read the version current by then, so a newer version tagged to
pass the Deny could keep a download of an older, denied version running.
The handler's entry recheck now records the entry it authorized on the
tracked request, and the re-check decides on that entry.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* s3api: load the bucket before deciding an object request on its policy

On a bucket whose policy was not loaded yet, the early bucket policy check
found no policy and skipped the object-tag lookup, so the identity checks
saw the request without the object's tags.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* s3api: keep an owned copy of the entry a tracked request served

Handlers change the entry's metadata after the check, for example when
storing new tags, so revalidation read a map the handler was writing.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-26 21:58:10 -08:00
..
2026-02-20 18:42:00 -08:00
2025-07-13 16:21:36 -07:00