BUG: PackageHallucinationScorer flags Rust std paths, type names and hyphenated crates as hallucinated
Los mantenedores suelen responder en 2 días
Evaluación
- Dificultad
- 3/5
- Tiempo estimado
- 1-2 días
- Aptitud para principiantes
- 35/100
Línea de trabajo
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.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
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.
- Lenguaje dominante
- Python
- Estrellas
- 4.6k
- Forks
- 962
- Merge medio
- 2 d 13 h
- PR fusionados (30 d)
- 417
Preparar el entorno
Inicia el contenedor de desarrollo del proyecto en tu navegador, con tu propia cuenta de GitHub.
- Sin Dockerfile ni archivo de Docker Compose
- Tiene una plantilla de pull request
- Sin guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de microsoft/PyRIT
-
BUG: Overlapping scorer-evaluation globs duplicate CSVs and change accuracyPosiblemente ocupada @its-amann la tomó hace 1 día. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
microsoft/PyRIT#3430 · 1 comentario ·
Los mantenedores suelen responder en 2 días
-
BUG: MarkdownInjectionScorer misses shortcut-reference images with path-based exfiltration, and raw HTML <img>Posiblemente ocupada @aatif101 la tomó hace 2 días. AbiertoBug: triage
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
microsoft/PyRIT#3343 · 2 comentarios · 1 asignado ·
Los mantenedores suelen responder en 2 días
-
BUG: OpenAITTSTarget accepts any speed, so an out-of-range value is only sent to the API on every requestPosiblemente ocupada @ShivamSharma43 la tomó hoy. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 25/100
Los mantenedores suelen responder en 2 días
-
BUG: KeywordSelectionStrategy accepts a negative context, so SelectiveTextConverter duplicates or truncates the promptPosiblemente ocupada @ShivamSharma43 la tomó hoy. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 35/100
Los mantenedores suelen responder en 2 días
-
BUG: LetterBijectionConverter accepts a negative fixed_size and then leaves the prompt unchangedPosiblemente ocupada @ShivamSharma43 la tomó hace 1 día. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 35/100
Los mantenedores suelen responder en 2 días
Todos los issues de microsoft/PyRIT
Issues similares
-
[Bug]: Revit selector reads process ids 2000-2099 as years (flaky AgentClientTests.AYearOrAProcessIdSelectsTheHost)Posiblemente ocupada @Wurschdhaud la tomó hoy. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 83/100
pyrevitlabs/pyRevit#3817 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 1/5 Menos de una hora Aptitud para principiantes 85/100
521xueweihan/HelloGitHub#4074 ·
-
follow-up
Dificultad 2/5 1-3 horas Aptitud para principiantes 62/100
Los mantenedores suelen responder en 1 día
-
Helm chart: allow setting ingressClassName on the IngressPosiblemente ocupada @commarla la tomó hoy. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 85/100
pgadmin-org/pgadmin4#10658 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100