# ai-config-hidden-unicode-v1

> ai-config-hidden-unicode-v1: 3 Keryn rules for generic (3 error).

Source: https://keryn.dev/rules/ai-config-hidden-unicode-v1/

3 rules · Keryn Software Licence · rules 0.8.0 · [all packs](https://keryn.dev/rules/)

**How to read a rule**

- **Severity**: How bad the finding is if it is real: `error` fails a default gate, `warning` and `info` do not.

- **Confidence**: **P0** exploitable as written; **P1** dangerous in context; **P2** a heuristic or a posture check: confirm by reading the code.

- **False-positive risk**: **low**: an exact API or flag, so hits are almost always real; **medium**: the pattern is legitimate in many programs, so check each hit; **high**: it finds a lead to confirm, so expect benign hits.

- **Edge**: The relationship the finding sits on. **reaches**: content or traffic gets to a thing; **calls**: one thing invokes another; **reads**: one thing reads from another; **writes**: one thing writes to another; **sends**: data leaves for another party; **grants**: authority is given or left unchecked; **depends_on**: something relies on a component it does not verify; **trusts**: one party believes another without evidence. The boundary it crosses, when there is one: **user->prompt** (untrusted input reaching a prompt); **model->code** (model output reaching code, a shell, a query or a page); **secret->outside** (a secret leaving the trusted side); **supply-chain** (code, models or prompts pulled in from outside).

- **Taxonomy chips**: References for readers who work in OWASP LLM 2025, OWASP Agentic, CWE or NIST AI RMF. They say where a rule belongs, not that a framework is satisfied.

## seceng.aiconfig.invisible-unicode-character

`error` generic agent-config, mcp, prompt-templates, openapi

This AI configuration or prompt file contains invisible Unicode (zero-width space, word joiner, invisible operators, Unicode tag characters U+E0000-U+E007F, variation selectors supplement). The model reads these code points while a reviewer sees nothing, which is how hidden instructions and spoofed server or tool names are smuggled into configs, prompts and API specs. Strip them.

Confidence **P1**: dangerous in context. False-positive risk **low**: an exact API or flag, so hits are almost always real.

Edge inspected: [grants](https://keryn.dev/docs/edges/edge-kinds/#grants) authority is given or left unchecked.

[CWE-116](https://keryn.dev/taxonomies/cwe/#cwe-116-improper-encoding-or-escaping-of-output) [CWE-451](https://keryn.dev/rules/?cwe=CWE-451) [CWE-1007](https://keryn.dev/rules/?cwe=CWE-1007) [LLM01](https://keryn.dev/taxonomies/owasp-llm/#llm01-prompt-injection) [ASI01](https://keryn.dev/taxonomies/owasp-agentic/#asi01-agent-goal-hijack) [ASI04](https://keryn.dev/taxonomies/owasp-agentic/#asi04-agentic-supply-chain-vulnerabilities)

**Fix:** Delete the invisible characters, diff the file against a known-good copy to find any text they encoded, and block these code points in CI for every file an agent loads. Emoji ZWJ (U+200D) and a leading BOM are intentionally not flagged.

**References:** [https://genai.owasp.org/llmrisk/llm01-prompt-injection/](https://genai.owasp.org/llmrisk/llm01-prompt-injection/) · [https://www.unicode.org/charts/PDF/UE0000.pdf](https://www.unicode.org/charts/PDF/UE0000.pdf) · [https://www.unicode.org/reports/tr39/](https://www.unicode.org/reports/tr39/)

## seceng.aiconfig.bidi-override-character

`error` generic agent-config, mcp, prompt-templates, openapi

This AI configuration or prompt file contains Unicode bidirectional control characters (U+202A-U+202E, U+2066-U+2069). They reorder the displayed text so a reviewer reads something other than what the model, the MCP client or the Actions runtime ingests (a server name, a URL, an instruction). Strip them.

Confidence **P1**: dangerous in context. False-positive risk **low**: an exact API or flag, so hits are almost always real.

Edge inspected: [grants](https://keryn.dev/docs/edges/edge-kinds/#grants) authority is given or left unchecked.

[CWE-116](https://keryn.dev/taxonomies/cwe/#cwe-116-improper-encoding-or-escaping-of-output) [CWE-451](https://keryn.dev/rules/?cwe=CWE-451) [CWE-1007](https://keryn.dev/rules/?cwe=CWE-1007) [LLM01](https://keryn.dev/taxonomies/owasp-llm/#llm01-prompt-injection) [ASI01](https://keryn.dev/taxonomies/owasp-agentic/#asi01-agent-goal-hijack) [ASI04](https://keryn.dev/taxonomies/owasp-agentic/#asi04-agentic-supply-chain-vulnerabilities)

**Fix:** Remove all bidirectional control characters and add a CI check (for example grep -P for the code points) so they cannot be reintroduced in any file an agent loads.

**References:** [https://genai.owasp.org/llmrisk/llm01-prompt-injection/](https://genai.owasp.org/llmrisk/llm01-prompt-injection/) · [https://www.unicode.org/reports/tr9/](https://www.unicode.org/reports/tr9/)

## seceng.aiconfig.escaped-invisible-unicode

`error` generic agent-config, mcp, json, openapi

This JSON or YAML AI configuration spells an invisible or direction-overriding Unicode code point as an escape sequence (`​`, `‮`, `⁦`, `﻿`, or the `\udb40\udcXX` surrogate pair of a Unicode tag character). The file bytes are plain ASCII, so byte-level scanners and reviewers see nothing, but every JSON parser decodes the escape and the model, MCP client or Actions runtime receives the hidden character. Remove the escape.

Confidence **P1**: dangerous in context. False-positive risk **low**: an exact API or flag, so hits are almost always real.

Edge inspected: [grants](https://keryn.dev/docs/edges/edge-kinds/#grants) authority is given or left unchecked.

[CWE-116](https://keryn.dev/taxonomies/cwe/#cwe-116-improper-encoding-or-escaping-of-output) [CWE-451](https://keryn.dev/rules/?cwe=CWE-451) [CWE-1007](https://keryn.dev/rules/?cwe=CWE-1007) [LLM01](https://keryn.dev/taxonomies/owasp-llm/#llm01-prompt-injection) [ASI01](https://keryn.dev/taxonomies/owasp-agentic/#asi01-agent-goal-hijack) [ASI04](https://keryn.dev/taxonomies/owasp-agentic/#asi04-agentic-supply-chain-vulnerabilities)

**Fix:** Delete the escape sequences (and the character they would decode to), review what the decoded text would have told the model, and lint agent-facing JSON and YAML for these escapes in CI.

**References:** [https://genai.owasp.org/llmrisk/llm01-prompt-injection/](https://genai.owasp.org/llmrisk/llm01-prompt-injection/) · [https://www.unicode.org/charts/PDF/UE0000.pdf](https://www.unicode.org/charts/PDF/UE0000.pdf) · [https://www.rfc-editor.org/info/rfc8259/#section-7](https://www.rfc-editor.org/info/rfc8259/#section-7)
