
Tenantguard
io.github.RudrenduPaul由 GitHub 帳號 RudrenduPaul 發布v0.1.5更新於 Oct 24, 2026
Scans self-hosted multi-tenant AI-agent platforms for tenant-isolation gaps via an MCP tool.
概覽
執行 TenantGuard 的租戶隔離稽核,檢查自架多租戶 AI 代理部署設定,並將結構化結果回傳給助理。
- 可以做什麼
- 提供單一 scan 工具,對部署設定目錄執行與 TenantGuard 命令列相同的政策引擎。它依 16 條失敗即視為違規的租戶隔離規則檢查,涵蓋沙箱掛載、排程工作與代理綁定、MCP 工具與供應商 URL、執行核准、憑證加密、通道/工作階段身分,以及稽核與復原宣告。結果以 JSON 或 SARIF 文字加上結構化內容回傳,包含 rule_id、status、file 與 line,每項發現也附帶暫定的 HIPAA 引用。
- 適用情境
- 適合讓助理稽核自架多租戶 AI 代理部署中的跨租戶隔離缺陷,並在同一工作階段處理發現的問題,例如設定審查或合規檢查之前。它只針對這個領域,並非通用的 Terraform、Kubernetes 或雲端設定錯誤掃描器。
- 執行需求
- 以 tenantguard mcp 子命令啟動的本機程序,自 v0.2.0 起提供。可透過 PyPI 套件 tenantguard-cli 搭配 uvx 或 pip 安裝,也可使用 npm 套件 tenantguard-cli 或 go install。PyPI 封裝首次執行時會下載對應發行版二進位檔並驗證其校驗和。scan 工具需要部署設定目錄的路徑;未宣告任何帳號、API 金鑰或環境變數。
安裝
在 SourceWeft 中
- 開啟 儀表板中的 Tenantguard,將其新增到工作區。
- 為需要使用其工具的對話啟用該服務。
Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。
其他 MCP 客戶端
參照 儲存庫 中的啟動說明。
README
TenantGuard
[CI] [npm version] [PyPI version] [License: Apache 2.0]
Install • Quickstart • Features • CLI Reference • MCP Server • Compare • FAQ
Find the tenant-isolation gap in your self-hosted, multi-tenant AI-agent platform before an auditor, or an attacker, does.
Install
This is the recommended install. The tenantguard-cli npm package (currently 0.2.0, renamed from the old plain tenantguard, which is deprecated) pulls in the matching platform binary as an npm optionalDependency (cosign-verified at publish time, so there's no separate verification step for you) and puts a tenantguard command on your PATH.
Platform coverage: macOS on Intel and Apple Silicon, Linux on x64 and arm64, and Windows on both x64 and arm64.
go install works on every platform Go supports and doesn't depend on any registry publish state, so it's the fallback if your platform isn't covered above.
You can also skip the top-level package and install a single platform binary package directly:
Python (pip / uvx)
The PyPI package, tenantguard-cli, lives in this repo under python/ and is built and tested in CI. Its current version is 0.1.6, which downloads and runs the v0.2.0 build of the same GitHub Releases binary the npm packages use, verifying the release's SHA-256 checksums.txt on first run (itself Sigstore-signature-verified before any digest inside it is trusted) and caching the verified binary locally after that. That's a different trust boundary than the npm packages, which embed a cosign-verified binary at publish time and need no runtime download at all; the PyPI wrapper's checksum check is the equivalent guarantee for a path that has to fetch the binary on the end user's machine instead.
PyPI versions up to and including 0.1.2 shipped a bug that made pip install tenantguard-cli succeed but tenantguard scan --demo fail on first run with could not parse checksums.txt.pem as a PEM certificate (the wrapper wasn't base64-decoding the cosign-produced certificate/signature release assets before parsing them). That is fixed in tenantguard-cli 0.1.3, published to PyPI on 2026-08-03; pip install tenantguard-cli now installs a working tool with no extra steps.
Quickstart
Real captured output:
The bundled fixture is deliberately noisy: it exists to exercise nearly every rule at once. TA08 (credential-storage encryption) and TA14 (per-agent resource-profile isolation) are per-entry checks that only fire against providers and resource_profiles entries in the scanned config, and this fixture declares zero entries of either kind, so both rules have nothing to evaluate and produce no finding at all, neither PASS nor FAIL. TA16 (provider connection SSRF) is the same kind of per-entry check against providers entries, so it also produces nothing on this fixture. The one line shown as passing, "1 check(s) clear," is TA12 (owner/sysadmin recovery), which the fixture's owner_ids and has_recovery_command values are deliberately set to satisfy. Exit code is 1, since findings are present; see CLI Reference for the full exit-code contract.
Scan a real deployment and emit SARIF for code scanning instead:
Or emit plain JSON, for a script or agent that would rather parse a flat findings array than a SARIF document:
Features
TenantGuard scans a self-hosted, multi-tenant AI-agent deployment's configuration against 16 rules, each derived from a real, confirmed tenant-isolation failure mode. Every rule is fail-closed: an undeclared or ambiguous setting is a violation, not a silent pass.
Tenant isolation boundaries
Network and credential exposure
Execution and approval hardening
Identity, audit, and recovery
Other verified capabilities:
- SARIF 2.1.0 output (
--format sarif), schema-valid, with real byte/line locations and messages, ready forgithub/codeql-action/upload-sarifand GitHub code scanning. - Plain JSON output (
--format json), a schema-light alternative to SARIF for a script or agent that just wants rawrule_id/status/file/lineresults without SARIF's tool/run/rule/taxonomy object model. Unlike SARIF (which only reports FAIL as a "result"), the JSON mode includes every PASS too, plus asummary.fail/summary.passcount. Available since v0.2.0. See the note under CLI Reference. - Provisional HIPAA citations on every finding (
--control hipaa), mapped per rule, marked provisional (see FAQ). - Zero-setup demo mode (
--demo) that scans a bundled synthetic deployment, no target config required. - GitHub Action (
action/action.yml) that installs a pinned version viago installand uploads the SARIF report automatically. - MCP server mode (
tenantguard mcp) that exposes the same scan engine as a tool an AI agent can call directly over stdio, instead of only through a human typingtenantguard scan. Available since v0.2.0. See MCP server (agent-native usage) below.
CLI Reference
TenantGuard has two subcommands: scan (the audit itself) and mcp (runs the same scan engine as an MCP server over stdio, see MCP server (agent-native usage)). There is no top-level --help or --version flag; running tenantguard with no arguments, tenantguard --help, or any first argument other than scan or mcp prints the usage lines below to stderr and exits 2.
[!NOTE] Version note:
--format jsonand themcpsubcommand shown below ship in v0.2.0 and later, which is whatnpm install -g tenantguard-cli(0.2.0),pip install tenantguard-cli(0.1.6, which downloads the v0.2.0 binary) andgo install .../cmd/[email protected]install. Earlier versions (the 0.1.x npm packages and thev0.1.1Go tag) do not have them:--format jsonis ignored there andmcpis not recognized as a subcommand.
tenantguard scan --help output:
Exit codes (defined in cmd/tenantguard/main.go):
MCP server (agent-native usage)
[!NOTE] Available since v0.2.0. The
mcpsubcommand ships in the npm, PyPI andgo installreleases listed in Install. Versions before v0.2.0 do not have it and print a usage error if you try.
Everything above assumes a human typing tenantguard scan at a terminal. TenantGuard also runs as an MCP server, so an AI agent (a coding assistant, an ops agent, anything that speaks the Model Context Protocol) can call the scan engine directly as a tool call, instead of shelling out to the CLI and parsing text.
This starts an MCP server on stdio and blocks until the client disconnects, the same way any other stdio-based MCP server runs under its client's process supervision. It takes no flags or positional arguments. Under the hood it's a thin protocol adapter (internal/mcpserver) over the exact same internal/collector -> internal/policy -> internal/compliance -> internal/report pipeline the CLI's scan subcommand runs; there's no separate rule-evaluation logic to keep in sync.
It exposes a single tool, scan, with three arguments that mirror the CLI's own flags:
For json and sarif output, the result is returned both as text and as MCP StructuredContent, so a client that wants to read fields directly (rule_id, status, file, line) doesn't have to re-parse the text block itself. Tool-level failures (a bad target path, a policy load error) come back as a normal MCP error result, not a protocol-level failure, so a calling agent can handle "scan failed" the same way it handles any other failed tool call.
To register TenantGuard with an MCP-compatible client such as Claude Desktop, add it to the client's server config:
This assumes tenantguard is already on your PATH (see Install). If you installed it somewhere else, replace "command" with the full path to the binary.
Before this shipped, the only way to run a scan was a human invoking the CLI directly. With tenantguard mcp, an agent can call scan as a tool, get structured findings back, and act on them in the same session, without a person reading terminal output and typing the next command by hand.
How TenantGuard compares
TenantGuard trades breadth for depth: 16 rules is a fraction of Checkov's 1,000+, and TenantGuard is three tagged releases old against Checkov, Conftest, and PolicyGuard's much longer track records. What TenantGuard has that none of the others do is a rule pack purpose-built for cross-tenant isolation in self-hosted AI-agent deployments, a surface none of the general-purpose IaC scanners cover and even AgentShield, the closest domain match, stops short of: it audits a single developer's local config, not cross-tenant isolation in a self-hosted, multi-tenant deployment. That is the niche TenantGuard targets, narrowly and on purpose.
Precision/recall benchmarks for TenantGuard's own rule set against labeled fixtures are not yet published; where a competitor above reports a number (e.g. PolicyGuard's precision/recall), figures are quoted from that project's own README, not independently re-verified here.
What is TenantGuard and why does it exist
TenantGuard is a command-line policy-as-code scanner, written in Go and built on OPA/Rego, that audits a self-hosted multi-tenant AI-agent platform's configuration for tenant-isolation defects: the class of bug where one tenant's agent, sandbox, cron job, or credential can reach or affect another tenant.
TenantGuard exists because a real, confirmed multi-tenant AI-agent platform (goclaw) has had multiple open, unresolved issues in exactly this category, including a sandbox mount not scoped per tenant, a cross-agent authorization gap, an exec tool that leaks secrets through an indirect path, an approval bypass keyed on a filename instead of a real path scope, and an SSRF validation mismatch on saved tool URLs and LLM provider connections. No existing general-purpose IaC scanner (Checkov, Conftest, PolicyGuard) or AI-agent security scanner (AgentShield) checks for this specific failure category: cross-tenant isolation in a self-hosted, multi-agent deployment. TenantGuard fills that gap with 16 fail-closed rules, each traceable to a real, cited issue.
TenantGuard is not a generic Terraform/Kubernetes scanner and does not replace Checkov or Conftest for general cloud-infrastructure misconfiguration. It is scoped specifically to the tenant-isolation surface of self-hosted multi-tenant agent deployments.
FAQ
How is TenantGuard different from a generic IaC scanner like Checkov or Conftest? Checkov and Conftest scan general infrastructure-as-code (Terraform, Kubernetes, CloudFormation, and similar) for broad categories of misconfiguration. Neither ships a rule pack for multi-tenant AI-agent deployments. TenantGuard's 16 rules are purpose-built for that one surface: sandbox mounts, cron/agent bindings, MCP tool registrations, LLM provider connections, exec approvals, and channel/session identity, each derived from a real, cited defect.
Does TenantGuard replace OPA or Conftest? No. TenantGuard's rules are written in Rego and TenantGuard bundles its own evaluation path; it is a purpose-built policy pack and CLI, not a general-purpose Rego test harness. If you need to test arbitrary structured config against arbitrary Rego policies, Conftest is the right general tool. TenantGuard is the right tool specifically for tenant-isolation checks on a multi-agent deployment.
What does the HIPAA citation on each finding mean? Every finding is annotated with a related HIPAA Security Rule citation (e.g. Sec164.312(a)(1) Access Control) to help map a technical finding to a compliance control a reviewer may already track. These citations are marked provisional: they indicate a plausible mapping between the technical control and the cited HIPAA section, not a legal or audited compliance determination. Treat them as a starting point for your own compliance review, not a substitute for one.
Does a PASS on TA02 (SSRF) mean the MCP tool URL is actually safe from DNS rebinding?
Not fully. TA02 uses real CIDR containment against a literal or DNS-resolved IP, not string matching, but a PASS trusts the deployment's own pins_resolved_ip/validates_private declaration. TenantGuard cannot independently verify that the real validator pins the resolved IP for the actual connection, so a DNS-rebinding/TOCTOU risk persists if that declaration is inaccurate. This limitation is documented directly in the TA02 rule.
Can I scan a real deployment instead of the bundled demo?
Yes: tenantguard scan --target <path-to-deployment-config-dir>. --demo exists so you can see the tool run with zero setup before pointing it at a real config.
Does TenantGuard produce output a CI pipeline or GitHub code scanning can consume?
Yes. --format sarif --sarif-out <file> produces a schema-valid SARIF 2.1.0 document with real result locations and messages. The bundled GitHub Action (action/action.yml) runs a scan and uploads the SARIF report via github/codeql-action/upload-sarif in one step.
Why does TenantGuard have both --format sarif and --format json? Isn't SARIF already structured output?
Yes, SARIF is a real, standard, machine-parseable format, and it is the right choice for CI/code-scanning integration. --format json exists for a different consumer: a script or agent that wants to parse rule_id/status/file/line directly, without walking SARIF's tool/run/rule/taxonomy object model first. It also reports every PASS alongside every FAIL, which SARIF deliberately does not (SARIF results represent problems found, not a full checklist), so a caller can answer "what did you check" and not just "what did you flag" from one document. Note: --format json is available since v0.2.0, see the note under CLI Reference.
What do the CLI exit codes mean?
0 is a clean scan with no findings, 1 means the scan ran successfully and found violations, and 2 is a scan or usage error (including running tenantguard with no subcommand, or any subcommand other than scan or mcp).
Is there an npm package?
Yes, npm install -g tenantguard-cli is live (currently 0.2.0) and is the recommended install path (renamed from the old plain tenantguard, which is deprecated). It depends on a matching platform binary package as an npm optionalDependency; all six platform packages are live (macOS x64/arm64, Linux x64/arm64, Windows x64/arm64). See Install above.
Is there a PyPI package?
Yes, tenantguard-cli is live on PyPI (currently 0.1.6, which downloads the v0.2.0 binary; source under python/, built and tested in CI). Versions up to and including 0.1.2 had a first-run bug that is fixed in 0.1.3 (see Install above); pip install tenantguard-cli now works out of the box.
Can an AI agent run TenantGuard directly, without a human typing CLI commands?
Yes, via tenantguard mcp, which starts an MCP server on stdio exposing the scan engine as a scan tool. See MCP server (agent-native usage) above for the exact client config and tool arguments, and for the versions that include it.
Is TenantGuard a library I can import into my own Go program?
No, not currently. Everything outside cmd/tenantguard (the collector, compliance mapping, demo fixture, policy engine, and report formatting) lives under internal/, which Go's own tooling makes non-importable from outside this module. TenantGuard is distributed as a CLI binary and a GitHub Action, not an importable Go package.
Can I use TenantGuard in a commercial or closed-source product? Yes. TenantGuard is licensed under the Apache License 2.0, which permits commercial use, modification, private use, and redistribution, including inside a proprietary or SaaS product, subject to the license's standard notice and attribution terms (retaining the copyright notice and a copy of the license, and marking any modified files). It comes with no warranty, as stated in the license. See LICENSE for the full, authoritative terms.
Contributing
Contributions are welcome. See CONTRIBUTING.md for how to add a new rule; every rule needs both a vulnerable and a clean fixture before it ships.
License
Apache License 2.0. See LICENSE.
來源:README.md,提交 0300a0b
工具
0版本歷史
1- v0.1.5最新Sep 16, 2026
評分
已滿足適用檢查項的 50%
該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。
- 近 30 天內可連通25 分
請保持端點能夠回應 MCP 握手;SourceWeft 每 30 天探測一次。
- 已宣告認證方式10 分
請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。
- 已列出工具15 分
請讓伺服器在無憑證時回應 tools/list,或發布可在沙箱中無憑證啟動的軟體包。
- 描述必需15 分
- 圖示10 分
- 文件15 分
- 授權條款10 分