Files
floci/src/test
Martin Acosta 1ae5c22f83 fix(sns): match String.Array attributes per element and honour $or in filter policies (#3746)
A subscription filter policy compared a String.Array message attribute against its
serialized JSON array as a single opaque string, so a policy rule of "Name" never
matched an attribute of ["Name","stringName"]. Any subscription filtering on a
multi-valued header silently matched nothing. AWS treats each element as a separate
string: a positive rule matches when any element matches, while anything-but matches
only when no element is listed, and exists asks about the attribute rather than its
elements.

$or was not recognised at all. The key was looked up as a message attribute literally
named "$or", which never exists, so the subscription went silent with no warning. It
is now honoured in both MessageAttributes and MessageBody scope under the conditions
AWS requires -- an array of at least two objects, none using a reserved operator name
as a field name -- and otherwise falls back to being an ordinary key, as AWS does.
EventBridge already had $or; SNS never got it.

Parsing the array value uses FAIL_ON_TRAILING_TOKENS, so a value like "[\"a\"] junk"
is treated as malformed and matched whole rather than element-matching as ["a"].
2026-09-16 15:42:13 -04:00
..