Skip to main content

Module text

Module text 

Source
Expand description

Unicode text guards: block characters that let hostile input spoof how logs, receipts, and identifiers look on a terminal.

The dangerous set here is the “Trojan Source” family — bidirectional overrides and zero-width formatting characters — that render invisibly (or reverse the visible order of surrounding text) while remaining part of the string’s bytes. When those characters ride along in a JWT identity claim or a tool name, an operator investigating an audit chain sees one thing while the on-wire bytes say another.

Functions§

contains_bidi_or_zero_width
True if s carries any character that visually reorders or hides surrounding text (Trojan-Source-class spoofing).