Skip to content

Commit c446a5c

Browse files
authored
docs: clarify inline ignore limitations for resource-less checks (#9537)
Signed-off-by: nikpivkin <[email protected]>
1 parent c0c7a6b commit c446a5c

File tree

1 file changed

+8
-1
lines changed
  • docs/docs/scanner/misconfiguration/config

1 file changed

+8
-1
lines changed

docs/docs/scanner/misconfiguration/config/config.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,10 +132,17 @@ It is also possible to specify multiple input schemas with `--config-file-schema
132132

133133
### Filtering resources by inline comments
134134

135-
Trivy supports ignoring misconfigured resources by inline comments for Terraform, CloudFormation and Helm configuration files only.
135+
Trivy supports ignoring misconfigured resources by inline comments for Terraform, CloudFormation, Helm and Dockerfile configuration files only.
136136

137137
In cases where Trivy can detect comments of a specific format immediately adjacent to resource definitions, it is possible to ignore findings from a single source of resource definition (in contrast to `.trivyignore`, which has a directory-wide scope on all of the files scanned). The format for these comments is `trivy:ignore:<rule>` immediately following the format-specific line-comment [token](https://developer.hashicorp.com/terraform/language/syntax/configuration#comments).
138138

139+
140+
!!!note
141+
Inline ignore rules only work for checks associated with an existing resource.
142+
Checks triggered by the absence of a resource (e.g., **AVD-DS-0002** when a Dockerfile lacks a `USER` instruction) cannot be ignored inline.
143+
Use a [.trivyignore.yaml](../../../configuration/filtering.md#trivyignoreyaml) file to ignore such checks.
144+
145+
139146
The ignore rule must contain one of the possible check IDs that can be found in its metadata: ID, short code or alias. The `id` from the metadata is not case-sensitive, so you can specify, for example, `AVD-AWS-0089` or `avd-aws-0089`.
140147

141148
For example, to ignore a misconfiguration ID `AVD-GCP-0051` in a Terraform HCL file:

0 commit comments

Comments
 (0)