Skip to content

s3 touch not properly evaluated for url encoded filters  #5

@trentgerman

Description

@trentgerman

S3Touch.evaluate_filter improperly returns false for filters that require url encoding.

For example ->

afilter = {'Key': {'FilterRules': [{'Name': 'Prefix', 'Value': 'shopping_cart_svc/payload_version%3D1/event%3Ditem_note_removed'}]}}We have used these filters in production for some time and they work for the s3 key below. 

akey = {'Key': 'shopping_cart_svc/payload_version=1/event=item_note_added/2019/03/13/19/analytics_events-1-2019-03-13-19-13-30-14b0720a-dbda-4469-b441-eec5cab90fce.gz', 'LastModified': '2019-12-02T22:30:45.000Z', 'ETag': '"af8b97e1eb90540e0a15113a3432a317"', 'Size': 2402, 'StorageClass': 'STANDARD'}

import boto3
from awscli.plugins.s3touch import S3Touch
cmd = S3Touch(boto3.Session())

cmd.evaluate_filter(afilter, akey)

This returns False

Suggested fix -> use urllib.parse.quote when doing string comparison.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions