T01 · Skill Instruction Hijacking
- Location
scripts/langsmith.py:117- Finding
Untrusted LangSmith Trace Content Is Passed Directly into AI-Agent Context
- Content
View full analysis
dict: """Compress a run to essential fields for LLM context.""" inputs = run.get("inputs", {}) outputs = run.get("outputs", {}) # Truncate long strings def trunc(v, n=300): s = str(v) return s[:n] + "…" if len(s) > n else s return { "id": run.get("id", ""), "name": run.get("name", ""), "status": run.get("status", ""), "start_time": run.get("start_time", ""), "latency_ms": ( round(( datetime.fromisoformat(run["end_time"].replace("Z", "+00:00")) - datetime.fromisoformat(run["start_time"].replace("Z", "+00:00")) ).total_seconds() * 1000) if run.get("end_time") and run.get("start_time") else None ), "total_tokens": run.get("total_tokens"), "prompt_tokens": run.get("prompt_tokens"), "error": run.get("error"), "inputs_summary": trunc(inputs), "outputs_summary": trunc(outputs), "feedback_stats": run.get("feedback_stats"), } ``` `scripts/langsmith.py:320-334` then prints this data as structured context intended for consumption by an AI agent: ```python def cmd_ask(args): """Fetch and format traces as structured context for the agent to analyze.""" print(f"Fetching runs from '{args.project}' (last {args.since}, limit {args.limit})...", file=sys.stderr) runs = get_runs(args.project, args.since, limit=args.limit) if not runs: print(f"No runs found for project '{args.project}' in last {args.since}.") retu ...[truncated 3872 chars]- Remediation
View remediation
