跳到正文
DEV Community· RagLeap·· 6 天前AI 評分49

修復 RagLeap Agents 0.5.1 的跨租戶審批隔離漏洞

Fixing a Cross-Tenant Approval Isolation Gap in RagLeap Agents 0.5.1

AI 導讀

RagLeap Agents 0.5.1 修復了共享狀態儲存中跨租戶恢復暫停執行的隔離漏洞,並加入按租戶範圍綁定的執行與恢復 API。新版本亦提供強制範圍模式、審計日誌、按範圍限流及子智能體範圍繼承;測試包括 251 項測試通過及 GitHub CI 的 55/55 項檢查通過。範圍驗證並非完整的身份驗證系統,應用程式仍須驗證用戶並傳入正確範圍。

正文

Fixing a Cross-Tenant Approval Isolation Gap in RagLeap Agents 0.5.1

What happens when one tenant can resume another tenant's paused AI agent run?

We reproduced that scenario in RagLeap Agents 0.5.0. The result was a security improvement focused on scope-bound execution and approval isolation, released as RagLeap Agents 0.5.1.

The vulnerability scenario

Consider a shared agent instance and state store:

  1. Tenant A starts an agent run.
  2. The run pauses while waiting for approval to execute a tool.
  3. Tenant B obtains the run ID and attempts to resume it.
  4. The previous implementation does not bind run() or resume() to a tenant scope.

Because the shared state store was keyed by run ID alone, the second tenant could resume the first tenant's paused run and trigger the pending tool with the original arguments.

This was a reproduced cross-tenant isolation gap in shared-store usage.

The fix: bind execution to scope

RagLeap Agents 0.5.1 adds scope-aware run and resume APIs:

agent.run(task, scope="tenant-a")

agent.resume(
    run_id,
    decisions,
    scope="tenant-a"
)

The scope is persisted with the run. Resume requests must match it.

Wrong-scope requests, unknown runs and damaged state return the same error:

ResumeError("unknown run")

This avoids exposing whether a run exists under a different tenant.

Additional security improvements

Stronger run IDs

New run identifiers are 22-character URL-safe tokens with 128 bits of randomness. Existing 12-character hexadecimal IDs remain supported for compatibility.

Mandatory scope mode

Applications can opt into mandatory scope enforcement:

Agent(..., require_scope=True)

Audit and rate limiting

The release introduces:

  • AuditLog(...): operational metadata without recording content text.
  • RateLimiter(...): per-scope limits applied before model calls.
  • Sub-agent scope inheritance: child agents retain their parent's scope.

The release adds ragleap-security>=0.2.0, which uses the Python standard library.

How we tested it

The reported verification included:

Check Result
Test suite 251 passed
GitHub CI 55/55 checks
Mutation tests — Python 3.12.3 34/34 killed
Mutation tests — Python 3.10.20 34/34 killed
Published wheel source comparison Verified
Cross-tenant resume using published wheel Rejected
Legacy 0.5.0 run-state compatibility Tested

We also ran the tests against the published wheel, not just the source checkout.

What this release does not guarantee

Scope enforcement is not a complete authentication system.

The application must authenticate users and pass the correct scope. A shared state-store file still relies on filesystem permissions; separate stores per tenant offer stronger separation. The rate limiter is in-memory, so its state does not survive restarts.

Windows, macOS, real model-provider execution and network filesystems were not verified in the reported release testing. Independent security review remains necessary.

Why we're sharing this

Agent security needs to cover more than prompt injection and tool permissions. It must also account for who owns a run, who can resume it, and whose approval authorizes an action.

RagLeap Agents 0.5.1 makes those boundaries explicit and adds regression coverage for the reproduced issue.

Get the release

RagLeap is open-source and self-hosted. We welcome developers and security practitioners who want to inspect, test and contribute.

Build agents that can act. Make sure they act within the right boundaries.

來源:DEV Community · dev.to