fix: fix deep sensitive redaction#43
Open
ccharly wants to merge 1 commit into
Open
Conversation
d780b98 to
8d3c281
Compare
8d3c281 to
94370f0
Compare
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.
Ancestor branches were still able to keep a reference to the original data that was not redacted, resulting in potentially leaking the sensitive data using custom failure reporting.
Note
Medium Risk
Touches sensitive-data redaction in validation error branches; incorrect ancestor patching could still leak secrets or over-redact, but scope is limited to
withRedactedBranchand covered by new tests.Overview
Fixes a leak in
withRedactedBranchwhere sibling-field validation failures only redacted the immediate parent infailure.branch, while ancestor branch entries still held the original nested object references (so secrets could appear via e.g.branch[0].account.secret).The redaction logic now finds the parent in the branch, shallow-redacts sensitive keys on that entry, then walks upward through each ancestor—matching the child by reference (
===) and swapping in the already-sanitized child—so every branch level reflects redacted nested data.Adds validation fixtures for one- and three-level nesting to assert fully redacted branches on sibling
literalfailures.Reviewed by Cursor Bugbot for commit 94370f0. Bugbot is set up for automated code reviews on this repo. Configure here.