Files
floci/docs/services
lex00 09b1dc0803 fix(iam): resolve s3:ExistingObjectTag and s3:RequestObjectTag under enforcement (#3946)
* fix(iam): resolve s3:ExistingObjectTag and s3:RequestObjectTag under enforcement

The S3 condition context was built for s3:ListBucket and the bucket-tagging
actions only, so a statement conditioned on an object tag never matched and
a tag-conditioned allow denied everything, including what AWS allows.

Object reads are now given s3:ExistingObjectTag/<key> from the object's
tags, PutObject is given s3:RequestObjectTag/<key> from x-amz-tagging, and
PutObjectTagging both. Which action gets which key follows what real AWS
was measured to do rather than what reads naturally: s3:DeleteObject is
given neither, and s3:PutObject never sees the tags of an object it is
about to overwrite.

A PutObject carrying If-Match is additionally authorized as s3:GetObject
with the object tags stripped from the context, as measured: under a
tag-conditioned GetObject allow the conditional write is denied, under a
prefix-scoped one it succeeds, and If-None-Match needs no such permission.
The per-resource evaluation loop is extracted into abortIfDenied so the
second authorization reuses it rather than duplicating it.

The class comment named floci.iam.enforcement-enabled; the key that works
is floci.services.iam.enforcement-enabled.

Closes #209

(cherry picked from commit 402920cf137c98f45283ad093f3df97807bb1dc7)

* fix(iam): authorize an object-tag condition against the version the request names

Review follow-ups on #3946.

s3:ExistingObjectTag was read from the current version whatever the request
asked for, so an allow conditioned on a tag decided a versioned read against
tags the older version does not carry, letting it through. The lookup now
passes the versionId query parameter, via a new S3Service.getObjectTagging
overload that takes one.

A malformed x-amz-tagging value such as "a=%zz" threw IllegalArgumentException
out of URLDecoder inside the filter, answering 500 where S3 returns 400
InvalidTag. An undecodable pair is now dropped, so the policy decides.

Documents both condition keys under "Condition keys floci populates" in
docs/services/iam.md, including which actions receive them, the If-Match
coupling, and that s3:RequestObjectTagKeys is not populated.

Replaces the two var declarations in the new test with explicit types, and
drops the downstream project's name from the comments and test fixtures.
2026-09-21 19:44:35 -04:00
..
2026-05-10 11:53:31 -05:00
2026-08-21 00:09:04 -04:00
2026-09-21 19:42:22 -04:00