Your requirement is to filter and pass messages if:
- The source attribute is missing
- The source attribute exists and it should be anything-but SOME_STRING.
Amazon SNS Subscription policy accepts messages under the following conditions.
1) Each attribute name in a filter policy matches an attribute name assigned to the message.
2) For each matching attribute name, at least one match exists between
the following:
--> the values of the attribute name in the filter policy
--> the message attributes
As you can see in the given documentation for SNS Subscription filter policies, any message that does not contain the filtering attribute, or if that attribute value does not meet the policy, the message will be rejected.
According to your example, you CANNOT filter and pass messages which does not contain the "source" attribute. But you can filter if the source attribute exists and it should be anything-but SOME_STRING.
Workaround for this.
Assuming that you have access to the message generating source, make sure that every message contains the attribute "source", before pushing it to SNS. Then you can easily filter out if it is anything-but SOME_STRING.