Repository navigation
FEAT: Add runic/ogham (Leetspeak configs) + mirror/upside_down Encoding techniques - #4455
Roman Lutz (romanlutz) wants to merge 2 commits into
Conversation
There was a problem hiding this comment.
🟡 Changes recommended
The concrete CharacterMapConverter helper is automatically registered and exposed as a usable converter, but its empty mapping silently leaves prompts unchanged.
1 open issue
What changed in this PR
This PR adds four text-obfuscation converters to PyRIT, sharing character-mapping logic and integrating them into the Garak Encoding scenario.
Changes:
- Adds Runic, Ogham, Mirror, and UpsideDown converters with lazy public exports.
- Includes all four in exhaustive Encoding runs while preserving the curated default.
- Adds converter unit tests, updates technique-selection assertions, and extends Python documentation examples.
| File | Description |
|---|---|
tests/unit/scenario/garak/test_encoding.py |
Updates exhaustive technique membership and count. |
tests/unit/converter/test_upside_down_converter.py |
Tests rotation mappings, reversal, and input validation. |
tests/unit/converter/test_runic_converter.py |
Tests rune mappings, case handling, and passthrough. |
tests/unit/converter/test_ogham_converter.py |
Tests Ogham mappings, spacing, and passthrough. |
tests/unit/converter/test_mirror_converter.py |
Tests mirrored glyphs, reversal, and input validation. |
pyrit/scenario/scenarios/garak/encoding.py |
Adds four selectable encoding techniques and converter variants. |
pyrit/converter/upside_down_converter.py |
Defines rotated glyph mappings with reversed output. |
pyrit/converter/runic_converter.py |
Defines case-insensitive Elder Futhark mappings. |
pyrit/converter/ogham_converter.py |
Defines case-insensitive Ogham mappings. |
pyrit/converter/mirror_converter.py |
Defines mirrored glyph mappings with reversed output. |
pyrit/converter/_character_map.py |
Shares substitution, case handling, reversal, and validation. |
pyrit/converter/__init__.py |
Exposes all four converters through lazy exports. |
doc/code/converters/1_text_to_text_converters.py |
Adds usage examples for the new converters. |
Review effort: Balanced
| from pyrit.models import PromptDataType | ||
|
|
||
|
|
||
| class CharacterMapConverter(Converter): |
4ced7ef to
3bbd71c
Compare
|
Reworked per the reuse-before-adding guidance: runic and ogham are now |
…cterMap) Encoding techniques Per review (reuse and compose before adding): runic and ogham are implemented as LeetspeakConverter substitution tables (no dedicated class). Mirror and UpsideDown keep dedicated converters on a shared CharacterMapConverter base because they combine a case-specific glyph map with full-string reversal, which a case-folded Leetspeak table cannot express. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
3bbd71c to
9050568
Compare

Adds four Unicode symbol-script / style Encoding techniques.
LeetspeakConverter(custom_substitutions=…)configs (no dedicated class; glyph tables kept as_RUNIC_SUBSTITUTIONS/_OGHAM_SUBSTITUTIONS). Sources: Unicode Runic (U+16A0) and Ogham (U+1680) blocks.CharacterMapConverterbase, because they combine a case-specific glyph map with full-string reversal (a case-folded Leetspeak table can't expressC→Ɔ,R→Я, or the reversal). Source: community symbol-script transforms (elder-plinius's P4RS3LT0NGV3).gap-1 converter series: #4441 #4442 #4443 #4444 #4445 #4446 #4447 #4448 #4449 #4450 #4451 #4452 #4454 #4455 #4456 #4457 #4458
🤖 Generated with Claude Code