feat(codebuild): publish Trustabl findings as CodeBuild test reports - #56
feat(codebuild): publish Trustabl findings as CodeBuild test reports#56pjsk02 wants to merge 1 commit into
Conversation
Emit JUnit from ScanResult for an opt-in Reports tab without changing the scan gate or the logs-only IAM role.
|
Thanks @pjsk02. Flagging that this is being read rather than sitting unlooked-at. We are reviewing all 52 open PRs together instead of one at a time. 31 of them edit Queued. This is one of the larger changes in the queue, so it gets read after the single-purpose fixes land. The order we are working to: the test harness in #1 first, since twelve PRs depend on it and nothing is verifiable without it, then the fixes that close fail-open paths, then behaviour changes, then docs. A verdict on this one follows once its cluster is read. Apologies for the wait, and thanks for the contribution. |
|
Thanks @pjsk02 — the change looks good, but it needs a rebase. Several PRs touching
Ping me when it's up. |
Summary
Surface Trustabl scan findings natively in AWS CodeBuild Reports by converting
trustabl.jsoninto JUnit XML.The existing JSON, SARIF and Markdown outputs remain unchanged and authoritative.
What changed
trustabl.json→ JUnit XML converter (scan/to-junit.sh);trustabl-junit.xmlfrom the CodeBuild scan flow;reports:configuration usingJUNITXML(commented in the default buildspec);codepipeline/iam-reports.json);CodeBuild Reports behavior
Native Reports integration is opt-in.
The default buildspec keeps the
reports:configuration commented, so existing users:The scanner still writes
trustabl-junit.xmllocally. Users who enable the documentedreports:block also attach the supplied Reports IAM permissions. Converter failure is a warning only and does not change the scan gate.Finding mapping
Each Trustabl finding becomes an independently inspectable JUnit test case containing useful context such as:
Arbitrary finding text is XML-escaped before emission. Control characters are stripped. Test case names include a deterministic index suffix.
Large scans
AWS CodeBuild Reports expose at most 500 test cases per report.
When a scan contains more than 500 findings, the JUnit representation selects findings deterministically by severity:
critical → high → medium → low → infowith stable secondary ordering (
rule_id,file_path,start_line).Truncation is logged and recorded as testsuite properties rather than silently hidden.
The complete JSON/SARIF artifacts remain authoritative for the full finding set.
IAM
Enabling native CodeBuild Reports requires the documented permissions:
codebuild:CreateReportGroupcodebuild:CreateReportcodebuild:UpdateReportcodebuild:BatchPutTestCasesThese permissions are not required by the default configuration.
Testing
Validated locally with:
Tests cover:
Tests are offline and require no AWS credentials.
Non-goals
This PR does not change: