Replies: 1 comment 2 replies
-
Thank you for the excellent feedback, @acdha! Those are certainly valid points. If I can summarize:
If I've got that right, I would say each of the above deserves a feature request of its own. Please let me know if I've missed something. Thank you. |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Description
Like many people, I use the
terraform-aws-modules/vpc/aws
module and that module creates a variety of resources using large lists for things like ACLs:This creates a problem on every project when using Trivy because you'll get findings for the resources created using
count
orfor_each
blocks inside the module based on those lists:(this also repeats for AVD-AWS-102, etc.)
I think Trivy needs explicit support for filtering things like this safely. The current design for attribute filtering does not support indexed resources (as every input to that module uses) and since these rules are usually false-positives (most people use AWS to host public applications so they'll need to support ingress HTTP, HTTPS, ICMP for Path MTU discovery, etc.), it's really tempting to just toss
#trivy:ignore:avd-aws-0102 trivy:ignore:avd-aws-0105
into that file — greatly increasing the odds of Trivy not catching an actual security problem when someone adds another rule – and even if indexed access were possible, it'd be risky because the indexes are not stable (e.g. in my example above, some of the rules come from a different module which has common firewall rules and an update could easily shift all of the index numbers).Since Trivy has full knowledge of the resources created in a module, it seems like it should be possible to have some way to use that hierarchy to select a resource which would otherwise not be in scope at this point:
I don't love that syntax and it seems like it might be preferable to say that complex filtering has to be done in a
.trivyignore.yaml
file where it could look more like this:One other thought which came out of this is that the error messages could be improved somewhat to list the attributes of the resource in question. When you have large lists being fed into a loop it'd be really nice to be able to see
cidr_block=0.0.0.0/0 from_port=22 to_port=22
so you could easily know which source definitely it refers to rather than having to count them.Target
None
Scanner
Misconfiguration
Beta Was this translation helpful? Give feedback.
All reactions