Back to skill

Security audit

LangSmith CLI

Security checks for vulnerabilities and agentic risk

Overview

The skill has a legitimate LangSmith debugging purpose, but it pulls sensitive trace content into the agent without enough scoping, redaction, or prompt-injection boundaries.

Install only if you are comfortable letting your agent read LangSmith trace data for the selected projects. Treat trace inputs, outputs, errors, and system prompts as sensitive and potentially hostile; avoid using this in shared logs or broad agent sessions, prefer short time windows and low limits, and use an ephemeral or scoped secret setup instead of a broadly inherited shell profile key.

Vulnerability Patterns
  • Skill Instruction HijackingAlters the agent's session goals or safety constraints when the skill loads
  • Agent Memory PoisoningWrites attacker-controlled rules into memory that affect later sessions
  • Remote Payload Retrieval and ExecutionFetches external code whose behavior can change after review
  • Embedded Malicious CodeShips malicious scripts inside the skill and executes them locally
  • Unauthorized Access and Privilege EscalationObtains permissions beyond the task's legitimate needs
Findings (1)

T01 · Skill Instruction Hijacking

Warning
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
Vulnerability Patterns
  • Prompt InjectionInstruction Override, Hidden Instructions, Exfiltration Commands
  • Data ExfiltrationExternal Transmission, Env Variable Harvesting, File System Enumeration
  • Rogue AgentSelf-Modification, Session Persistence
  • Trigger AbuseOverly Broad Trigger, Shadow Command Trigger, Keyword Baiting Trigger
  • MCP Least PrivilegeUnderdeclared Capability, Wildcard Permission, Missing Permission Declaration
Findings (13)

Undeclared Tool Scope

Medium
Category
MCP Least Privilege
Confidence
91% confidence
Finding

The skill declares access to an environment secret and performs outbound network requests, but it does not explicitly constrain tool scope with permissions or allowed-tools. This increases the chance that an agent runtime grants broader-than-intended capabilities, allowing misuse of the LangSmith API key or network access if the skill is invoked in an unexpected context.

Content

No source excerpt is available for this finding.

Vague Triggers

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The trigger phrases include broad language such as 'why did X fail' and 'ask langsmith', which could match ordinary debugging requests and cause the skill to activate when the user did not intend to query LangSmith. In this skill's context, unintended activation is more sensitive because it can access traces and use an API key, potentially exposing internal observability data to the agent flow unnecessarily.

Content

No source excerpt is available for this finding.

Session Persistence

Medium
Category
Rogue Agent
Confidence
90% confidence
Finding

Recommending storage of the API key in ~/.zshrc promotes persistent placement of a secret in a shell startup file, which may be overly accessible, accidentally committed, surfaced in backups, or inherited by unrelated processes. While common, this increases secret exposure risk compared with more scoped secret-management approaches.

Content

Scanner excerpt · SKILL.md (reported line 56)May include surrounding context.

Auth Setup

bash
export LANGSMITH_API_KEY=<your-key>
# or add to ~/.zshrc

Test with: python3 scripts/langsmith.py runs <project> --limit 3

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
87% confidence
Finding

This code performs authenticated HTTP requests to LangSmith to query sessions and runs, which transmits project identifiers and retrieves potentially sensitive trace data. Although the module docstring says it queries LangSmith traces, the command help and code do not provide a clear user warning about network transmission or the sensitivity of trace contents.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

The prompt-diff command prints full system prompts and outputs from historical runs, which is broader than an analytics-only interface and effectively acts as a raw content exfiltration tool. System prompts and outputs may embed proprietary instructions, user data, or credentials, so exposing them without guardrails increases leakage risk.

Content

No source excerpt is available for this finding.

Ssd 3

Medium
Category
Not specified by scanner
Confidence
94% confidence
Finding

Printing full system prompts and outputs from prior runs exposes potentially sensitive internal instructions and user content beyond what is needed for high-level analytics. This broad disclosure is dangerous because system prompts often contain private operational logic and outputs may include confidential or regulated data.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The command prints full prompt and output contents to stdout with no warning or masking, which can disclose sensitive trace data in terminals, shell history captures, CI logs, or shared sessions. Because these values come from prior runs, users may not realize the command can surface confidential material.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The ask command packages run inputs and outputs into structured context for downstream agent/LLM analysis, which can transmit sensitive trace contents beyond the original storage boundary. This is particularly risky because it operationalizes secondary disclosure to another model or service without explicit consent, review, or redaction.

Content

No source excerpt is available for this finding.

Ssd 3

Medium
Category
Not specified by scanner
Confidence
95% confidence
Finding

The trace-to-LLM formatting intentionally includes summarized inputs and outputs in plain text, creating a direct data exposure path from trace storage into model context. Even with truncation, summaries may still contain secrets, PII, or sensitive business logic, and once inserted into external analysis context they may be retained or further processed outside the user's expectations.

Content

No source excerpt is available for this finding.

Description-Behavior Mismatch

Medium
Category
Not specified by scanner
Confidence
91% confidence
Finding

The replay command exposes stored run inputs verbatim for manual reuse, which expands the skill from analysis into data extraction/replay of prior trace content. LangSmith traces commonly contain sensitive prompts, user inputs, identifiers, or secrets, so printing them directly can cause unintended disclosure to anyone invoking the skill or viewing logs.

Content

No source excerpt is available for this finding.

Missing User Warnings

Medium
Category
Not specified by scanner
Confidence
93% confidence
Finding

The replay helper prints stored run inputs without notifying users that trace inputs may contain secrets, personal data, or proprietary prompts. In practice this can lead to accidental disclosure through terminal capture, logs, screenshots, or sharing of replay instructions.

Content

No source excerpt is available for this finding.

Ssd 3

Medium
Category
Not specified by scanner
Confidence
90% confidence
Finding

The replay helper reveals stored run inputs for reuse, which can expose confidential user submissions, prompts, or embedded credentials. Because replay is framed as a debugging convenience, users may underestimate the sensitivity of the printed data and share it unsafely.

Content

No source excerpt is available for this finding.

Missing User Warnings

Low
Category
Not specified by scanner
Confidence
80% confidence
Finding

This markdown file documents use of an external API with an API key and later describes fetching runs and posting feedback, which may involve transmitting user or system data to LangSmith. Under the markdown-specific warning criteria, there is no disclosure about privacy, external data transfer, or handling of sensitive run inputs/outputs.

Content

No source excerpt is available for this finding.

Static analysis

No suspicious patterns detected.