Repository navigation
fix(notify): keep untrusted Telegram fields on one line - #896
Open
thecorporatetractor wants to merge 1 commit into
Open
thecorporatetractor wants to merge 1 commit into
thecorporatetractor wants to merge 1 commit into
Conversation
Slack flattens titles, types and assets with OneLine so a newline in an untrusted field cannot forge another line (TestSlackKeepsUntrustedFieldsOnOneLine). Telegram did not: a finding named "a\n2. Critical · fake entry" added a forged entry to a digest, and a newline in the vulnerability class or an asset added a forged line to a single notification. Flatten the digest line and the Type and Assets fields the same way.
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.
Problem
Telegram notifications write untrusted fields as they are. A newline in a finding title adds a fake entry to a digest: a finding named
a\n2. Critical · fake entryshows as two entries. A newline in the vulnerability class or an asset adds a fake line to a single notification.Slack already flattens these fields with
OneLine(notify/slack.go,TestSlackKeepsUntrustedFieldsOnOneLine). The Markdown and Feishu channels flatten them throughmarkdownText, and email is HTML. Telegram was the one channel left.Behavior change
Telegram flattens the digest line and the Type and Assets fields with
OneLine, as Slack does. The single-message title was already flattened bymarkdownTitle.Tested
TestTelegramKeepsUntrustedFieldsOnOneLine(innotify/channels_test.go) mirrors the Slack test: newlines in the class, an asset and a digest title no longer create lines. It fails before the change.go test ./notify/, gofmt and vet pass.