fix: harden Action log sanitization - #157
Merged
GrantBirki merged 6 commits intoAug 18, 2026
Merged
Conversation
GrantBirki
approved these changes
Aug 18, 2026
GrantBirki
left a comment
Member
There was a problem hiding this comment.
Reviewed the log sanitization and byte-bound changes. The regression coverage looks good. Thanks!
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
Harden ordinary Action log sanitization so it matches Fence's control-character policy and remains inside its fixed workflow-command byte bound after escaping.
Problem
There are two related gaps in
action/log.ctson the base commit:sanitizeLogTextremoves C0 controls and normalizes CR/LF, but leaves C1 controls and Unicode line/paragraph separators intact even though Fence's structured-report path rejects them.workflowEscapeaskssanitizeLogTextto truncate to the 4096-byte debug limit and only then escapes%as%25. Escaping can therefore expand an already-maximal value well beyond the limit it was intended to enforce.Both affect the same boundary: arbitrary diagnostic text should become one bounded, control-safe GitHub Actions log payload before emission.
Evidence / reproduction
sanitizeLogTextremoves C0 controls andU+007F, but its regular expression does not coverU+0080..U+009F,U+2028, orU+2029.structuredRecordpath already rejects C1 controls andU+2028/U+2029, so ordinary and structured logging enforce different control-character invariants.before\u0085next\u2028tailretains those separators through the old ordinary sanitizer.workflowEscapecallssanitizeLogText(value, 4096)before.replace(/%/g, "%25").workflowEscape("%".repeat(4096)): the sanitized input is exactly 4096 bytes, but replacing every one-byte%with the three-byte%25representation expands the returned workflow-command payload to roughly 12 KiB.action/log-sanitization.test.ctspins concrete C1 boundaries plusU+2028/U+2029, verifies the expected escaped output, and verifies a percent-heavy input remains at or below 4096 bytes after workflow escaping.script/test-action-wrapperalready runs this focused regression with the normal Action wrapper tests.Printable Unicode remains unaffected. The second truncation is deliberately applied after workflow escaping so ordinary inputs keep the existing 4 KiB capacity while expansion-heavy values cannot exceed it.
Change
U+007FthroughU+009F) with_U+2028and paragraph separatorU+2029with_This is logging-integrity hardening only; it does not alter Fence policy or enforcement behavior.