
방어 프레임워크로, 라우팅된 출처 정책을 강제하여 도구를 사용하는 LLM 에이전트의 간접 프롬프트 주입을 방지합니다. 결정적 출처 검사와 공격 성공률 및 유틸리티 유지율을 평가하기 위한 벤치마크 하네스를 포함합니다.
우리 논문의 코드, 라우터 캐시 및 실행 로그:
ROPE: 간접 프롬프트 주입에 대한 라우팅된 출처 정책 적용 Xinhang Ma, Chaowei Xiao, William Yeoh, Ning Zhang, Yevgeniy Vorobeychik 저
ROPE는 값이 사용자, 사용자가 지정한 출처, 또는 사용자 자신의 기록에서 비롯된 경우에만 상태 변경 도구에 도달하도록 허용합니다. 적용은 감사된 민감한 도구 매개변수 집합에 대한 결정론적 출처 검사로 이루어지며, 라우터 LLM은 신뢰할 수 있는 사용자 요청만 읽고 각 매개변수가 얼마나 엄격하게 검사될지 설정합니다.
| 경로 | 내용 |
|---|---|
src/rope/ | 방어 구현: 라우터, 작업별 범위, 정책 컴파일러, 출처 라벨러, 런타임 가드. |
src/rope/scopes/_floor/<suite>.json | 스위트별 감사된 민감 매개변수 테이블(모든 라우터가 공유). |
src/rope/scopes/<router>/<suite>.json | 라우터 캐시: 평가된 네 개 라우터의 작업별 범위(opus는 여섯 개 스위트 전체; gemini-3-flash, gpt-oss-20b, gpt-4o-mini는 AgentDyn 스위트). |
src/common/ | 라우터용 LLM 완료 캐시. |
autodojo/ | 여섯 개 평가 스위트(AgentDojo의 banking, slack, travel; AgentDyn의 github, shopping, dailylife)와 적응형(AutoDojo) 공격을 포함한 벤치마크 하네스. |
agentlab/ | 장기 지평 벤치마크: AgentLAB Task-Injection 트레이스와 재생 드라이버(agentlab/README.md). |
logs/ | 논문 수치의 근거가 되는 모든 ROPE 실행. |
analysis/aggregate.py | logs/에서 논문의 모든 ROPE 수치를 재계산합니다. |
Python 3.12와 openai, pydantic, jsonschema, pyyaml, docstring-parser(그리고 네이티브 Gemini 경로용 google-genai). 저장소 루트에서:
export PYTHONPATH=$PWD/autodojo/src:$PWD/src
python analysis/aggregate.py logs # every model
python analysis/aggregate.py logs gpt-4o-mini # one model
에이전트 모델별로 각 구성에 대해 스위트별 및 비가중 스위트 평균으로서 클린 유틸리티(CU), 공격 하의 유틸리티(UA), 공격 성공률(ASR)을 출력한다. 정적 공격 대 적응형 공격, 장기 지평 공격, 카테고리별 결과, 그리고 모든 잔여 공격 성공을 출력한다.
세 가지 벤치마크 오라클은 차단된 공격을 성공으로 채점하며, analysis/corrections.py는 해당 세 가지 인젝션 작업(slack IT5, dailylife IT7, github IT1)을 그 효과에 따라 재채점한다. CU와 UA는 절대 건드리지 않는다.
logs/<benchmark>/<model>/<config>/<suite>/user_task_<i>/<attack>/<case>.json
| 레벨 | 값 |
|---|---|
<benchmark> | agentdyn, agentdojo |
<model> | gpt-4o-mini, gpt-4o (AgentDyn 전용), gemini-2.5-flash, qwen3-235b |
<config> | rope (방어 기법, Opus 4.8 라우터); AgentDyn의 GPT-4o-mini는 추가로: rope-clamp, rope-defaults-only, rope-always-fully-specified, rope-always-action-open (정책 제거 실험), rope-router-<router>[-clamp] (더 저렴한 라우터) |
<attack> | clean (공격 없음, none.json), static (important_instructions), adaptive (AutoDojo), long_horizon (AgentLAB Task-Injection, AgentDojo 스위트) |
<case> | none.json (clean) 또는 injection_task_<k>.json |
각 JSON은 AgentDojo 실행 로그로, 전체 메시지 추적, 인젝션, 그리고 utility 및 security 판정을 담고 있습니다 (security: true는 공격이 성공했음을 의미합니다).
# the defense (cached Opus router):
python -m rope.run_eval --suite github --attack important_instructions
python -m rope.run_eval --suite github --attack none # clean utility
python -m rope.run_eval --suite github --defense passthrough # no defense
# a cheaper router, optionally clamped to the audited floor; a fixed-policy ablation arm:
python -m rope.run_eval --suite github --router gemini-3-flash --clamp
python -m rope.run_eval --suite github --policy-mode defaults-only
# a live router (any OpenAI-compatible model):
python -m rope.run_eval --suite github --router live --router-model openai/gpt-4o-mini
# adaptive attack: replay the AutoDojo-optimized injections
AUTODOJO_CACHE=$PWD/autodojo/variant_generation/variants/github/openai/gpt-4o-mini/routed/injections.json \
python -m rope.run_eval --suite github --attack autodojo
# long-horizon attack: replay the AgentLAB traces
python agentlab/run_eval.py --suite banking --user-task user_task_0 --injection-task injection_task_0
환경 변수: OPENROUTER_API_KEY (에이전트 모델 및 라이브 라우터), ROPE_AGENT_MODEL (기본값 openai/gpt-4o-mini), ROPE_PIPELINE_TAG (실행 이름 접두사이며, AgentDojo 모델 이름을 포함해야 함, 기본값 gpt-4o-mini-2024-07-18).
자체 라우터를 캐시에 저장하고 기본 제공되는 라우터처럼 사용하려면:
python -m rope.cache_router --router my-router --router-model <llm-id> --suite github
python -m rope.run_eval --router my-router --suite github --attack important_instructions
이 저장소는 AgentDojo와 AgentDyn(벤치마크 제품군), AutoDojo(적응형 공격) 및 AgentLAB(장기 지평 공격 추적)을 기반으로 합니다.
@article{ma2026rope,
title={ROPE: Routed origin policy enforcement against indirect prompt injection},
author={Ma, Xinhang and Xiao, Chaowei and Yeoh, William and Zhang, Ning and Vorobeychik, Yevgeniy},
journal={arXiv preprint arXiv:2608.27496},
year={2026}
}