
Unbounded Consumption Auditor
io.github.4hmetuyar由 GitHub 帳號 4hmetuyar 發布v0.1.2更新於 Oct 24, 2026
Scans LLM/agent code for Unbounded Consumption / denial-of-wallet risks (OWASP LLM Top 10 2026 #6)
概覽
掃描 LLM 與代理程式原始碼中的無界消耗(denial of wallet)風險,例如缺少 token 上限、逾時、迴圈上限與速率限制。
- 可以做什麼
- 這是一個本機 MCP 伺服器,用於稽核 LLM 與代理程式應用程式碼中的無界消耗模式(OWASP LLM Top 10 2026 第 6 類)。它提供掃描程式碼片段、單一檔案、遞迴掃描目錄,以及列出偵測模式的工具。它會回報五大類共七種模式,包括缺少 token 上限、手寫 LLM HTTP 呼叫缺少逾時、無界代理程式或重試迴圈、被停用的框架安全上限,以及 MCP 工具處理常式在沒有可見速率限制下發出計費呼叫。輸出可產生 SARIF 2.1.0 以整合 CI/CD。
- 適用情境
- 適合在審查或維護 LLM 與代理程式碼時,快速檢查成本失控風險。也適合在 CI 流程中讓高嚴重性發現導致建置失敗,或在互動情境中由助理掃描片段或目錄並說明結果。
- 執行需求
- 以本機 stdio 程序執行,通常透過 npx 從 npm 套件 @guardbee/mcp-unbounded-consumption-auditor 啟動。需要 Node.js 以及用於安裝套件的網路存取。未宣告任何帳戶、API 金鑰或標頭。
安裝
在 SourceWeft 中
- 開啟 儀表板中的 Unbounded Consumption Auditor,將其新增到工作區。
- 為需要使用其工具的對話啟用該服務。
Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。
其他 MCP 客戶端
參照 儲存庫 中的啟動說明。
README
@guardbee/mcp-unbounded-consumption-auditor
🇬🇧 English | 🇹🇷 Türkçe | 🇨🇳 中文 | 🇯🇵 日本語 | 🇰🇷 한국어 | 🇧🇷 Português | 🇪🇸 Español | 🇩🇪 Deutsch
[npm version] [npm downloads] [License: MIT]
An MCP (Model Context Protocol) server that scans LLM/agent application code for Unbounded Consumption — OWASP LLM Top 10 2026's #6 category, also known as "denial of wallet": nothing stops the application from making unlimited billable calls.
Telemetry is off by default. With
GUARDBEE_TELEMETRY=1it sends the server, tool, success, duration and short parameter values such as a file path; longer strings and fields likecontent,tokenorpasswordare replaced with a placeholder. See@guardbee/mcp-telemetry.
OWASP's own write-up on this category gives a concrete cost example worth keeping in mind while reading findings: "A research assistant agent without any recursion limit or call budget ended up making 500 tool calls with a simulated cost of $10... An agent with a call budget, a recursion depth limit and an agentic circuit breaker... completed one tool call, spending just $0.02."
Why these five checks specifically
Every pattern here was checked against real SDK source or real code before being written — not guessed from training-data assumption.
- Missing token limit targets
.chat.completions.create(...)calls (OpenAI Python/JS) with neithermax_tokensnormax_completion_tokensset. It's deliberately scoped to OpenAI-shaped calls only: Anthropic's own SDK makesmax_tokensa required constructor argument — it raises before the request is even sent — so a matching check there would be 100% false positives. Reasoning models (o1+) silently ignoremax_tokensand needmax_completion_tokensinstead, so the check only flags a call missing both. - Missing timeout targets hand-rolled
requests/axios/fetchcalls whose own argument span mentions a known LLM endpoint (api.openai.com,api.anthropic.com,/chat/completions,/v1/messages). The official OpenAI/Anthropic SDKs already ship a bounded client-level default (openai-node: 600s) — flagging those would just be noise.requests.post()'s own Quickstart warns that an unsettimeoutcan leave a program waiting indefinitely; axios and barefetchhave the same no-default-timeout shape. - Unbounded loop covers two real shapes, both real-code-verified: a hand-rolled
while True:/while(true)agent loop that dispatchestool_callswith nothing nearby suggesting an iteration cap (the exact shape quoted from a public 70-line-agent walkthrough), and a retry loop that catches an exception, calls straight back into an LLM, andcontinues with no attempt counter (OWASP's own write-up calls this out by name: "a failed step might be retried repeatedly"). The retry-loop check is deliberately scoped to loops that actually call an LLM — an early version without that scoping flagged ordinary polling/retry code in a real open-source codebase during testing (see Development below). - Disabled safety limit flags
max_iterations=None(LangChain'sAgentExecutor) andmax_turns=None(openai-agents-python'sRunner.run/run_sync) — both verified against real source before shipping. LangChain'sAgentExecutordefaultsmax_iterationsto 15, and its own_should_continue()only enforces the capif self.max_iterations is not None— soNonegenuinely disables it. openai-agents-python's own issue tracker states plainly thatmax_turns=Nonedisables the turn limit. LangGraph'srecursion_limithas no equivalent — it requires a concrete number — so no pattern is shipped for it, rather than guessing at an unverified "disable" mechanism. - Missing rate limit is the one heuristic pattern here, shipped at medium (not high/critical) severity on purpose: no MCP SDK (TypeScript or Python) provides a built-in per-caller throttling hook on tool registration, unlike the bounded defaults LangChain/LangGraph ship for iteration caps. Multiple independent 2026 write-ups describe the fix as a hand-rolled wrapper around
server.tool()/@mcp.tool(), implying there's no framework default to fall back on. This check can't see a rate limiter enforced elsewhere (an API gateway, middleware in another file) — see Limitations.
Relationship to ai-code-scanner: that package already has a coarser unbounded_agent_loop pattern (any while(true)/for(;;) within 200 characters of a .chat.completions.create/.messages.create call, under its excessive-agency category) — it doesn't check whether the loop actually dispatches tool calls, and doesn't check for a nearby iteration-cap hint, so it would also flag a loop that's already properly bounded. This package's unbounded_tool_calling_loop is narrower and cost-specific: it requires an actual tool_calls/toolCalls reference (the real agentic-dispatch shape) and explicitly skips loops with a visible cap hint nearby.
Features
- 7 patterns across 5 categories, each grounded in real SDK source, a real code walkthrough, or OWASP's own 2026 write-up — cited inline in the pattern comments
- 25 tests (positive + negative for every pattern, including the exact quoted real-world loop snippet the unbounded-loop checks are built from)
- SARIF 2.1.0 output — CI/CD integration (GitHub Code Scanning, etc.)
- End-to-end verified against a planted-vulnerability fixture (all 7 patterns caught, all 3 "safe counterpart" negatives correctly skipped) and against a real 3,414-file open-source codebase (
IBM/mcp-context-forge) plus this monorepo's own 495 files — zero false positives in production code. Two real false positives were found and fixed during that verification, before shipping: an early, wider loop-body window let an unrelatedexcept/continueelsewhere in the same file get mistaken for part of a nearby loop (fixed by requiring an LLM-call hint in the window and shrinking it), and a disabledmax_iterations=Nonea few lines below a loop was briefly mistaken for a legitimate nearby iteration cap (fixed by stripping disabled-cap assignments before testing for a real one).
Quick Start
Claude Desktop / MCP Client
CLI (CI/CD)
MCP Tools
Detected Patterns
Configuration (guardbee.yml)
Limitations (by design)
- Bounded-window heuristics, not real control-flow analysis. The loop checks look at a fixed character window after
while True:/while(true), not the actual loop body — a loop with an unusually long body, or one whose cap check lives outside that window, can be missed. Testing against real code found the reverse failure mode too (an unrelatedexcept/continuefurther down getting mistaken for part of a nearby loop) and tightened the window accordingly; it's still a heuristic, not a parser. - The rate-limit check can't see enforcement elsewhere. A tool handler with no rate-limiter in its own body might still be protected by an API gateway, middleware in another file, or a wrapper this scanner doesn't trace into — this check flags what's visible in the handler itself, nothing more.
- No cross-function default detection. If a project sets an output limit or timeout once, centrally, and every call site relies on that default implicitly (rather than passing it per-call), the per-call checks here will still flag each call site individually.
- LangGraph's
recursion_limitisn't checked. Unlike LangChain and openai-agents-python, LangGraph's recursion limit requires a concrete number — there's no verified "set it to disable" mechanism, so no pattern is shipped for it rather than guessing at one.
Development
License
MIT — GuardBee
Feedback
Questions, ideas, or a false positive? Start a thread in GitHub Discussions or open an issue. If GuardBee is useful to you, a ⭐ on the repository helps others find it.
來源:packages/unbounded-consumption-auditor/README.md,提交 040e072
工具
0版本歷史
1- v0.1.2最新Sep 29, 2026
評分
已滿足適用檢查項的 50%
該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。
- 近 30 天內可連通25 分
請保持端點能夠回應 MCP 握手;SourceWeft 每 30 天探測一次。
- 已宣告認證方式10 分
請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。
- 已列出工具15 分
請讓伺服器在無憑證時回應 tools/list,或發布可在沙箱中無憑證啟動的軟體包。
- 描述必需15 分
- 圖示10 分
- 文件15 分
- 授權條款10 分