Best practices
When building such applications developers should remember to follow good security practices:- Limit permissions: Scope permissions specifically to the application’s need. Granting broad or excessive permissions can introduce significant security vulnerabilities. To avoid such vulnerabilities, consider using read-only credentials, disallowing access to sensitive resources, using sandboxing techniques (such as running inside a container), specifying proxy configurations to control external requests, etc. as appropriate for your application.
- Anticipate potential misuse: Just as humans can err, so can Large Language Models (LLMs). Always assume that any system access or credentials may be used in any way allowed by the permissions they are assigned. For example, if a pair of database credentials allows deleting data, it’s safest to assume that any LLM able to use those credentials may in fact delete data.
- Defense in depth: No security technique is perfect. Fine-tuning and good chain design can reduce, but not eliminate, the odds that a Large Language Model (LLM) may make a mistake. It’s best to combine multiple layered security approaches rather than relying on any single layer of defense to ensure security. For example: use both read-only permissions and sandboxing to ensure that LLMs are only able to access data that is explicitly meant for them to use.
- Data corruption or loss.
- Unauthorized access to confidential information.
- Compromised performance or availability of critical resources.
- A user may ask an agent with access to the file system to delete files that should not be deleted or read the content of files that contain sensitive information. To mitigate, limit the agent to only use a specific directory and only allow it to read or write files that are safe to read or write. Consider further sandboxing the agent by running it in a container.
- A user may ask an agent with write access to an external API to write malicious data to the API, or delete data from that API. To mitigate, give the agent read-only API keys, or limit it to only use endpoints that are already resistant to such misuse.
- A user may ask an agent with access to a database to drop a table or mutate the schema. To mitigate, scope the credentials to only the tables that the agent needs to access and consider issuing READ-ONLY credentials.
Reporting OSS vulnerabilities
Please report security vulnerabilities associated with the LangChain open source projects using the following process:- Submit a security advisory on the Security tab in the GitHubrepository where the vulnerability exists.
- Send an email to
[email protected]notifying us that you’ve filed a security issue and which repository it was filed in.
Bug bounty eligibility
We welcome security vulnerability reports for all LangChain libraries. However, we may offer ad hoc bug bounties only for vulnerabilities in the following packages:- Core libraries owned and maintained by the LangChain team:
langchain-core,langchain(v1),langgraph, and related checkpointer packages (or their JavaScript equivalents) - Popular integrations maintained by the LangChain team (e.g.,
langchain-openai,langchain-anthropic, etc., or their JavaScript equivalents)
langchain-community, which due to its community-driven nature is not eligible for bug bounties, though we will accept and address reports.
Out-of-scope targets
The following are out-of-scope for security vulnerability reports:- langchain-experimental: This repository is for experimental code and is not in scope for security reports (see package warning).
- Examples and example applications: Example code and demo applications are not in scope for security reports.
- Code documented with security notices: This will be decided on a case-by-case basis, but likely will not be in scope as the code is already documented with guidelines for developers that should be followed for making their application secure.
- LangSmith related repositories or APIs: See Reporting LangSmith Vulnerabilities below.
Reporting LangSmith Vulnerabilities
Please report security vulnerabilities associated with LangSmith by email to[email protected].
- LangSmith site: https://smith.langchain.com
- SDK client: https://github.com/langchain-ai/langsmith-sdk
Other Security Concerns
For any other security concerns, please contact us at[email protected].