Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

BUG: MathObfuscation, NegationTrap, SelectiveText and Zalgo converter identifiers ignore settings that change output

已关闭
#3,287 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 2 天内回复

@ShivamSharma43 已经在做这个了。

开始于 2026年10月18日。

  • #3288 来自 @ShivamSharma43 —— 已合并

评估

难度
3/5
预计耗时
1-2 天
新手友好度
25/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
停滞
技术栈
python
领域
tooling

调研方向

Read the identifier implementations for MathObfuscationConverter, NegationTrapConverter, SelectiveTextConverter, and ZalgoConverter; compare them with seeded converters such as EmojiConverter. Use the reproduction pairs and ConverterRegistry registration shown in the issue to check the behavior. Done means differently configured instances have different identifiers and both NegationTrapConverter instances register successfully.

由索引模型根据 Issue 内容生成。

描述

Describe the bug

Four text converters leave settings that change their output out of their identifiers, so differently configured instances share one hash:

  • MathObfuscationConverter: hint and suffix (only min_n and max_n are included).
  • NegationTrapConverter: wrong_value and trap_template. It does not override _build_identifier() at all, so its identifier only holds the supported input and output types.
  • SelectiveTextConverter: word_separator, which word-level strategies split and rejoin on.
  • ZalgoConverter: seed. Other seeded converters (EmojiConverter, CharSwapConverter, AskToDecodeConverter, RandomCapitalLettersConverter, ...) include seed.

Because the default registry name comes from that hash, registering a second configuration without a custom name raises a duplicate-name error, and memory and analytics cannot tell the configurations apart. This is the same problem as #3242 and #3244, for these text converters.

Steps/Code to Reproduce
from pyrit.converter import (
    Base64Converter,
    MathObfuscationConverter,
    NegationTrapConverter,
    SelectiveTextConverter,
    ZalgoConverter,
)
from pyrit.converter.text_selection_strategy import WordPositionSelectionStrategy
from pyrit.registry import ConverterRegistry

words = WordPositionSelectionStrategy(start_proportion=0, end_proportion=0.5)
pairs = [
    (MathObfuscationConverter(hint="a"), MathObfuscationConverter(hint="")),
    (MathObfuscationConverter(suffix="x"), MathObfuscationConverter(suffix="")),
    (NegationTrapConverter(wrong_value="1234"), NegationTrapConverter(wrong_value="hunter2")),
    (
        NegationTrapConverter(trap_template="A {prompt} {wrong_value}"),
        NegationTrapConverter(trap_template="B {prompt} {wrong_value}"),
    ),
    (
        SelectiveTextConverter(sub_converter=Base64Converter(), selection_strategy=words),
        SelectiveTextConverter(sub_converter=Base64Converter(), selection_strategy=words, word_separator=","),
    ),
    (ZalgoConverter(seed=1), ZalgoConverter(seed=2)),
]
for first, second in pairs:
    print(first.get_identifier().unique_name, second.get_identifier().unique_name)

registry = ConverterRegistry()
registry.instances.register(NegationTrapConverter(wrong_value="1234"))
registry.instances.register(NegationTrapConverter(wrong_value="hunter2"))
Expected Results

Each pair has two different identifiers, and both NegationTrapConverter instances register.

Actual Results
MathObfuscationConverter::81c6f15b MathObfuscationConverter::81c6f15b
MathObfuscationConverter::81c6f15b MathObfuscationConverter::81c6f15b
NegationTrapConverter::89a3d225 NegationTrapConverter::89a3d225
NegationTrapConverter::89a3d225 NegationTrapConverter::89a3d225
SelectiveTextConverter::91a088c0 SelectiveTextConverter::91a088c0
ZalgoConverter::78d075f9 ZalgoConverter::78d075f9
ValueError: Instance 'NegationTrapConverter::89a3d225' already exists
Screenshots

N/A

Versions
  • OS: Windows 11
  • Python version: 3.11.9
  • PyRIT version: installed from main (5b594e00) in editable mode
主要语言
Python
星标
4.6k
派生
962
平均合并
2 天 16 小时
30 天内合并 PR
354

环境准备

在 Codespaces 中打开

在浏览器里用你自己的 GitHub 账号启动这个项目的开发容器。

  • 没有 Dockerfile 或 Docker Compose 文件
  • 有 Pull Request 模板
  • 没有贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

microsoft/PyRIT 的其他 Issue

查看 microsoft/PyRIT 的全部 Issue

相似的 Issue

更多 Python Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。