feat(codebuild): publish Trustabl findings as CodeBuild test reports - #56
Open
pjsk02 wants to merge 1 commit into
Open
feat(codebuild): publish Trustabl findings as CodeBuild test reports#56pjsk02 wants to merge 1 commit into
pjsk02 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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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: