Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

BUG: LetterBijectionConverter accepts a negative fixed_size and then leaves the prompt unchanged

オープン
#3,434 コメント 0 件 リアクション 0 件 担当者 1 名 GitHub で見る

メンテナーはふだん 2 日以内に返信

@ShivamSharma43 がすでに取り組んでいます。

2026年10月22日 から。

  • #3436 @ShivamSharma43 による — オープン

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
35/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
停滞
技術スタック
python
領域
ai, security

調査の方向性

Start at LetterBijectionConverter and inspect how fixed_size is used to split the lowercase alphabet and build the identifier. Check the existing tests for fixed_size=0 and fixed_size=26, then add coverage for invalid values and verify they raise a ValueError naming fixed_size. A pull request is already open for this issue.

索引モデルが issue の本文から書いたものです。

説明

Describe the bug

LetterBijectionConverter(fixed_size=...) uses fixed_size as a slice bound on the 26 lowercase letters (letters[:fixed_size] stay fixed, letters[fixed_size:] are shuffled) but never validates it. A negative value is read from the end of the alphabet instead of being rejected:

  • fixed_size=-1 keeps the first 25 letters fixed and "shuffles" only z with itself, so the mapping is the identity and the converter sends the prompt to the target unchanged (attack at dawn -> attack at dawn).
  • fixed_size=-3 keeps 23 letters fixed and shuffles only x, y, z, so most prompts also go out in plaintext.
  • fixed_size=27 is accepted (identity mapping, identifier says 27), True is accepted as 1 (identifier says True), and 2.5 fails with slice indices must be integers or None or have an __index__ method.

The identifier records the invalid value, so a run looks like a bijection attack in memory while the target actually received plaintext.

Steps/Code to Reproduce
import asyncio
from pyrit.converter import LetterBijectionConverter

async def main():
    for fixed_size in (-1, -3, 27, True, 2.5):
        try:
            converter = LetterBijectionConverter(fixed_size=fixed_size, seed=1)
            unchanged = sum(1 for k, v in converter.mapping.items() if k == v)
            output = (await converter.convert_async(prompt="attack at dawn")).output_text
            print(repr(fixed_size), "unchanged letters:", unchanged, "->", output)
        except Exception as e:
            print(repr(fixed_size), "->", type(e).__name__, e)

asyncio.run(main())
Expected Results

fixed_size must be an integer from 0 to 26 (both already used: fixed_size=0 shuffles every letter and fixed_size=26 is tested as the identity mapping). Anything else raises a ValueError naming fixed_size.

Actual Results
-1 unchanged letters: 26 -> attack at dawn
-3 unchanged letters: 24 -> attack at dawn
27 unchanged letters: 26 -> attack at dawn
True unchanged letters: 3 -> axxagu ax badp
2.5 -> TypeError slice indices must be integers or None or have an __index__ method
Screenshots

N/A

Versions
  • OS: Windows 11
  • Python version: 3.11.9
  • PyRIT version: installed from main (ac196e57) in editable mode
主要言語
Python
スター
4.6k
フォーク
962
平均マージ
2日 13時間
マージ済み PR(30日)
423

環境構築

Codespaces で開く

このプロジェクトの開発コンテナを、あなたの GitHub アカウントでブラウザ上に起動します。

  • Dockerfile・Docker Compose ファイルなし
  • プルリクエストのテンプレートあり
  • コントリビューションガイドなし

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

microsoft/PyRIT のほかの issue

microsoft/PyRIT の issue をすべて見る

似ている issue

Python の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。