Input in custom policy using trivy on terraform does not have complete attributes of resources #5444
-
QuestionI tried to create a custom policy that checks if an aws ec2 volume has a count of 1. Upon running the check, the policy did not report it when an aws ec2 volume was created with a count of 1. So, I checked for any mistakes in the policy file, mistakes on the command used but to no avail. Then, I try to check the input received via the custom policy and found that that may be the issue? The input received via the custom policy does not contain the complete attributes of the resource (no count, tags, type, size, etc) Following are the content:
policy.rego
Command used to run:
I extracted the input from policy evaluation into the following:
I would appreciate if you could point out what i'm missing or if this is a limitation from trivy? 🙏 TargetNone ScannerMisconfiguration Output FormatNone ModeStandalone Operating SystemUbuntu 22.04.3 LTS VersionVersion: 0.46.0
Policy Bundle:
Digest: sha256:1df8ade71efc830877ca3b1130f83e0c6368e3a45b0d4c0f0418955501644054
DownloadedAt: 2023-10-25 03:47:17.901425136 +0000 UTC |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
hi @rickythain - thank you for providing the debug output. You are looking for an attribute that we currently support for ec2 volumes. As you already saw, we only have support for encryption today. This can be seen in the code here https://github.com/aquasecurity/defsec/blob/v0.93.1/pkg/providers/aws/ec2/volume.go#L7-L10 |
Beta Was this translation helpful? Give feedback.
hi @rickythain - thank you for providing the debug output. You are looking for an attribute that we currently support for ec2 volumes. As you already saw, we only have support for encryption today. This can be seen in the code here https://github.com/aquasecurity/defsec/blob/v0.93.1/pkg/providers/aws/ec2/volume.go#L7-L10