T02 · Agent Memory Poisoning
- Location
src/case_store.py:183- Finding
Persistent prompt injection through the user-maintained case library
- Content
View full analysis
dict: normalized = self.normalize_case(case) existing_cases = self.load_all_cases() existing_ids = {item["id"] for item in existing_cases} if normalized["id"] in existing_ids: raise CaseValidationError(f"案例 id 已存在: {normalized['id']}") user_cases = self.load_user_cases() user_cases.append(normalized) self.user_cases_path.write_text( json.dumps(user_cases, ensure_ascii=False, indent=2) + "\n", encoding="utf-8", ) return normalized ``` `src/retriever.py:20-23` automatically loads the persistent records: ```python def __init__(self, cases_path: Path, user_cases_path: Path | None = None) -> None: self.cases_path = cases_path self.user_cases_path = user_cases_path ...[truncated 3217 chars]- Remediation
View remediation
