SShortSingh.
Back to feed

How to Security-Test a LangChain Agent Using a 15-Line FastAPI Wrapper

0
·14 views

Developers often ship AI agents to production after a successful demo without conducting adversarial security testing, leaving a critical gap between functional validation and real-world safety. Functional tests only verify expected inputs and miss scenarios like prompt injection, scope violations, tool misuse, and goal hijacking — threats categorized in the OWASP Top 10 for Agentic Applications. The article demonstrates how a tool called Humanbound red-teams a live agent using OWASP-aligned attack scenarios, grading transcripts into a security posture score. Because Humanbound operates as a black-box HTTP tester, agents built with frameworks like LangChain must first be wrapped in a lightweight HTTP service, such as a FastAPI endpoint, to be compatible. The post walks through a sample LangChain support agent with order lookup and refund tools, then shows how a minimal server wrapper bridges the gap between a local .invoke() agent and the security testing interface.

Read the full story at DEV Community

This is an AI-generated summary. ShortSingh links to the original source for the complete article.

Discussion (0)

Log in to join the discussion and vote.

Log in

Related stories

0
ProgrammingDEV Community ·

Developer Shares Method for Fair, Verifiable Giveaway Draws Using Python and Node

A marketing team needed to pick ten winners from a webinar registration list of over 8,000 people, with the draw kept unpredictable until it happened. The author resolved the tension between secrecy and reproducibility by generating a random seed from the operating system's entropy pool at draw time and publishing it only after winners were announced. The Python script removes duplicate registrations by email before sampling without replacement. The article also covers a Node.js version that uses a cryptographic random integer function to avoid skewed results. Readers are shown how anyone can later replay the draw with the recorded seed to confirm the winners.

0
ProgrammingDEV Community ·

Weaviate's anonymous-access default raises authorization concerns for production deployments

Weaviate, a vector database with REST and GraphQL interfaces, enables anonymous access by default in Docker, a setting its documentation describes as meant for development and evaluation. Deployments that keep this default while holding production data create an authorization gap, since unauthenticated requests run as an anonymous user. A count-only ZoomEye search on October 29, 2026 returned 59 title matches for Weaviate and none for the application field, but these are matching observations rather than confirmed exposed instances. The analysis recommends enabling API key or OIDC authentication alongside role-based access control scoped to specific collections and tenants. It also advises testing anonymous and low-privilege requests across read, write, delete, backup, and schema operations to verify access restrictions.

0
ProgrammingDEV Community ·

Routing website contact form enquiries with an LLM restricted to a fixed category list

The author built an n8n workflow that uses an LLM to sort contact form submissions into predefined categories such as sales, support, partnership, job application, spam, or other. The model may only reply with one of the fixed category ids or null, since free-form answers would break spreadsheet filtering. Any reply that is not an exact match, as well as API errors, is flagged as needs_human with the reason recorded, and every valid enquiry is still logged so none are lost. Form text containing curly braces is stored as sent, avoiding template-syntax problems in the LangChain nodes. The workflow passed 17 local checks against stand-in APIs, but the author has not tested it with a real model or sheet, and it lacks authentication and deduplication for public use.

0
ProgrammingDEV Community ·

Android Studio Adds Support for Outside AI Coding Agents; Android CLI Plugins Arrive

At the Android Dev Summit on October 28, Google announced that Android Studio now hosts over 40 ACP-compatible coding agents through its Bring Your Own Agent marketplace. The feature is stable in the Rabbit 2 release, and named agents include Claude Agent, Codex from OpenAI, Junie, and Google Antigravity. Developers can install several agents and switch between them, with the IDE supplying project structure, build, and emulator context. Separately, Google's Android CLI is now available as an official plugin for Claude Code, Codex, and Antigravity, allowing agents to build and debug Android apps without the IDE running.