Skip to content

Commit aa5b32a

Browse files
feat: add HTTP request/response tracing support (#9125)
Co-authored-by: DmitriyLewen <[email protected]>
1 parent 0ecfed6 commit aa5b32a

File tree

19 files changed

+984
-58
lines changed

19 files changed

+984
-58
lines changed

docs/docs/advanced/telemetry-flags.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
--slow
3636
--tf-exclude-downloaded-modules
3737
--timeout
38-
--trace
38+
--trace-http
39+
--trace-rego
3940
--vuln-severity-source
4041
```

docs/docs/references/configuration/cli/trivy_config.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ trivy config [flags] DIR
7676
-t, --template string output template
7777
--tf-exclude-downloaded-modules exclude misconfigurations for downloaded terraform modules
7878
--tf-vars strings specify paths to override the Terraform tfvars files
79-
--trace enable more verbose trace output for custom queries
79+
--trace-rego enable more verbose trace output for custom queries
8080
--username strings username. Comma-separated usernames allowed.
8181
```
8282

docs/docs/references/configuration/cli/trivy_filesystem.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ trivy filesystem [flags] PATH
135135
--tf-vars strings specify paths to override the Terraform tfvars files
136136
--token string for authentication in client/server mode
137137
--token-header string specify a header name for token in client/server mode (default "Trivy-Token")
138-
--trace enable more verbose trace output for custom queries
138+
--trace-rego enable more verbose trace output for custom queries
139139
--username strings username. Comma-separated usernames allowed.
140140
--vex strings [EXPERIMENTAL] VEX sources ("repo", "oci" or file path)
141141
--vuln-severity-source strings order of data sources for selecting vulnerability severity level

docs/docs/references/configuration/cli/trivy_image.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ trivy image [flags] IMAGE_NAME
156156
--tf-exclude-downloaded-modules exclude misconfigurations for downloaded terraform modules
157157
--token string for authentication in client/server mode
158158
--token-header string specify a header name for token in client/server mode (default "Trivy-Token")
159-
--trace enable more verbose trace output for custom queries
159+
--trace-rego enable more verbose trace output for custom queries
160160
--username strings username. Comma-separated usernames allowed.
161161
--vex strings [EXPERIMENTAL] VEX sources ("repo", "oci" or file path)
162162
--vuln-severity-source strings order of data sources for selecting vulnerability severity level

docs/docs/references/configuration/cli/trivy_kubernetes.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ trivy kubernetes [flags] [CONTEXT]
144144
-t, --template string output template
145145
--tf-exclude-downloaded-modules exclude misconfigurations for downloaded terraform modules
146146
--tolerations strings specify node-collector job tolerations (example: key1=value1:NoExecute,key2=value2:NoSchedule)
147-
--trace enable more verbose trace output for custom queries
147+
--trace-rego enable more verbose trace output for custom queries
148148
--username strings username. Comma-separated usernames allowed.
149149
--vex strings [EXPERIMENTAL] VEX sources ("repo", "oci" or file path)
150150
--vuln-severity-source strings order of data sources for selecting vulnerability severity level

docs/docs/references/configuration/cli/trivy_repository.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ trivy repository [flags] (REPO_PATH | REPO_URL)
134134
--tf-vars strings specify paths to override the Terraform tfvars files
135135
--token string for authentication in client/server mode
136136
--token-header string specify a header name for token in client/server mode (default "Trivy-Token")
137-
--trace enable more verbose trace output for custom queries
137+
--trace-rego enable more verbose trace output for custom queries
138138
--username strings username. Comma-separated usernames allowed.
139139
--vex strings [EXPERIMENTAL] VEX sources ("repo", "oci" or file path)
140140
--vuln-severity-source strings order of data sources for selecting vulnerability severity level

docs/docs/references/configuration/cli/trivy_rootfs.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ trivy rootfs [flags] ROOTDIR
136136
--tf-vars strings specify paths to override the Terraform tfvars files
137137
--token string for authentication in client/server mode
138138
--token-header string specify a header name for token in client/server mode (default "Trivy-Token")
139-
--trace enable more verbose trace output for custom queries
139+
--trace-rego enable more verbose trace output for custom queries
140140
--username strings username. Comma-separated usernames allowed.
141141
--vex strings [EXPERIMENTAL] VEX sources ("repo", "oci" or file path)
142142
--vuln-severity-source strings order of data sources for selecting vulnerability severity level

docs/docs/references/configuration/config-file.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -504,7 +504,7 @@ rego:
504504
# Same as '--skip-check-update'
505505
skip-check-update: false
506506

507-
# Same as '--trace'
507+
# Same as '--trace-rego'
508508
trace: false
509509

510510
```

docs/docs/references/troubleshooting.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -267,6 +267,25 @@ $ brew install aquasecurity/trivy/trivy
267267
```
268268

269269

270+
## Debugging
271+
### HTTP Request/Response Tracing
272+
273+
For debugging network issues, connection problems, or authentication failures, you can enable HTTP request/response tracing using the `--trace-http` flag.
274+
275+
!!! danger "Security Warning"
276+
While Trivy attempts to redact known sensitive information such as authentication headers and common secrets, the `--trace-http` flag may still expose sensitive data in HTTP requests and responses.
277+
278+
**Never use this flag in production environments or CI/CD pipelines.**
279+
This flag is automatically disabled in CI environments for security.
280+
281+
```bash
282+
# Enable HTTP tracing for debugging registry issues
283+
$ trivy image --trace-http registry.example.com/my-image:latest
284+
285+
# HTTP tracing with other debugging options
286+
$ trivy image --trace-http --debug --insecure my-image:tag
287+
```
288+
270289
## Others
271290
### Unknown error
272291

docs/docs/scanner/misconfiguration/custom/debug.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
# Debugging checks
22
When working on more complex queries (or when learning Rego), it's useful to see exactly how the policy is applied.
3-
For this purpose you can use the `--trace` flag.
3+
For this purpose you can use the `--trace-rego` flag.
44
This will output a large trace from Open Policy Agent like the following:
55

66
!!! tip
77
Only failed checks show traces. If you want to debug a passed check, you need to make it fail on purpose.
88

99
```shell
10-
$ trivy config --trace configs/
10+
$ trivy config --trace-rego configs/
1111
2022-05-16T13:47:58.853+0100 INFO Detected config files: 1
1212

1313
Dockerfile (dockerfile)

0 commit comments

Comments
 (0)