Hub rules-langchain

rules-langchain

v3 public Verified

LangChain

LangChain is a framework for building applications with LLMs through composable chains and agents. These rules govern LangChain configuration to prevent prompt injection, insecure tool use, and runaway inference costs.

@sigmashakeinc 2 pulls 6 rules published Apr 8, 2026 synced Oct 11, 2026 sigmashakeinc/rules/rulesets/rules-langchain →
Severity
5 error 1 warn 0 info
demo.cast
LangChain is a framework for building applications with LLMs through composable chains and agents. These rules govern LangChain configuration to prevent prompt injection, insecure tool use, and runaway inference costs.

Rules index

6 governance rules

Indexed from the repository's .rules files, grouped by technology. Expand any rule to read the raw source.

langchain

langchain-no-autonomous-agent-without-hitl warning log

AgentExecutor with a high iteration limit and no human-in-the-loop checkpoint can execute many tool calls autonomously, amplifying the impact of a prompt-injection attack. Set max_iterations <= 10 and consider adding a confirmation step for destructive tools.

Rule source requires an active Pro or Enterprise subscription.
langchain-no-eval-in-tool error block

eval()/exec() inside a LangChain tool function executes LLM-generated code without sandboxing. An adversarial prompt can achieve arbitrary code execution. Implement tools with explicit, validated logic instead.

Rule source requires an active Pro or Enterprise subscription.
langchain-no-hardcoded-api-key error block

Hardcoded API key in LangChain application. Keys embedded in source are exfiltrated via repo access or logs. Use environment variables: os.environ['OPENAI_API_KEY'] or pass via SecretStr.

Rule source requires an active Pro or Enterprise subscription.
langchain-no-python-repl-unrestricted error block

PythonREPLTool executes arbitrary Python code generated by the LLM, including os.system, subprocess, file writes, and network requests. This is a direct sandbox escape. Use a restricted execution environment (RestrictedPython, subprocess with allowlist, or a sandboxed container).

Rule source requires an active Pro or Enterprise subscription.
langchain-no-shell-tool-unrestricted error block

LangChain ShellTool/BashProcess executes arbitrary OS commands derived from LLM output. An injected prompt can exfiltrate files, install backdoors, or destroy data. Replace with scoped tools that only perform specific, validated operations.

Rule source requires an active Pro or Enterprise subscription.
langchain-no-user-input-in-system-template error log

User-controlled input interpolated into the system prompt enables prompt injection — an attacker can override instructions. Keep system prompts static; pass user data only via HumanMessage or dedicated input variables with validated types.

Rule source requires an active Pro or Enterprise subscription.

Version metadata

Published metadata

The hash-locked record of this published ruleset. When source contents change, the maintainer resyncs and the version bumps.

Version
v3
Published
Apr 8, 2026
Source commits
0
Synced
Oct 11, 2026
Hash
b29ac391997d08dec381b75f27a7e9766a5ddf4266824c9e6f3f4d9dba28f67b
Signature
Verified (publisher key)
Tested with
claude-code@current
Plan
Starter (free)
Visibility
Public

Source history

Recent commits

Latest commits touching rulesets/rules-langchain/.sigmashake/rules in sigmashakeinc/rules/rulesets/rules-langchain. The published version only bumps when a maintainer resyncs.

No commit history available.