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

Metadata filters crash on keys containing dots or other special characters

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

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

まだ誰も着手していません。

評価

難易度
3/5
見積もり時間
半日
初心者へのやさしさ
25/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
停滞
技術スタック
python, sql, sqlalchemy, sqlite
領域
databases

調査の方向性

The bug is in the metadata condition builders in pyrit/memory/sqlite_memory.py and pyrit/memory/azure_sql_memory.py, specifically _get_seed_metadata_conditions and _get_message_pieces_prompt_metadata_conditions, where the key is interpolated into the JSON path and the bind name. Read the label fix from #3063 for the pattern. PR #3180 is already open against this, so check it before starting. Done means a dotted key like a.b filters correctly in both backends.

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

説明

Describe the bug

Filtering seeds or message pieces by a prompt_metadata key that contains a dot (or any character outside a plain SQL bind name, like a hyphen or a space) crashes the query instead of filtering.

In sqlite_memory.py and azure_sql_memory.py, _get_seed_metadata_conditions and _get_message_pieces_prompt_metadata_conditions build the SQL with the key interpolated into both the JSON path and the bind parameter name:

f"JSON_EXTRACT(prompt_metadata, '$.{key}') = :{key}"

For a key like a.b, SQLAlchemy parses :a.b as a parameter named a followed by literal text, so the later bindparams() call raises ArgumentError: This text() construct doesn't define a bound parameter named 'a.b'.

This is the same class of problem #3063 fixed for memory labels, where the accepted fix quotes the JSON path and uses indexed parameter names.

Steps/Code to Reproduce
import asyncio, tempfile
from pyrit.memory.sqlite_memory import SQLiteMemory
from pyrit.models import SeedPrompt

async def main():
    memory = SQLiteMemory(db_path=tempfile.mktemp(suffix=".db"), verbose=False)
    await memory.add_seeds_to_memory_async(seeds=[
        SeedPrompt(value="dotted", data_type="text", dataset_name="t", metadata={"a.b": "v1"}),
    ], added_by="repro")
    got = await memory.get_seeds_async(metadata={"a.b": "v1"})  # raises ArgumentError
    print(got)

asyncio.run(main())
Expected Results

The filter matches the stored seed by the literal metadata key a.b and returns it.

Actual Results
sqlalchemy.exc.ArgumentError: This text() construct doesn't define a bound parameter named 'a.b'
Screenshots

N/A

Versions

OS: macOS
Python version: 3.14
PyRIT version: installed from main (66c41fa)

主要言語
Python
スター
4.6k
フォーク
944
平均マージ
2日 16時間
マージ済み PR(30日)
350

環境構築

Codespaces で開く

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

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

はじめの一歩

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

microsoft/PyRIT のほかの issue

microsoft/PyRIT の issue をすべて見る

似ている issue

Python の issue をもっと見る

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

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