T02 · Agent Memory Poisoning
- Location
skills/amazon-asin-dynamic-scoring/scripts/patch_scoring_to_agent.py:143- Finding
Undisclosed persistent modification of Agent instruction files
- Content
View full analysis
bool: """Patch a CLAUDE.md file to add scoring module. Returns True if changes made.""" path = Path(filepath) if not path.exists(): print(f"ERROR: File not found: {filepath}") return False content = path.read_text(encoding="utf-8") # Check if already has the full scoring step (not just the reference line) if "二次评分(动态评分引擎)" in content: print(f"SKIP: {filepath} already has scoring step") return False # Check if it uses amazon-product-scout-agent if "amazon-product-scout-agent" not in content: print(f"SKIP: {filepath} does not use amazon-product-scout-agent") return False original = content changes = [] # 1. Add skill reference line after amazon-product-scout-agent line pattern_ref = r"(主脚本:call skill `amazon-product-scout-agent`[^\n]*)" if re.search(pattern_ref, content) and SKILL_REF_LINE not in content: content = re.sub( pattern_ref, r"\1\n" + SKILL_REF_LINE, content ) changes.append("skill 引用行") # 2. Add --json-output to product_scout_agent.py command if "--json-output" not in content: content = re.sub( r"(python3 /scripts/product_scout_agent\.py[^`]*?--sort-desc\s+\S+)\s*\n```", r"\1 \\\n --json-output\n```", content ) changes.append("--json-output 标志") # 3. Add "评分" trigger to intent recognition trigger_line = '- 用户说"评分""打分""二次筛选""精排" → 进入二次评分流程' if trigger_line not in content: intent_section = re.search( r"(## Step 1[^#]*?)(\n##\s)", content, re.DOTALL ) if in ...[truncated 4076 chars]- Remediation
View remediation
