BUG: BinAsciiConverter identifiers collide for different word-selection indices
Maintainer thường phản hồi trong vòng 2 ngày
Đánh giá
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức phù hợp với người mới
- 62/100
Hướng nghiên cứu
Start with BinAsciiConverter._build_identifier() and compare its parameters with WordLevelConverter's use of get_identifier_params(); the issue links both files. Run the reproduction on current main, then add regression tests for distinct identifiers and successful registry registration for different indices. Confirm whether the default/all-words identifier remains unchanged, as the issue requests, and run the relevant converter and registry tests.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Describe the bug
BinAsciiConverter instances using WordIndexSelectionStrategy(indices=[0]) and indices=[1] transform different words, but have identical identifier parameters, hashes, and default registry names. Registering both instances without custom names therefore raises a duplicate-name error.
I can reproduce this and would like to take the fix and submit regression tests. Could a maintainer confirm that this is available for me to work on and clarify whether the existing default/all-words identifier must remain unchanged?
This is related to the missing selection configuration reported for StringJoinConverter in #2973. The current #2976 changes only StringJoinConverter and its tests; this report concerns the separate BinAsciiConverter override. If the team prefers a coordinated broader fix, please advise on the scope before I prepare a PR.
Steps/Code to Reproduce
Run on current main at 34cab5c7626ac6e3359aba11526d534896935250. No model, database initialization, network requests, or external data are required.
import asyncio
from pyrit.converter import BinAsciiConverter, WordIndexSelectionStrategy
from pyrit.registry import ConverterRegistry
async def main():
first = BinAsciiConverter(word_selection_strategy=WordIndexSelectionStrategy(indices=[0]))
second = BinAsciiConverter(word_selection_strategy=WordIndexSelectionStrategy(indices=[1]))
for converter in (first, second):
result = await converter.convert_async(prompt="ab cd", input_type="text")
print(result.output_text, converter.get_identifier().unique_name)
print("Equal hashes:", first.get_identifier().hash == second.get_identifier().hash)
registry = ConverterRegistry()
registry.instances.register(first)
registry.instances.register(second)
asyncio.run(main())
Expected Results
The outputs should be 6162 cd and ab 6364, respectively: the independent UTF-8 hex encodings of ab and cd are 6162 and 6364. These are different behavioral configurations, so their identifiers and default registry names should differ and both registrations should succeed.
ComponentIdentifier describes identity as a snapshot of behavioral configuration. WordLevelConverter already includes the selection strategy's get_identifier_params() in its identifier.
Actual Results
The conversion outputs are correct, but both configurations have the same identity:
6162 cd BinAsciiConverter::1b5f7f5d
ab 6364 BinAsciiConverter::1b5f7f5d
Equal hashes: True
ValueError: Instance 'BinAsciiConverter::1b5f7f5d' already exists
Both full hashes are 1b5f7f5de3b280c2738f825b231e04f593136480ebb4dccf15a1ef596dcfda76. Supplying separate custom registry names works around registration, but leaves the configuration hashes identical.
The BinAsciiConverter._build_identifier() override includes the selection strategy's class name, separator, and encoding function, but omits the strategy parameters such as indices. A focused fix would retain those behavior-bearing parameters while respecting the required compatibility of existing default identifiers.
No production code has been changed for this report.
Screenshots
Not applicable; the text output above is the reproduction result.
Versions
Windows 11, Python 3.12.0, PyRIT 1.2.0.dev0 from the source SHA above. pyrit.show_versions() reports:
System:
python: 3.12.0 (tags/v3.12.0:0fb18b0, Oct 2 2023, 13:03:39) [MSC v.1935 64 bit (AMD64)]
executable: E:\OpenSource\ai-contribution-plan\venvs\pyrit\Scripts\python.exe
machine: Windows-11-10.0.26100-SP0
Python dependencies:
pyrit: 1.2.0.dev0
Cython: None
numpy: 2.5.3
openai: 3.24.0
packaging: 26.3
pip: None
scipy: 1.18.1
setuptools: None
sqlite3: None
torch: None
transformers: 5.18.0
AI assistance: Codex wrote this reproducer and report, executed the local reproduction, and assisted with code inspection and duplicate searches.
- Ngôn ngữ chính
- Python
- Star
- 4.6k
- Fork
- 944
- Merge trung bình
- 2 ngày 20 giờ
- Pull request đã merge (30 ngày)
- 309
Chuẩn bị môi trường
Khởi chạy dev container của dự án ngay trên trình duyệt, bằng tài khoản GitHub của bạn.
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Không có hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của microsoft/PyRIT
-
BUG UnicodeReplacementConverter writes characters outside the BMP as invalid five-digit \u escapesCó thể đã có người làm @ShivamSharma43 đã nhận 2 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
Maintainer thường phản hồi trong vòng 2 ngày
-
BUG: label queries only return the final conversation of an attackCó thể đã có người làm @richlundeen đã nhận 2 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 85/100
microsoft/PyRIT#3095 · 1 bình luận · 1 người được giao ·
Maintainer thường phản hồi trong vòng 2 ngày
-
BUG Configuration keeps runtime-status errors after polling recoversCó thể đã có người làm @joeyvictorino đã nhận 2 ngày trước. Đang mởBug: triage GUI help wanted
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 86/100
microsoft/PyRIT#2868 · 4 bình luận · 1 người được giao ·
Maintainer thường phản hồi trong vòng 2 ngày
-
BUG JailBreakV-28K loader reads a `transfer_attack_type` column that does not exist upstream and drops the real `from` / `transfer_from_llm` provenanceCó thể đã có người làm @kushaltalati đã nhận hôm nay. Đang mở
Độ khó 1/5 1-3 giờ Mức phù hợp với người mới 35/100
microsoft/PyRIT#3161 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 2 ngày
-
BUG QuestionAnswerScorer counts a wrong option as correct when the answer appears inside a longer word or numberCó thể đã có người làm @barkha1research-ai đã nhận 1 ngày trước. Đang mởBug: triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 25/100
Maintainer thường phản hồi trong vòng 2 ngày
Tất cả issue của microsoft/PyRIT
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
aws-samples/sample-per-model-bedrock#191 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Docs viewer: inverted grey colormap, Phantom CT window -20 to 35 HU, smoothing up to 40 mmCó thể đã có người làm Có pull request liên kết đang mở hoặc đã được merge. Đang mởarea: docs enhancement
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 64/100
PyTomography/PyTomography#331 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
effort: low prio: low ready
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
digitalfabrik/integreat-cms#4616 ·
Maintainer thường phản hồi trong vòng 5 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 66/100
FuRongJun-1999/dsh-memory#226 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug difficulty:2 good first issue help wanted
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
MakazhanAlpamys/Soup#1865 ·
Maintainer thường phản hồi trong vòng 1 ngày