T01 · Skill Instruction Hijacking
- Location
scripts/beautyplus_ai.py:121- Finding
Untrusted Server Responses Can Inject Links into Mandatory Agent Replies
- Content
View full analysis
dict: """Structured stdout for POST /skill/consume.json failures (see docs/errors-and-polling.md).""" api_code = e.code detail = e.msg if api_code == 60001: err = "membership_required" agent_instruction = ( "MANDATORY (user-visible): Quota consume failed — membership or eligible subscription " "is required (api_code 60001). You must tell the user clearly, following the server " "**detail** (API msg). If this JSON has **pricing_url**, include that link in your reply; " "if not, quote or paste the full **detail** so any links in the server message reach the user. " "Do not retry run-task expecting success by only changing --task or --params." ) elif api_code == 60002: err = "credit_required" agent_instruction = ( "MANDATORY (user-visible): Quota consume failed — insufficient credits (api_code 60002). " "You must tell the user they need more credits or a subscription before this API can run, " "using the server **detail** (API msg) as the source of truth. If this JSON has **pricing_url**, " "include that link; if not, quote or paste the full **detail** so links from the API are visible. " "Do not retry run-task or only tweak --task/--params expecting this to clear; do not treat as success." ) ``` The URL extraction and selection logic is: ```python def _https_urls_from_text(text: str) -> list[str]: """Extract https URLs from API msg / detail (e.g. consume.json meta.msg).""" if not isinstance(text, str) or not text.strip(): return [] out: list[ ...[truncated 2358 chars]- Remediation
View remediation
