Skip to content

[FEATURE] Support S3 event notifications #4

Description

@eugene100

Problem:
I'm going to implement the next scenario. When a new file uploaded to S3 bucket it should be checked by AV. S3 event notifications can send messages to a SQS notification queue, but format of a message is different than mousetrap expected.

Suggested solution::
Add extra validation for message what expected S3 message pattern: "eventSource": "aws:s3"

Example of S3 message:

{
    "Records": [
        {
            "eventVersion": "2.1",
            "eventSource": "aws:s3",
            "awsRegion": "us-east-1",
            "eventTime": "2020-11-15T17:03:43.718Z",
            "eventName": "ObjectCreated:Put",
            "userIdentity": {
                "principalId": "AWS:xxx"
            },
            "requestParameters": {
                "sourceIPAddress": "4.79.40.174"
            },
            "responseElements": {
                "x-amz-request-id": "7F3CBD63501C6716",
                "x-amz-id-2": "IETQzK13GB6UwPKyHVA20DqxsSHOVy9O5jtPronMbykSLJzErxPghyzGbKmeQnZ7vfBHXoe1Y2JFcSfjlI5hmq1z6S3JBO2M"
            },
            "s3": {
                "s3SchemaVersion": "1.0",
                "configurationId": "eugene-av",
                "bucket": {
                    "name": "eugene-av",
                    "ownerIdentity": {
                        "principalId": "A277FPSBMIAL09"
                    },
                    "arn": "arn:aws:s3:::eugene-av"
                },
                "object": {
                    "key": "photo_2020-10-29_19-20-49.jpg",
                    "size": 30573,
                    "eTag": "f9ee8886f30bd40963d327ef2d81a1f3",
                    "sequencer": "005FB15F7536F961A3"
                }
            }
        }
    ]
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions