From 8eebde895b5a3e2ffe28ca816d30fc5994869ca2 Mon Sep 17 00:00:00 2001 From: pedrooot Date: Wed, 22 Oct 2025 11:09:20 -0400 Subject: [PATCH] feat(s3): support threatscore reporting --- api/src/backend/tasks/jobs/export.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/api/src/backend/tasks/jobs/export.py b/api/src/backend/tasks/jobs/export.py index 18ac9be656..e7f1a47eda 100644 --- a/api/src/backend/tasks/jobs/export.py +++ b/api/src/backend/tasks/jobs/export.py @@ -206,7 +206,12 @@ def _upload_to_s3(tenant_id: str, zip_path: str, scan_id: str) -> str | None: s3 = get_s3_client() # Upload the ZIP file (outputs) to the S3 bucket - zip_key = f"{tenant_id}/{scan_id}/{os.path.basename(zip_path)}" + # Preserve directory structure for threatscore and compliance subdirectories + zip_dir = os.path.basename(os.path.dirname(zip_path)) + if zip_dir in ("threatscore", "compliance"): + zip_key = f"{tenant_id}/{scan_id}/{zip_dir}/{os.path.basename(zip_path)}" + else: + zip_key = f"{tenant_id}/{scan_id}/{os.path.basename(zip_path)}" s3.upload_file( Filename=zip_path, Bucket=bucket,