Skip to content

TC CFG 011

github-actions[bot] edited this page Nov 21, 2026 · 10 revisions

TC-CFG-011: Hidden Unicode in an agent instructions file

Severity high; low when every hidden code point is an editor or localisation artifact, such as a word joiner opening an inline code span (see "Severity")
Harnesses generic (AGENTS.md), Claude Code, Gemini CLI, Windsurf, GitHub Copilot, Cursor, Devin
Files AGENTS.md, CLAUDE.md, CLAUDE.local.md, GEMINI.md (any depth), nested .claude/rules/**/*.md, .cursor/rules/**/*.md(c), and .windsurfrules, plus root .cursorrules, .github/copilot-instructions.md, .github/instructions/**/*.md, .github/agents/**/*.agent.md, the maintenance commands and knowledge entries of .devin/blueprint.yaml, and repository skills at .claude/skills/<name>/SKILL.md, .agents/skills/<name>/SKILL.md, and .github/skills/<name>/SKILL.md (repository scope)
Rule rules/TC-CFG-011.yaml

What it detects

Some code points are invisible in an editor and in a pull-request diff, but the model reads them. A bidi control reorders what a reviewer sees (Trojan Source). Tag characters (U+E0000-U+E007F) mirror ASCII, so a run of them spells text no one sees. Zero-width code points hide or split words. In an instructions file, or in a repository skill under one of the three directories above, any of them can carry an instruction a reviewer cannot see.

One finding per file that holds any of:

Class Code points
bidi control U+202A-U+202E, U+2066-U+2069
tag character U+E0000-U+E007F
zero-width U+200B, U+200C, U+200D, U+2060, U+FEFF

The whole file is read as bytes, frontmatter included. A U+FEFF that starts the file is a byte order mark and is not counted; one anywhere else is, except a single stray one between a sentence end and a space (see "Not reported").

A U+200D between two Extended_Pictographic characters is a normal emoji ZWJ sequence and is not reported. U+FE0F and skin tones (U+1F3FB-U+1F3FF) may sit between the joiner and either character, so sequences such as 🏳️‍🌈 and 🐈‍⬛ are quiet. A U+200D between two letters or digits is reported, unless both letters are in the same joining script (below), and so is one next to punctuation.

