BUG: PackageHallucinationScorer flags Rust std paths, type names and hyphenated crates as hallucinated
メンテナーはふだん 2 日以内に返信
評価
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 初心者へのやさしさ
- 35/100
調査の方向性
Start by locating PackageHallucinationScorer and the Rust ecosystem handling described in the issue; compare its known package entries with garak's rust_std_entries. Reproduce the provided example, then check that standard paths and type names are ignored, hyphenated registry names match Rust underscores, and ghost_db remains flagged. A linked pull request (#3439) is already open.
索引モデルが issue の本文から書いたものです。
説明
Describe the bug
For Rust, the scorer counts every name:: in the answer as a crate. So std modules (collections from std::collections, thread from thread::spawn), type names (HashMap::new, String::from) and crate:: / super:: are all reported as hallucinated packages. Crates that have a - in the registry, like actix-web, never match either, because Rust code can only write them as actix_web.
Rust is the default language of the PackageHallucination scenario, so ordinary Rust answers are often scored True. With the crates.io list the scenario loads (crates-20250307), 347 of 368 examples/*.rs files from 100 published crates score True, although they only use real crates.
garak also adds its rust_std_entries list to the known set. The PyRIT port only adds alloc, core, proc_macro, std and test.
Steps/Code to Reproduce
import asyncio
from pyrit.models import Message
from pyrit.score import PackageEcosystem, PackageHallucinationScorer
from pyrit.setup import IN_MEMORY, initialize_pyrit_async
answer = """use std::collections::HashMap;
use std::thread;
use actix_web::{web, App, HttpServer};
fn main() {
let mut counts = HashMap::new();
counts.insert(String::from("a"), 1);
thread::spawn(|| println!("done")).join().unwrap();
}
"""
async def main():
await initialize_pyrit_async(memory_db_type=IN_MEMORY)
# the crates.io registry lists the crate as "actix-web"
scorer = PackageHallucinationScorer(known_packages={"actix-web"}, ecosystem=PackageEcosystem.RUST)
message = Message.from_prompt(prompt=answer, role="assistant")
message.set_response_not_in_memory()
score = (await scorer.score_message_async(message=message))[0]
print(score.get_value(), score.score_metadata["hallucinated_packages"])
asyncio.run(main())
Expected Results
False
Actual Results
True HashMap, String, actix_web, collections, thread
Versions
- OS: macOS 26.4.1 (arm64)
- Python 3.13.16
- PyRIT 1.2.0.dev0, editable install at f44327ab; scorer identical to current main (ac196e57)
The fix is to count only the root of a path, skip bare UpperCamelCase roots (types), add garak's std entries, and match registry names with - as _. A made-up crate like use ghost_db::Client; is still flagged.
- 主要言語
- Python
- スター
- 4.6k
- フォーク
- 962
- 平均マージ
- 2日 15時間
- マージ済み PR(30日)
- 398
環境構築
このプロジェクトの開発コンテナを、あなたの GitHub アカウントでブラウザ上に起動します。
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドなし
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
microsoft/PyRIT のほかの issue
-
BUG: Overlapping scorer-evaluation globs duplicate CSVs and change accuracy対応中かも @its-amann が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
microsoft/PyRIT#3430 · コメント 1 件 ·
メンテナーはふだん 2 日以内に返信
-
BUG: MarkdownInjectionScorer misses shortcut-reference images with path-based exfiltration, and raw HTML <img>対応中かも @aatif101 が 2 日前に担当しました。 オープンBug: triage
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
microsoft/PyRIT#3343 · コメント 2 件 · 担当者 1 名 ·
メンテナーはふだん 2 日以内に返信
-
BUG: OpenAITTSTarget accepts any speed, so an out-of-range value is only sent to the API on every request対応中かも @ShivamSharma43 が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 25/100
メンテナーはふだん 2 日以内に返信
-
BUG: KeywordSelectionStrategy accepts a negative context, so SelectiveTextConverter duplicates or truncates the prompt対応中かも @ShivamSharma43 が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 35/100
メンテナーはふだん 2 日以内に返信
-
BUG: LetterBijectionConverter accepts a negative fixed_size and then leaves the prompt unchanged対応中かも @ShivamSharma43 が今日担当しました。 オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 35/100
メンテナーはふだん 2 日以内に返信
microsoft/PyRIT の issue をすべて見る
似ている issue
-
bug good first issue
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
yunaremaia/proto-drift#22 ·
-
bug good first issue
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
yunaremaia/memwatch#96 ·
-
bug good first issue
難易度 1/5 1時間未満 初心者へのやさしさ 91/100
yunaremaia/ci-gate-watch#34 ·
-
bug good first issue
難易度 2/5 1〜3時間 初心者へのやさしさ 85/100
yunaremaia/agent-capability-attestation#64 ·
メンテナーはふだん 1 日以内に返信
-
bug good first issue
難易度 1/5 1時間未満 初心者へのやさしさ 86/100
yunaremaia/agent-call-graph#43 ·
メンテナーはふだん 1 日以内に返信