Repository navigation
fix(agent): redact containers without secret names, multiline secrets and cut lines - #482
Merged
Merged
Conversation
… and cut lines A container created before the sk.secret_env label had no names, so its secret values were shipped as written (#470). The agent now sets the label on every container, empty without secrets, and the shipper redacts every environment value of a container that lacks it. A multiline secret never matched one line of output (#471): each of its lines of 8 bytes or more is now a value of its own, CRLF included. A line cut at 16 KiB that ends with the start of a secret loses that start, found in linear time before the whole values are replaced. Closes #470 Closes #471 Signed-off-by: samuel mbabhazi <[email protected]>
… lines Signed-off-by: samuel mbabhazi <[email protected]>
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 55 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
…lit a whole secret Review of #482: on a cut line, redacting the start of a value first could cut a whole secret that ends the line, when its end is also the start of a value, and its first part was then shipped. Each value is now matched once over the line as read, by its failure function: every occurrence, overlapping ones included, and the start at a cut. The union of these spans is redacted. The legacy-container note is logged once per container. Signed-off-by: samuel mbabhazi <[email protected]>
Collaborator
Author
|
Code review (high), findings and what was done in edb61c2:
The real Docker tests were run again on the lab node: all 5 pass. |
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.
What changed
Two P1 findings from the 2026-11-25 audit, both in the log shipper's secret redaction (ADR 0029).
#470: containers that predate the
sk.secret_envlabel.LegacyRedactor: every environment value of 8 bytes or more is redacted from that container's backlog and new lines. It logs once per follow that the container should be redeployed for exact redaction.#471: multiline secrets and the 16 KiB cut.
\rtrimmed) becomes a value of its own. Lines are still redacted one by one: stdout and stderr are never joined.RedactCutEndhandles a line cut at its bound: when it ends with the start of a value (8 bytes or more of it), that start is replaced. It runs on the raw line beforeRedactand takes the longest start over all values, so a shorter secret inside the start cannot hide the rest. The search uses the KMP failure function and runs in linear time: secrets are up to 64 KiB, and a naive suffix scan of a crafted 16 KiB line would be quadratic.Why
Both paths could send secret values intact to VictoriaLogs, where
environment.readreaders can see them.How it was tested
cutStartagainst a naive scan on self-overlapping values.shipper.goandredact.goand fail there.-tags integration, run on a lab node), on disposable BusyBox containers with no network:go test -race ./agent/...andgolangci-lint(with the integration tag) are clean.Security considerations
productionor the image'sPATHare masked until the application is redeployed. That is the more secure and reversible choice.sh -cin the integration tests is the fixture script inside the disposable container.Closes #470
Closes #471