Closed nikpivkin closed 8 months ago
I had the same error when I am using the below modules
terraform-aws-modules/lambda/aws terraform-aws-modules/s3-bucket/aws//modules/notification
Any update on this? The only release that works is 0.8.0. All the others fail.
Adding some notes from testing: I cannot reproduce this running trivy
installed on my local machine, but I can reproduce this running the same version of trivy
using the Docker image.
I'm hoping the reproductions below help!
OS: MacOS 13.5.2 Arch: M1 Pro (amd64) Trivy: 0.45.1 (installed via Homebrew)
$ trivy --version
Version: 0.45.1
Vulnerability DB:
Version: 2
UpdatedAt: 2023-09-22 00:23:59.552431691 +0000 UTC
NextUpdate: 2023-09-22 06:23:59.552431291 +0000 UTC
DownloadedAt: 2023-09-22 04:44:16.227725 +0000 UTC
Policy Bundle:
Digest: sha256:fd5f1ce3d8efb1fe158cb41f9adb9d7c7cc5c4c863b261053c962e6d950350b3
DownloadedAt: 2023-09-22 04:44:24.462946 +0000 UTC
# Grep finds no invalid results
$ trivy repo --quiet \
--scanners config \
--format sarif \
https://github.com/terraform-aws-modules/terraform-aws-lambda \
| grep '"uri": "git:'
$ docker run --rm ghcr.io/aquasecurity/trivy:0.45.1 --version
Version: 0.45.1
# Grep finds several invalid URIs in result
$ docker run --rm ghcr.io/aquasecurity/trivy:0.45.1 repo --quiet \
--scanners config \
--format sarif \
https://github.com/terraform-aws-modules/terraform-aws-lambda \
| grep '"uri": "git:'
"uri": "git::https:/github.com/terraform-aws-modules/terraform-aws-s3-bucket?ref=v3.0.1/main.tf",
"uri": "git::https:/github.com/terraform-aws-modules/terraform-aws-vpc?ref=v5.0.0/main.tf",
"uri": "git::https:/github.com/terraform-aws-modules/terraform-aws-vpc?ref=v5.0.0/main.tf",
"uri": "git::https:/github.com/terraform-aws-modules/terraform-aws-vpc?ref=v5.0.0/main.tf",
"uri": "git::https:/github.com/terraform-aws-modules/terraform-aws-vpc?ref=v5.0.0/main.tf",
I think this was introduced by this PR aquasecurity/defsec#1202 which basically reverted this year-old fix aquasecurity/defsec#889
Edit: maybe not by looking at all the dates and contexts, but it seems related
Edit 2: tfsec
used defsec
for its sarif
format, not Trivy, but there may be lessons that can be learned from it
See also GitHub Code Scanning API limitations for the SARIF format: https://github.com/github/codeql-action/issues/754#issuecomment-930337869
It seems the PR did not fixed it, I still get the error with Trivy v0.46.0, URI schemes are not removed 😕
$ trivy version
Version: v0.46.0
$ trivy config --format sarif --output trivy-results.sarif .
$ jq '[
.runs[].results[].locations[].physicalLocation.artifactLocation.uri
| select(startswith("git::https:/"))
] | length' trivy-results.sarif
41
I am currently working around it with:
sed -i 's#git::https:/##g' trivy-results.sarif
Same in 0.47.0
🤔
Still an issue in 0.49.0
. Thanks @maxbrunet for this quick and dirty fix!
Unfortunately, still an issue for us. Thanks, @maxbrunet, for the temporary fix!
also used the workaround above with current version of Trivy - works great but any chance you can reopen this @knqyf263 ?
@nikpivkin Can you please take a look?
source: https://github.com/aquasecurity/tfsec/issues/1955
Config example:
Output:
I used this service for SARIF validation: https://sarifweb.azurewebsites.net/Validation Validation result:
Description of the uri property in the SARIF specification.