Skip to content

Commit 079c1a1

Browse files
committed
Propagate the latest bugfixes and improvements
* Supply VirusTotal API key from SSM which is queried directly by the dmr-initiator Lambda * Provide an error when VirusTotal scan is successful but the file cannot be scanned with Clamav (file could be too large, exceeding the multipart upload timeout or lambda hard-cap runtime) * Add maximum retention to DMR queue to ensure that a DMR does not sit on the queue indefinitely should something go wrong
1 parent 0173b5f commit 079c1a1

File tree

5 files changed

+21
-3
lines changed

5 files changed

+21
-3
lines changed

functions/dmr-clamav.zip

-28.2 KB
Binary file not shown.

functions/dmr-initiator.zip

8.66 KB
Binary file not shown.

functions/dmr-jira.zip

35 KB
Binary file not shown.

lambda-dmr-initiator.tf

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,24 @@ variable dmr_initiator {
33
default = "dmr-initiator"
44
}
55

6+
# Generate a placeholder VirusTotal API key to be updated manually
7+
resource "aws_ssm_parameter" "virustotal_apikey" {
8+
name = "/dmr/virustotal"
9+
type = "SecureString"
10+
key_id = CHANGEME
11+
value = "PLACEHOLDER_REPLACEBYHAND"
12+
overwrite = false
13+
lifecycle {
14+
ignore_changes = [value, key_id]
15+
}
16+
}
17+
18+
# Lookup value post creation
19+
data "aws_ssm_parameter" "virustotal_apikey" {
20+
name = "/dmr/virustotal"
21+
depends_on = [aws_ssm_parameter.virustotal_apikey]
22+
}
23+
624
resource "aws_lambda_alias" "dmr_initiator" {
725
name = var.dmr_initiator
826
description = "Handle DMR requests"
@@ -22,7 +40,7 @@ resource "aws_lambda_function" "dmr_initiator" {
2240
environment {
2341
variables = {
2442
LOG_LEVEL = var.lambda_loglevel
25-
VT_API_KEY = var.vt_api_key
43+
VT_API_KEY = data.aws_ssm_parameter.virustotal_apikey.value
2644
S3_STAGING_BUCKET = aws_s3_bucket.dmr_staging_bucket.id
2745
SEND_JIRA_COMMENT = var.create_jira
2846
DMR_JIRA_ARN = var.create_jira ? aws_lambda_function.dmr_jira[0].arn : ""

sqs-dmr-queue.tf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
resource "aws_sqs_queue" "dmr_queue" {
22
name = "dmr-queue"
3-
delay_seconds = 10
3+
delay_seconds = 1
44
max_message_size = 2048
5-
message_retention_seconds = 86400
5+
message_retention_seconds = 600
66
visibility_timeout_seconds = 900
77

88
tags = {

0 commit comments

Comments
 (0)