Skip to content

FEAT: Add char_split attack technique in extra.py - #3381

Merged
Roman Lutz (romanlutz) merged 5 commits into
microsoft:mainfrom
Absarahmedofficial:feat/char-split-output-converter
Oct 26, 2026
Merged

Roman Lutz (romanlutz) merged 5 commits into
microsoft:mainfrom
Absarahmedofficial:feat/char-split-output-converter

Conversation

@Absarahmedofficial

@Absarahmedofficial Absarahmedofficial commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

Description

Registers the char_split attack technique in pyrit/setup/initializers/techniques/extra.py by composing PromptTemplateConverter and SearchReplaceConverter on PromptSendingAttack via AttackConverterConfig:

  • Request side (PromptTemplateConverter): Appends output-formatting instructions asking the target to insert '.' between adjacent letters inside each word while leaving spaces, hyphens, and punctuation unchanged.
  • Response side (SearchReplaceConverter): Normalizes the response before scoring with a single-pass regex (pattern=r"(\.){2}|(?<=\S)\.(?=\S)", replace=r"\1") that unescapes doubled periods (.. -> .) and strips single intra-word periods (. -> "").

This replaces the earlier OutputFormatConverter/CharSplitOutputConverter approach in this PR, per the review discussion. Those files are removed.

cc Roman Lutz (@romanlutz)

Tests and Documentation

  • Updated EXTRA_TECHNIQUE_NAMES and test_default_registers_only_core in tests/unit/setup/test_technique_initializer.py.
  • Added TestCharSplitTechnique in tests/unit/setup/techniques/test_extra_techniques.py covering factory wiring, request prompt formatting, response decoding/unescaping, and end-to-end execution through AttackExecutor.

Comment thread pyrit/converter/output_format_converter.py Outdated
@Absarahmedofficial
Absarahmedofficial force-pushed the feat/char-split-output-converter branch from 660c0d4 to de4c0b6 Compare October 22, 2026 23:02
@Absarahmedofficial Absarahmedofficial changed the title FEAT: Add OutputFormatConverter and CharSplitOutputConverter FEAT: Add char_split attack technique in extra.py Oct 22, 2026
Comment thread pyrit/setup/initializers/techniques/extra.py Outdated
Comment thread pyrit/setup/initializers/techniques/extra.py Outdated

@romanlutz Roman Lutz (romanlutz) left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Excellent contribution! I'm adding a couple of tests but this is good to merge.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 5702ce84-3326-45d7-8b0e-32f10eb5c16e
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 5702ce84-3326-45d7-8b0e-32f10eb5c16e
@romanlutz
Roman Lutz (romanlutz) added this pull request to the merge queue Oct 26, 2026
Merged via the queue into microsoft:main with commit 8259b97 Oct 26, 2026
72 of 73 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants