The agent that grows with you
Python aiai-agentai-agentsanthropicchatgptclaudeclaude-codecodexhermeshermes-agentllmnous-researchopenai
fix(tirith): treat every emoji-capable base as VS16 presentation; trim tests; docs
teknium1fa8330322f31
diff --git a/tests/tools/test_tirith_security.py b/tests/tools/test_tirith_security.pyindex 42f38bc1420..12178783efa 100644--- a/tests/tools/test_tirith_security.py+++ b/tests/tools/test_tirith_security.py@@ -677,25 +677,32 @@ class TestAppTldSuppression:class TestEmojiVariationSelectorSuppression:- """Emoji presentation selectors must not require terminal approval."""+ """VS16 after an emoji-capable base is presentation, not obfuscation: no approval prompt."""++ _VS = [{"rule_id": "variation_selector", "severity": "medium"}]@patch("tools.tirith_security.subprocess.run")@patch("tools.tirith_security._load_security_config")def test_emoji_only_variation_selector_warn_is_downgraded(self, mock_cfg, mock_run):mock_cfg.return_value = _CFG- findings = [{"rule_id": "variation_selector", "severity": "medium"}]- mock_run.return_value = _mock_run(2, _json_stdout(findings, "variation selector"))+ mock_run.return_value = _mock_run(2, _json_stdout(self._VS, "variation selector"))- result = check_command_security('ls "🗞️ Journal/"')+ # SMP emoji, Dingbats/Misc Symbols, and BMP singletons outside those blocks (ℹ ▶).+ result = check_command_security('ls "🗞️ Journal/" "✅️ Projects/" "ℹ️ Info/" "▶️ Media/"')assert result == {"action": "allow", "findings": [], "summary": ""}- @pytest.mark.parametrize("command", ["printf 'a️'", "printf '0️'", "printf 'x󠄀'"])+ @pytest.mark.parametrize("command, findings", [+ ("printf 'a️'", _VS), # VS16 after a letter+ ("printf '0️'", _VS), # VS16 after a digit (keycap base)+ ("printf 'x󠄀'", _VS), # a non-VS16 selector+ ('curl https://bit.ly/x --output "🗞️ Journal/file"', # emoji path + another finding+ _VS + [{"rule_id": "shortened_url", "severity": "medium"}]),+ ])@patch("tools.tirith_security.subprocess.run")@patch("tools.tirith_security._load_security_config")- def test_non_emoji_or_non_fe0f_variation_selector_keeps_warn(self, mock_cfg, mock_run, command):+ def test_other_selectors_or_mixed_findings_keep_warn(self, mock_cfg, mock_run, command, findings):mock_cfg.return_value = _CFG- findings = [{"rule_id": "variation_selector", "severity": "medium"}]mock_run.return_value = _mock_run(2, _json_stdout(findings, "variation selector"))result = check_command_security(command)@@ -703,21 +710,6 @@ class TestEmojiVariationSelectorSuppression:assert result["action"] == "warn"assert result["findings"] == findings- @patch("tools.tirith_security.subprocess.run")- @patch("tools.tirith_security._load_security_config")- def test_mixed_findings_keep_warn_for_emoji_path(self, mock_cfg, mock_run):- mock_cfg.return_value = _CFG- findings = [- {"rule_id": "variation_selector", "severity": "medium"},- {"rule_id": "shortened_url", "severity": "medium"},- ]- mock_run.return_value = _mock_run(2, _json_stdout(findings, "mixed"))-- result = check_command_security('curl https://bit.ly/x --output "🗞️ Journal/file"')-- assert result["action"] == "warn"- assert result["findings"] == findings-class TestIsAppTldFinding:"""Unit tests for the _is_app_tld_finding helper."""diff --git a/tools/tirith_security.py b/tools/tirith_security.pyindex a1870999f7f..e135f3074ca 100644--- a/tools/tirith_security.py+++ b/tools/tirith_security.py@@ -478,7 +478,18 @@ _NO_DETAILS_SUMMARY = {"block": "security issue detected (details unavailable)","warn": "security warning detected (details unavailable)"}_VARIATION_SELECTOR_16 = "\ufe0f"-_EMOJI_PRESENTATION_BASE_RANGES = ((0x2600, 0x27BF), (0x1F000, 0x1FAFF))+# Code points that carry the Unicode ``Emoji`` property and take VS16 for emoji presentation: the+# Miscellaneous Symbols / Dingbats blocks, the SMP emoji planes, and the BMP singletons outside them+# (©️ ®️ ‼️ ⁉️ ™️ ℹ️ arrows, ⌚ ⌨️ ⏏️ media keys, Ⓜ️ ▪️ ▶️ ◀️ ◻️ ⤴️ ⬅️ ⬛ ⭐ ⭕ 〰️ 〽️ ㊗️ ㊙️).+# Digits, ``#`` and ``*`` also carry the property (keycap bases) but are deliberately absent: VS16+# after a letter or digit is exactly the steganography signal the rule exists for.+_EMOJI_PRESENTATION_BASE_RANGES = (+ (0x00A9, 0x00A9), (0x00AE, 0x00AE), (0x203C, 0x203C), (0x2049, 0x2049), (0x2122, 0x2122),+ (0x2139, 0x2139), (0x2194, 0x2199), (0x21A9, 0x21AA), (0x231A, 0x231B), (0x2328, 0x2328),+ (0x23CF, 0x23CF), (0x23E9, 0x23F3), (0x23F8, 0x23FA), (0x24C2, 0x24C2), (0x25AA, 0x25AB),+ (0x25B6, 0x25B6), (0x25C0, 0x25C0), (0x25FB, 0x25FE), (0x2600, 0x27BF), (0x2934, 0x2935),+ (0x2B05, 0x2B07), (0x2B1B, 0x2B1C), (0x2B50, 0x2B50), (0x2B55, 0x2B55), (0x3030, 0x3030),+ (0x303D, 0x303D), (0x3297, 0x3297), (0x3299, 0x3299), (0x1F000, 0x1FAFF))def _verdict(action: str, summary: str = "", findings: list | None = None) -> dict:diff --git a/website/docs/user-guide/security.md b/website/docs/user-guide/security.mdindex bd9f5d899c8..c87333c14c4 100644--- a/website/docs/user-guide/security.md+++ b/website/docs/user-guide/security.md@@ -797,6 +797,8 @@ Tirith ships prebuilt binaries for Linux (x86_64 / aarch64) and macOS (x86_64 /Tirith's verdict integrates with the approval flow: safe commands pass through, while both suspicious and blocked commands trigger user approval with the full tirith findings (severity, title, description, safer alternatives). Users can approve or deny — the default choice is deny to keep unattended scenarios secure.+Two known Tirith false positives are downgraded to "allow" so they never prompt (or, in cron, never deny): a `lookalike_tld` warning whose only target is the legitimate `.app` gTLD, and a `variation_selector` warning when every selector in the command is U+FE0F directly after an emoji (folder names such as `🗞️ Journal/` or `▶️ Media/`). A variation selector after a letter or digit — the steganographic-obfuscation signal the rule exists for — still prompts.+### Context File Injection ProtectionContext files (AGENTS.md, .cursorrules, SOUL.md) are scanned for prompt injection before being included in the system prompt. The scanner checks for: