From 87455f8092afaee02a443455ac30f9c3d0649dbe Mon Sep 17 00:00:00 2001 From: Naomi Carrigan Date: Wed, 17 Dec 2025 23:16:12 +0100 Subject: [PATCH] fix: maybe post requests? better logging just in case --- .gitea/workflows/security.yml | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/.gitea/workflows/security.yml b/.gitea/workflows/security.yml index 196cc6a..3169f83 100644 --- a/.gitea/workflows/security.yml +++ b/.gitea/workflows/security.yml @@ -73,6 +73,9 @@ jobs: DD_TOKEN: ${{ secrets.DD_TOKEN }} run: | echo "Uploading Trivy results..." + # Generate today's date in YYYY-MM-DD format + TODAY=$(date +%Y-%m-%d) + HTTP_CODE=$(curl --write-out "%{http_code}" --output response.txt --silent -X POST "$DD_URL/api/v2/import-scan/" \ -H "Authorization: Token $DD_TOKEN" \ -F "active=true" \ @@ -80,11 +83,15 @@ jobs: -F "scan_type=Trivy Scan" \ -F "engagement_name=CI/CD Pipeline" \ -F "product_name=${{ github.repository }}" \ + -F "scan_date=$TODAY" \ + -F "auto_create_context=true" \ -F "file=@trivy-results.json") if [[ "$HTTP_CODE" != "200" && "$HTTP_CODE" != "201" ]]; then echo "::error::Upload Failed with HTTP $HTTP_CODE" + echo "--- SERVER RESPONSE ---" cat response.txt + echo "-----------------------" exit 1 else echo "Upload Success!" @@ -105,7 +112,9 @@ jobs: DD_URL: ${{ secrets.DD_URL }} DD_TOKEN: ${{ secrets.DD_TOKEN }} run: | - echo "Uploading Gitleaks results..." + echo "Uploading Gitleaks results..." + TODAY=$(date +%Y-%m-%d) + HTTP_CODE=$(curl --write-out "%{http_code}" --output response.txt --silent -X POST "$DD_URL/api/v2/import-scan/" \ -H "Authorization: Token $DD_TOKEN" \ -F "active=true" \ @@ -113,11 +122,15 @@ jobs: -F "scan_type=Gitleaks Scan" \ -F "engagement_name=CI/CD Pipeline" \ -F "product_name=${{ github.repository }}" \ + -F "scan_date=$TODAY" \ + -F "auto_create_context=true" \ -F "file=@gitleaks-results.json") if [[ "$HTTP_CODE" != "200" && "$HTTP_CODE" != "201" ]]; then echo "::error::Upload Failed with HTTP $HTTP_CODE" + echo "--- SERVER RESPONSE ---" cat response.txt + echo "-----------------------" exit 1 else echo "Upload Success!" @@ -140,6 +153,8 @@ jobs: DD_TOKEN: ${{ secrets.DD_TOKEN }} run: | echo "Uploading Semgrep results..." + TODAY=$(date +%Y-%m-%d) + HTTP_CODE=$(curl --write-out "%{http_code}" --output response.txt --silent -X POST "$DD_URL/api/v2/import-scan/" \ -H "Authorization: Token $DD_TOKEN" \ -F "active=true" \ @@ -147,11 +162,15 @@ jobs: -F "scan_type=Semgrep JSON Report" \ -F "engagement_name=CI/CD Pipeline" \ -F "product_name=${{ github.repository }}" \ + -F "scan_date=$TODAY" \ + -F "auto_create_context=true" \ -F "file=@semgrep-results.json") if [[ "$HTTP_CODE" != "200" && "$HTTP_CODE" != "201" ]]; then echo "::error::Upload Failed with HTTP $HTTP_CODE" + echo "--- SERVER RESPONSE ---" cat response.txt + echo "-----------------------" exit 1 else echo "Upload Success!"