Repository navigation
[Debugger] DEBUG-5960 Redact index keys computed from constants - #9536
dudikeleti wants to merge 2 commits into
Conversation
Fold index keys that depend only on constants once at compile time, then apply the literal-key redaction check. Unredacted keys are replaced by the folded constant, so evaluation no longer recomputes them.
BenchmarksBenchmark execution time: 2026-10-27 19:47:57 Comparing candidate commit 2cc50c3 in PR branch Found 3 performance improvements and 0 performance regressions! Performance is the same for 69 metrics, 0 unstable metrics, 13 known flaky benchmarks, 113 flaky benchmarks without significant changes.
|
Execution-Time Benchmarks Report ⏱️Execution-time results for samples comparing This PR (9536) and master. ✅ No regressions detected |
Summary of changes
indexkeys computed only from constants, for example{"index":[{"ref":"user"},{"substring":["xpasswordx",1,9]}]}, are folded when the expression compiles and then redacted like literal keys.substringon every hit.Reason for change
ConstantExpressionkeys were checked for redaction, so a key computed from constants returned the raw value. system-teststest_pii_redaction_log_probe_computed_keyis markedbug (DEBUG-5960)for .NET.Implementation details
GetItemAtIndexfolds a string key that isn't a constant before the existing literal-key check.FoldableKeyVisitorstrips the parser's budget checks and accepts only an allowlist: string, primitive and null constants; blocks without variables; unary and binary nodes over primitives without operator methods; conditionals; and members and methods declared onstring. Anything else, including parameters, static members and other calls, keeps today's behavior.Test coverage
substring, render{redacted}with one redaction error.lenis still evaluated at runtime.dotnet test tracer/test/Datadog.Trace.Tests/Datadog.Trace.Tests.csproj -c Release -f net10.0 --filter "FullyQualifiedName~Datadog.Trace.Tests.Debugger": 893 passed, 2 skipped.-f net48: 857 passed, 29 skipped.Other details
{redacted}segment collapse this uses.@it) are still not checked. A runtime guard for them adds one keyword lookup per evaluation of thatindexand will be a separate PR, after the lock-free redaction cache PR.test_pii_redaction_log_probe_computed_keycan be enabled in system-tests.