From 494d5a66a6b2993ee9668048ab04968b69da9434 Mon Sep 17 00:00:00 2001 From: Raditya Date: Sat, 23 Oct 2021 22:13:18 +0700 Subject: [PATCH 1/3] Add bucket and key to message attributes --- common.py | 2 ++ scan.py | 23 ++++++++++++++++++++++- 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/common.py b/common.py index bb953fca..736ca841 100644 --- a/common.py +++ b/common.py @@ -33,6 +33,8 @@ AV_STATUS_SNS_PUBLISH_CLEAN = os.getenv("AV_STATUS_SNS_PUBLISH_CLEAN", "True") AV_STATUS_SNS_PUBLISH_INFECTED = os.getenv("AV_STATUS_SNS_PUBLISH_INFECTED", "True") AV_TIMESTAMP_METADATA = os.getenv("AV_TIMESTAMP_METADATA", "av-timestamp") +AV_SCAN_START_TIMESTAMP_METADATA = os.getenv("AV_SCAN_START_TIMESTAMP_METADATA", "av-start-timestamp") +AV_SCAN_RESULT_TIMESTAMP_METADATA = os.getenv("AV_SCAN_RESULT_TIMESTAMP_METADATA", "av-result-timestamp") CLAMAVLIB_PATH = os.getenv("CLAMAVLIB_PATH", "./bin") CLAMSCAN_PATH = os.getenv("CLAMSCAN_PATH", "./bin/clamscan") FRESHCLAM_PATH = os.getenv("FRESHCLAM_PATH", "./bin/freshclam") diff --git a/scan.py b/scan.py index 48545a06..e45dddf5 100644 --- a/scan.py +++ b/scan.py @@ -164,6 +164,16 @@ def sns_start_scan(sns_client, s3_object, scan_start_sns_arn, timestamp): TargetArn=scan_start_sns_arn, Message=json.dumps({"default": json.dumps(message)}), MessageStructure="json", + MessageAttributes={ + "bucket": { + "DataType": "String", + "StringValue": s3_object.bucket_name + }, + "key": { + "DataType": "String", + "StringValue": s3_object.key + } + } ) @@ -191,7 +201,18 @@ def sns_scan_results( Message=json.dumps({"default": json.dumps(message)}), MessageStructure="json", MessageAttributes={ - AV_STATUS_METADATA: {"DataType": "String", "StringValue": scan_result}, + "bucket": { + "DataType": "String", + "StringValue": s3_object.bucket_name + }, + "key": { + "DataType": "String", + "StringValue": s3_object.key + }, + AV_STATUS_METADATA: { + "DataType": "String", + "StringValue": scan_result + }, AV_SIGNATURE_METADATA: { "DataType": "String", "StringValue": scan_signature, From bd1e0bb79685c5dbf3607b027cfb5e3256c6bb4d Mon Sep 17 00:00:00 2001 From: Raditya Date: Tue, 26 Oct 2021 11:03:54 +0700 Subject: [PATCH 2/3] remove unused var --- common.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/common.py b/common.py index 736ca841..bb953fca 100644 --- a/common.py +++ b/common.py @@ -33,8 +33,6 @@ AV_STATUS_SNS_PUBLISH_CLEAN = os.getenv("AV_STATUS_SNS_PUBLISH_CLEAN", "True") AV_STATUS_SNS_PUBLISH_INFECTED = os.getenv("AV_STATUS_SNS_PUBLISH_INFECTED", "True") AV_TIMESTAMP_METADATA = os.getenv("AV_TIMESTAMP_METADATA", "av-timestamp") -AV_SCAN_START_TIMESTAMP_METADATA = os.getenv("AV_SCAN_START_TIMESTAMP_METADATA", "av-start-timestamp") -AV_SCAN_RESULT_TIMESTAMP_METADATA = os.getenv("AV_SCAN_RESULT_TIMESTAMP_METADATA", "av-result-timestamp") CLAMAVLIB_PATH = os.getenv("CLAMAVLIB_PATH", "./bin") CLAMSCAN_PATH = os.getenv("CLAMSCAN_PATH", "./bin/clamscan") FRESHCLAM_PATH = os.getenv("FRESHCLAM_PATH", "./bin/freshclam") From 07897ac07bb5959f108a9da7d342f59c2f749245 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Fri, 12 Apr 2024 07:00:34 +0000 Subject: [PATCH 3/3] Bump the pip group across 1 directory with 4 updates Bumps the pip group with 4 updates in the / directory: [certifi](https://github.com/certifi/python-certifi), [idna](https://github.com/kjd/idna), [requests](https://github.com/psf/requests) and [urllib3](https://github.com/urllib3/urllib3). Updates `certifi` from 2018.11.29 to 2023.7.22 - [Commits](https://github.com/certifi/python-certifi/compare/2018.11.29...2023.07.22) Updates `idna` from 2.8 to 3.7 - [Release notes](https://github.com/kjd/idna/releases) - [Changelog](https://github.com/kjd/idna/blob/master/HISTORY.rst) - [Commits](https://github.com/kjd/idna/compare/v2.8...v3.7) Updates `requests` from 2.21 to 2.31.0 - [Release notes](https://github.com/psf/requests/releases) - [Changelog](https://github.com/psf/requests/blob/main/HISTORY.md) - [Commits](https://github.com/psf/requests/compare/v2.21.0...v2.31.0) Updates `urllib3` from 1.24.2 to 1.26.18 - [Release notes](https://github.com/urllib3/urllib3/releases) - [Changelog](https://github.com/urllib3/urllib3/blob/main/CHANGES.rst) - [Commits](https://github.com/urllib3/urllib3/compare/1.24.2...1.26.18) --- updated-dependencies: - dependency-name: certifi dependency-type: direct:production dependency-group: pip - dependency-name: idna dependency-type: direct:production dependency-group: pip - dependency-name: requests dependency-type: direct:production dependency-group: pip - dependency-name: urllib3 dependency-type: direct:production dependency-group: pip ... Signed-off-by: dependabot[bot] --- requirements.txt | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/requirements.txt b/requirements.txt index 01c63d97..095bcf5e 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,9 +1,9 @@ -certifi==2018.11.29 +certifi==2023.7.22 chardet==3.0.4 datadog==0.26.0 decorator==4.3 -idna==2.8 -requests==2.21 +idna==3.7 +requests==2.31.0 simplejson==3.16 -urllib3==1.24.2 +urllib3==1.26.18 pytz==2019.3