Skip to content

Sanitize chat newlines before storing in the content map#16

Open
acts-1631 wants to merge 1 commit into
karlkleinpaste:masterfrom
acts-1631:fix/chat-newline-inoculation-order
Open

Sanitize chat newlines before storing in the content map#16
acts-1631 wants to merge 1 commit into
karlkleinpaste:masterfrom
acts-1631:fix/chat-newline-inoculation-order

Conversation

@acts-1631

Copy link
Copy Markdown

TransmitInternal inoculates chat content against internal newlines so
they cannot break the name=value body format. The inoculation loop
replaces \n with \t, but it ran after the raw message was already
copied into the content map, so the map entry retained the original
newlines. A chat message like "Hello\nmsg.sync.passPhrase=Injected"
becomes two protocol fields at the receiver, and the map's
last-write-wins semantics let the injected field override the
legitimate value.

This moves the \n-to-\t substitution before the assignment to
content[BSP_MSG_CHAT] so the sanitized value is what gets stored and
transmitted.

TransmitInternal inoculates chat content against internal newlines so
they cannot break the name=value body format. The inoculation loop
replaces \n with \t, but it ran after the raw message was already
copied into the content map. The map entry (used to assemble the
transmitted body) retained the original newlines, so a chat message
like "Hello\nmsg.sync.passPhrase=Injected" became two protocol
fields at the receiver, and the map's last-write-wins semantics let
the injected field override the legitimate value.

Move the \n-to-\t substitution before the assignment to
content[BSP_MSG_CHAT] so the sanitized value is what gets stored and
transmitted.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant