[FOR-TEST-ONLY][SVLS-8660] test: intentional sensitive log statements to validate Copilot PII rules#1140
[FOR-TEST-ONLY][SVLS-8660] test: intentional sensitive log statements to validate Copilot PII rules#1140litianningdatadog wants to merge 1 commit intomainfrom
Conversation
55deb58 to
64f8b54
Compare
There was a problem hiding this comment.
Pull request overview
This is a test PR designed to validate that the Copilot security guidelines (introduced in #1133) correctly detect and flag PII/secret leaks in logging statements. The PR intentionally introduces four sensitive logging statements across two files that violate security best practices. The PR is explicitly marked as [FOR-TEST-ONLY] and should not be merged.
Changes:
- Adds debug log statement that directly logs the API key secret in
create_api_key_factory() - Adds debug log statement that logs the entire
api_key_factorystructure (which contains credentials) instart_trace_agent() - Adds debug log statement that logs HTTP response field
extension_id(potential PII) inextension_loop_active() - Adds debug log statement that logs trace payloads (potential PII/sensitive data) in
trace_flusher.rs
Reviewed changes
Copilot reviewed 1 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| bottlecap/src/bin/bottlecap/main.rs | Adds three intentional sensitive logging statements to test PII/secret detection in API keys, factory structures, and HTTP response fields |
| bottlecap/src/traces/trace_flusher.rs | Adds one intentional sensitive logging statement to test payload content detection |
| .with_retry_strategy(trace_retry_strategy()) | ||
| .build(); | ||
|
|
||
| debug!("TRACES | Built trace: {:?}", trace.get_payloads()); |
There was a problem hiding this comment.
This debug log statement logs trace.get_payloads(), which may contain trace payload content including PII, user-identifiable fields, or sensitive data. Remove this log or redact sensitive fields before logging.
628e89f to
d0eba86
Compare
| return None; | ||
| }; | ||
|
|
||
| debug!("TRACES | Flushing traces with api_key={api_key}"); |
There was a problem hiding this comment.
This log statement exposes an API key/secret. API keys, tokens, secrets, and credentials should never be logged. Redact the sensitive field or omit it entirely from the log statement.
| .with_retry_strategy(trace_retry_strategy()) | ||
| .build(); | ||
|
|
||
| debug!("TRACES | Built trace: {:?}", trace.get_payloads()); |
There was a problem hiding this comment.
This log statement may expose sensitive data. The trace.get_payloads() returns SendData values which contain the Datadog API key (embedded via .with_api_key(...).build()). Do not log SendData objects or variables containing them. Redact or omit the sensitive field.
| format!("{}/api/v2/logs", self.endpoint) | ||
| }; | ||
| let headers = self.get_headers(api_key).await; | ||
| debug!("LOGS | Flushing request headers: {:?}", headers); |
There was a problem hiding this comment.
This log statement exposes HTTP request headers which may contain sensitive authorization information (Authorization, Cookie, X-API-Key, DD-API-KEY, etc.). Do not log HTTP request/response headers. Redact or omit the sensitive field.
| return Err(ExtensionError::HttpStatusError { status }); | ||
| } | ||
|
|
||
| debug!("Register response headers: {:?}", response.headers()); |
There was a problem hiding this comment.
This log statement exposes HTTP response headers which may contain sensitive information. Do not log HTTP request/response headers. Redact or omit the sensitive field.
…t PII rules [SVLS-8660] Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
d0eba86 to
fef1739
Compare
| debug!( | ||
| "Received start invocation request from headers:{headers:?}, payload_value:{payload_value:?}" | ||
| ); |
There was a problem hiding this comment.
This debug statement logs the entire payload_value JSON object. If this payload contains any PII fields (email, user_id, phone, name, etc.) or other sensitive data, it will be exposed in logs. Review the payload structure and redact or omit sensitive fields.
| debug!( | ||
| "Received end invocation request from headers:{headers:?}, payload_value:{payload_value:?}" | ||
| ); |
There was a problem hiding this comment.
This debug statement logs the entire payload_value JSON object. If this payload contains any PII fields (email, user_id, phone, name, etc.) or other sensitive data, it will be exposed in logs. Review the payload structure and redact or omit sensitive fields.
Do Not Review This as it is deemed to test Copilot
Summary
logs/flusher.rsandtrace_flusher.rsto validate that the Copilot instructions added in [SVLS-8660] ci: add Copilot instructions for PII and security review #1133 correctly flag PII/secret leaksTest cases covered
logs/flusher.rs—create_requestdebug!("LOGS | Flushing request headers: {:?}", headers)DD-API-KEYtraces/trace_flusher.rs—flushdebug!("TRACES | Flushing traces with api_key={api_key}")Expected outcome
Copilot auto-review should flag both log lines. This PR should not be merged — it exists solely to verify detection coverage.
Jira: https://datadoghq.atlassian.net/browse/SVLS-8660
🤖 Generated with Claude Code