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

BUG: case insensitive keyword selection returns a shifted range when lowercasing expands a character

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

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

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

2026年10月27日 から。

評価

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

調査の方向性

issueで言及されている KeywordSelectionStrategy.select_range を見つけ、大文字と小文字を区別しない一致を元のテキスト上の位置にどう対応付けているか調べてください。keyword="secret" と text="İsecret" で再現してください。小文字化による文字列の展開があっても、返された範囲で元のテキストからキーワード全体を切り出せれば完了です。payloadにはテストファイルの指定がないため、この再現ケースのテストを探すか追加してください。

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

説明

Description

KeywordSelectionStrategy.select_range locates the keyword with text.lower().find(keyword.lower()) in case insensitive mode and then applies that index to the original, unlowered text. str.lower() is not length preserving for every character: a dotted capital I (İ, U+0130) lowercases to two code points, so every such character before the match shifts the returned range.

With keyword="secret" and case_sensitive=False on the text İsecret, the strategy returns the range (2, 7), which slices to ecret: the leading s of the keyword is left out. A SelectiveTextConverter built on this strategy then converts the wrong characters and the actual secret stays in the clear.

Expected Behavior

The selected range must slice to the keyword (plus any requested context) on the original text, whatever lowercase expansion occurs earlier in the string.

Reproduction Steps

  1. Build KeywordSelectionStrategy(keyword="secret", case_sensitive=False).
  2. Call select_range(text="İsecret").
  3. The returned range slices to ecret on main.

Minimal Reproduction

strategy = KeywordSelectionStrategy(keyword="secret", case_sensitive=False)
start, end = strategy.select_range(text="İsecret")
"İsecret"[start:end]  # "ecret" on main

Environment

PyRIT main. Python 3.11.

主要言語
Python
スター
4.7k
フォーク
980
平均マージ
2日 7時間
マージ済み PR(30日)
446

環境構築

Codespaces で開く

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

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

はじめの一歩

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

microsoft/PyRIT のほかの issue

microsoft/PyRIT の issue をすべて見る

似ている issue

Python の issue をもっと見る

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

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