Skip to content
OWASP AI Exchange· Ninad Phalak·Indexed by this site · Originally published· Defenses →

OWASP AI Exchange guide adds method for filtering sensitive information across chunks in streaming output

Sensitive output handling: filter streamed output across chunk boundaries (#225)

AI summary

The OWASP AI Exchange project added an implementation point to the sensitive output handling section of its AI security and privacy guide, noting that when model output is streamed in chunks such as by token, sensitive values may be split across two or more chunks, so that no single chunk matches. Filtering chunk by chunk or concatenating a fixed number of characters from the previous chunk before filtering cannot prevent leakage, because by the time the combined text is checked, the first part has already been sent, even if the filter logs a detection success. The guide recommends withholding text while a match may still extend into the buffer, or buffering up to sentence or even full response boundaries; if the buffer reaches its limit and a match may still be unclosed, output should stop rather than releasing the buffered content. The test criterion given in the text is that for every possible chunking of the same text, the streamed output should equal the result of filtering the entire text at once.

Read originalgithub.com