Repository navigation
fix(#5705): mask private-key blocks that span JSON members or records - #1
Closed
andrewevansrh wants to merge 1 commit into
Closed
andrewevansrh wants to merge 1 commit into
andrewevansrh wants to merge 1 commit into
Conversation
… or records A JSON document can carry a private key one fragment per member: BEGIN in one string, body lines in the next, END in a third. Masking any single member removes the marker the block's own pattern needs, and the bytes scan that runs after the rewrite sees no block any more, so the body was written back in clear text. Such a block is now detected on a decoded view of the document or stream, before anything is rewritten, and neutralized member by member. The boundary members always carry marker text and are masked even when a marker is split across two of them; a member in between is masked when it carries a marker, a run that looks like PEM body material, or joins with its neighbours into text that does. Object keys keep their names unless the name itself is block content, so a review that merely quotes the PEM header in one finding and the footer in another keeps the shape and the enum values review-result.schema.json requires, instead of being dropped by schema validation. Records carrying part of a block across a record boundary are replaced with a fail-closed marker, because the record framing cannot be rewritten. A body split so that one-character and longer chunks alternate is a known residual; uniform chunks and complete body lines are masked. Signed-off-by: anevans <anevans@redhat.com>
3 tasks done
|
The agent could not start because of a token mint failure. |
Owner
Author
|
Moved to fullsend-ai#10084 so the stack lands upstream in order. Note: Generated with assistance from DeepSeek V4.1 Flash |
This branch was successfully deployed
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.
Summary
Part 2 of 3 split out of fullsend-ai#9699 (part 1: fullsend-ai#10082).
A JSON document can carry a private key one fragment per member:
BEGINin onestring, body lines in the next,
ENDin a third. Masking any single memberremoves the marker the block's own pattern needs, and the written-bytes scan that
runs after the rewrite sees no block any more, so the body was written back in
clear text.
Base:
agent/5705-json-sanitizer(part 1, fullsend-ai#10082). Review the diff againstthat branch; only that delta is this PR. It is opened in the fork because a
stacked PR's base branch has to live in the repository the PR is opened in, and
the base branch is not in
fullsend-ai/fullsend. This one will be retargeted tomainonce part 1 lands.What changed
jsonsanitize.godetects a private-key block that spans members or records ona decoded view of the document or stream, before anything is rewritten, and
neutralizes it where it lives:
marker is split across two members and neither fragment looks like one alone;
PEM body material, or joins with its neighbours into text that does;
review that merely quotes the PEM header in one finding and the footer in
another keeps the shape and enum values
review-result.schema.jsonrequiresinstead of failing schema validation and being dropped;
fail-closed marker, because the record framing cannot be rewritten.
residual; uniform chunks and complete body lines are masked.
Verification
go test ./internal/security/make lintNote: Generated with assistance from DeepSeek V4.1 Flash