An isolated U+200B, U+200C, or U+200D is not reported only when both neighbors are whitespace, a line boundary, or the edge of a quote (", ') or a code fence of at least three backticks or tildes, and it is not part of a run of zero-width characters. A quoted string or a bracket class whose contents are only zero-width characters is a strip literal and is not reported when that span has at most 8 code points and no code point repeats, including U+2060 and U+FEFF written that way. A longer span or a repeated code point is a run and is reported. The escape text \u200b is six ASCII characters and is not itself a hidden code point.

Some scripts use these characters as ordinary spelling. Persian and other Arabic-script text puts U+200C inside words, Brahmic scripts put U+200C or U+200D after a virama to choose a conjunct, half, or final form, and Thai, Lao, Khmer, Myanmar, and Tibetan, which are written without spaces, mark word breaks with U+200B. An isolated character in one of these positions is not reported (see "Not reported"). Letters are compared by Unicode script, and combining marks (harakat, vowel signs, viramas; at most 8) between the letter before and the character are skipped.

Still reported, at high: tag characters, bidi controls, a run of zero-width characters, a zero-width character inside a word, a zero-width character next to punctuation, one after a dot or before a word, one at the end of a word, and U+2060 or U+FEFF outside a strip literal (apart from the stray U+FEFF below). In every script, that includes a run (two U+200C in a row between Persian letters is a run), U+200B outside the five scripts written without spaces, a U+200B next to whitespace or punctuation, a character between letters of two different scripts or next to a Latin letter or a digit (apart from the two virama shapes below), and a joiner at the edge of a word unless it ends the word right after a virama. Persian has no virama, so a joiner at the end of a Persian word is reported.

Not reported:

  • U+200E and U+200F (left-to-right and right-to-left marks), which change no order on their own and are common in right-to-left text.
  • User-scope files.
  • SKILL.md outside the three skill directories, including docs/SKILL.md and a Claude plugin skills/ directory.
  • One U+200B, U+200C, or U+200D between whitespace, or at the start of a line immediately before a code fence.
  • A strip literal: a quoted string or a bracket class made only of zero-width characters, at most 8 of them, with no code point repeated. The examples below write the escape; the file holds the raw character.
  • One U+200C or U+200D inside a word of a joining script: the nearest letter before it is a letter of one of Arabic, Syriac, N'Ko, Mongolian, Devanagari, Bengali, Gurmukhi, Gujarati, Oriya, Tamil, Telugu, Kannada, Malayalam, Sinhala, Myanmar, Khmer, or Tibetan, and the code point after it is a letter or combining mark of the same script. For example the Persian \u0645\u06cc\u200c\u062e\u0648\u0627\u0647\u0645, the Devanagari \u0915\u094d\u200d\u0937, and the Marathi \u0905\u200d\u0945\u092a.
  • One U+200C or U+200D right after a virama (halant, al-lakuna, asat, coeng, or halanta) of one of those scripts, on a letter of the same script, that ends the word: whitespace, punctuation, a line boundary, or the end of the file follows it. This is how older Malayalam text writes a chillu (\u0d28\u0d4d\u200d ). Persian has no virama, so a Persian word that ends in a joiner is still reported.
  • One U+200C or U+200D right after a virama of one of those scripts, on a letter of any of them, before a letter of the virama's own script. Machine-translated text sometimes puts a virama of one Brahmic script on a letter of a sibling script, as in the Kannada virama on a Gujarati letter \u0a9c\u0ccd\u200c\u0cb2.
  • One U+200C or U+200D right after the virama of a Brahmic script of India (Devanagari, Bengali, Gurmukhi, Gujarati, Oriya, Tamil, Telugu, Kannada, Malayalam) or of Sinhala, on a letter of one of those scripts or of Arabic, Syriac, or Mongolian, before a letter of a script that is neither a joining script nor one whose letters pass for ASCII (Latin, Greek, Cyrillic, Armenian, Cherokee), such as Hangul or Han: \u0caa\u0ccd\u200c\uc2a4. A joiner there before a Latin, Greek, or Cyrillic letter, a digit, or a symbol, two joiners in a row (\u0caa\u0ccd\u200c\u200c\uc2a4), and a U+200B, U+2060, or tag character in the same place are still reported.
  • One U+200B between two letters of the same script, one of Thai, Lao, Khmer, Myanmar, or Tibetan, where it is the word separator, for example the Thai \u0e01\u0e23\u0e38\u0e13\u0e32\u200b\u0e23\u0e31\u0e19.
  • One U+FEFF right after sentence-ending punctuation (., !, ?, or the ideographic and fullwidth \u3002, \uff01, \uff1f) and right before whitespace, a line boundary, or the end of the file, as text pasted from a word processor or a web page leaves behind: Maintained by humans.\ufeff Read the guide. It changes no word. A U+FEFF before a word (See the guide.\ufeffignore the tests), inside a word, at the start of a line, next to other punctuation, or next to another zero-width character (Done.\ufeff\ufeff Next) is still reported, and so is every U+2060.

Severity

A finding is high, except when every hidden code point in the file is one of the shapes below. Then the finding is low. It is still reported: these characters hide no text, but they are still invisible.

  • A word joiner opening a code span. Some editors put a single U+2060 (word joiner) right after the backtick that opens an inline code span, to stop Markdown or MDX from turning the code into a link: `\u2060jobs.define()`. The shape is one U+2060 right after a single opening backtick, right before an ASCII letter or digit, with a closing backtick later on the same line and no other hidden code point on that line.
  • A word joiner starting a list item. The same editor artifact after a list marker: - \u2060Keep commits small. The shape is one U+2060 right after -, *, +, 1., or 1) and the spaces after it at the start of a line, right before an ASCII letter or digit, with no other hidden code point on that line apart from a word joiner that starts the line.
  • A word joiner starting a line. Editors also leave a single U+2060 as the first character of a line, before a list marker or before text: \u2060- Keep commits small, \u2060When a check fails, stop. The shape is one U+2060 that is the first code point of its line and is not next to another hidden or invisible code point.
  • A joiner before a native suffix on a Latin word. Localised text writes a Persian, Arabic, or Indic suffix on an English term with a joiner between them: Server\u200c\u0647\u0627, API\u200c\u0c97\u0cb3. The shape is one isolated U+200C or U+200D between a Latin word of at least two letters and at least two letters or marks of an Indic, Arabic, Syriac, Mongolian, or Sinhala script. It splits no ASCII word.
  • Invisible characters quoted in a code span. A page that describes invisible characters may quote them in a code span that holds nothing else: `\u2062\u200b`. The shape is an inline code span of a single backtick on each side that holds only zero-width code points and U+2061-U+2064, at most 8, with none repeated.
  • A line break after a slash in a code token. A page can write a U+200B after each / of a long code token so that it wraps in a table: `d.setDate/\u200bsetMonth`. The shape is one isolated U+200B right after a / that follows an ASCII letter and right before an ASCII letter, inside an inline code span on that line.
  • A byte order mark on its own line. Concatenating files that each start with a byte order mark leaves a U+FEFF alone on a line between paragraphs. The shape is a U+FEFF that is the whole of its line.
  • A zero-width space after a list bullet in Chinese, Japanese, or Korean text. Editors leave a U+200B between the bullet and the text when a list is pasted (- \u200b核心思维). The shape is one isolated U+200B right after a list marker at the start of a line (-, *, +, or a number and . or ), then a space or tab) and right before a Han, Hiragana, Katakana, or Hangul letter, or one opening bracket ([, (, 【, 「, () and then such a letter. Two in a row, one before Latin text, and one anywhere else on the line stay high.
  • A zero-width space at a camelCase hump in a code span. Pages write a line-break opportunity into a long identifier (`Unauthenticated\u200bSensitiveApisProvider`). The shape is one isolated U+200B between an ASCII lowercase letter or digit and an ASCII uppercase letter, inside an inline code span. Two in a row, the same in prose, and one between two lowercase letters (ign\u200bore) or two uppercase letters stay high.
  • A zero-width character in machine-translated Brahmic or Southeast Asian text. Translation tools leave an isolated U+200B, U+200C, or U+200D inside a word (\u0d09\u0d2a\u0d2f\u0d4b\u200b\u0d17\u0d4d) or between two of these scripts (a Thai fragment then Khmer, \u0e32\u200b\u1787). The shape is one isolated character whose nearest letter before it is Devanagari, Bengali, Gurmukhi, Gujarati, Oriya, Tamil, Telugu, Kannada, Malayalam, Sinhala, Myanmar, Khmer, Tibetan, Thai, or Lao, and whose next code point is a letter or mark of one of those scripts.
  • A doubled zero-width space in machine-translated Brahmic or Southeast Asian text. The same tools sometimes write two U+200B in a row inside a Khmer or Malayalam sentence (\u179f\u17b6\u179a\u200b\u200b\u1785). The shape is a run of exactly two U+200B whose nearest letter before it and whose next code point, a letter or mark, are of the same one of the scripts above.
  • A byte order mark in front of front matter on line 2. When a blank line is added above a file that started with a byte order mark, the U+FEFF ends up in front of the front-matter fence on line 2. The shape is an empty line 1, then a line that is exactly U+FEFF and ---, with a closing --- line later in the file.

Any other hidden code point anywhere in the file keeps the finding high, and so do a U+2060 run (`\u2060\u2060x`), a U+2060 inside a span with visible text (`jobs.\u2060define()`) or closing it, one after a double backtick, one before a space or a non-ASCII letter, one in prose (small\u2060 commits), one inside a list item's text, a run at the start of a line (\u2060\u2060When), a tag character or bidi control at the start of a line, a joiner after a one-letter Latin word (a\u200c\u0628) or inside a Latin word, a code span that repeats a code point or holds a bidi control or a tag character, and a tag or bidi run anywhere. A U+200B after a slash in prose or before a digit, two U+FEFF on a line or one beside text, and a Brahmic or Southeast Asian zero-width character next to a Latin letter, whitespace, or punctuation, or in a run, also stay high, except the doubled U+200B above. A run of three or more, a pair of U+200B between two different scripts (Thai then Khmer) or next to a Latin letter, a run that mixes U+200B with another zero-width character, a U+FEFF before front matter on any line but 2 or after a non-empty line 1, one with no closing fence, and a U+FEFF anywhere else in the file stay high. A file that holds one of these low shapes and anything else that is high, such as the long U+200D runs some translated files carry, is high.

Known false positives

Some ordinary text matches this rule byte for byte with a real attack, and the rule reports it on purpose. The finding names the line and column, so it is quick to review and fix.

  • A doubled zero-width character. Machine translation and copy-paste sometimes write a joiner twice inside a word, for example the Devanagari \u0915\u094d\u200c\u200c\u0937. A table cell can also end up with two word separators in a row (x\u200b\u200b). Two zero-width characters in a row are a run, the same bytes as a hidden run such as note\u200b\u200b before, so the rule reports them. Fix: remove the duplicate.
  • A joiner between a non-Latin letter and a Latin letter. Machine-translated text sometimes keeps an English word inside a word in another script, with a joiner at the boundary: for example a Kannada virama, a joiner, and then Latin API (\u0ccd\u200cAPI), or a Malayalam letter, U+200C, and env. A joiner next to a Latin letter is how a word split hides an instruction (ign\u200core), so the rule reports it in any script. Fix: replace the joiner with a space, or remove it.
  • A doubled zero-width space next to text. An editor can leave two U+200B in a row between punctuation and a word, for example after a footnote marker ([^1]: \u200b\u200bSee the guide). That is byte for byte the shape of the hidden run this rule targets (note\u200b\u200b before), so it is reported even in benign documentation. Fix: remove both characters.
  • A zero-width space inside a placeholder or path. A U+200B placed inside a template placeholder or path to stop auto-linking (<project\u200b-name>/src) is a zero-width character inside a word. Fix: use a code span instead.

Telling these apart from an attack needs the script of the surrounding text, not only the neighboring code points. A context-aware check is planned for a later release. If a translated file needs a direction mark, use U+200E or U+200F, which this rule does not report.

Evidence

The evidence names each run of consecutive hidden code points by its first code point, line, and column, and how many are in the run:

2 hidden code points: U+202E (bidi control) at line 3, column 34; U+202C (bidi control) at line 3, column 41

Lines are counted from 1 and split on \n. Columns count code points from 1, so a CJK character or an emoji before the run is one column. An invalid UTF-8 byte counts as one column. The first five runs are listed, then how many more there are. The finding's location line is the first run's line. SARIF and GitHub annotation output carry that line but no evidence excerpt, as for every rule.

The evidence never includes the text: not the characters a bidi run reorders, and not what a tag run spells. A tag run is named by its block, not by its code points, because each tag code point maps to one ASCII character and listing them would spell the hidden text.

The fingerprint is the file, hidden code-point sequence, and its ordinal within the file. Line and column are evidence only, so moving the same hidden sequence does not create a new finding.

A file that is not valid UTF-8 is still checked in its valid parts, and the scan reports a diagnostic and exits 3 (incomplete), but only for a file this rule reads.

Examples

Reported (the escapes stand for the raw code points):

Run `make test` before you push. \u202e;)(nuR\u202c Never skip it.
Use the stan\u200bdard formatter.
Do not ign\u200bore a failing test.
Open the .\u200benv file. See evil\u200b.com. Leave the mark on ok\u200b.

Not reported: a file that starts with a byte order mark and has no other hidden code point. Also not reported, a U+200B whose neighbors are a line boundary and a code fence, and a literal that lists the character:

\u200b```
STRIP = {"zwsp": "\u200b", "zwnj": "\u200c", "zwj": "\u200d"}

How to fix

Remove the hidden code points (the finding names each one's line and column), then review the instructions as they read without them. If a non-Latin script needs a direction mark, use U+200E or U+200F.

References

Clone this wiki locally