[Audit] Add deep redaction, cyclic-payload tests, and bounded traversal - #163
Merged
BigDella merged 3 commits intoSep 29, 2026
Conversation
…d bounded traversal
|
@bamiebot-maker Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
Contributor
Author
|
kindly review pr |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
[Audit] Add deep redaction, cyclic-payload tests, and bounded traversal
Closes #147
Summary of Changes
This pull request addresses recursive secret redaction for nested arrays, circular objects, large strings, and key-case variations across telemetry and audit domains:
Cycle Detection & Serialization Safety:
seen = new WeakSet<object>()tracking inredact()incore/telemetry/telemetry.ts."[CIRCULAR]"instead of triggering unbounded recursion or stack overflows.JSON.stringify().Bounded Traversal Depth:
MAX_REDACT_DEPTH = 16. Deeply nested structures exceeding the depth limit are marked with"[TRUNCATED_DEPTH]", preventing unbounded tree recursion.Key-Case and Auth Variant Redaction:
isSensitiveKey(key)to handle case variations and word boundaries (APIKEY,secret_seed,AUTH_TOKEN,passWord,Authorization,cookie,apiKey,privateKey), while safeguarding non-secret keys such aspublicKeyandnormalKey.scrubSecretsandauditContextincore/audit/audit.tsto redact key-case variations and embedded bearer tokens.Embedded Secrets & Large String Scrubbing:
scrubStringwith regex scanning for embedded Stellar secret seeds (EMBEDDED_STELLAR_SECRET) and authorization tokens (EMBEDDED_BEARER_TOKEN).MAX_SCANNABLE_STRING_LENGTH(500,000 chars) with truncation fallback to bound memory while ensuring secret material is scrubbed.In-Memory Telemetry Capture Sink:
createCaptureSink()returning aTelemetryCaptureSinkto easily inspect, filter, find, and clear emitted events during feature and boundary testing.Comprehensive Test Suite:
core/telemetry/__tests__/telemetry.test.tsandcore/audit/__tests__/audit.test.tscovering cyclic structures, depth limits, key-case permutations, large strings with embedded secrets, and capture sink operations.core/testing/.Verification
npx vitest run core/telemetry core/audit(All 34 tests passing)npm run verify:telemetry(All 11 instrumented operations verified)npm run verify:audit(9 sensitive actions, 9 domain-boundary emitters verified)