fix(misconf): ensure value used as ignore marker is non-null and known (#9835)

Signed-off-by: nikpivkin <nikita.pivkin@smartforce.io>
This commit is contained in:
Nikita Pivkin
2025-11-26 12:28:38 +06:00
committed by GitHub
parent 7b2b4d4b45
commit 7aca80151c
2 changed files with 11 additions and 0 deletions

View File

@@ -204,6 +204,9 @@ func ignoreByParams(params map[string]string, modules terraform.Modules, m *type
}
for key, param := range params {
val := block.GetValueByPath(key)
if val.IsNull() || !val.IsKnown() {
return false
}
switch val.Type() {
case cty.String:
if val.AsString() != param {

View File

@@ -390,6 +390,14 @@ data "aws_iam_policy_document" "this" {
}`,
assertLength: 0,
},
{
name: "ignore marker value is unknown",
source: `#trivy:ignore:*[bucket=mybucket-bucket1]
resource "aws_s3_bucket" "test" {
bucket = "mybucket-${each.key}"
}`,
assertLength: 1,
},
}
for _, tc := range testCases {