Skip to content

SEC: POST /api/agents/deploy-local bypasses creator role check — any authenticated user can spawn agents (AISEC-H1) #592

Closed

Description

@vybe

Summary

POST /api/agents/deploy-local does not enforce the creator role gate that POST /api/agents enforces. Any authenticated user (including the lowest-privilege user role) can spawn an agent container with an arbitrary image, consuming platform container budget without passing the role-permission check.

Context

AISEC (scan 3aad5469, 2026-04-28) demonstrated this as part of CVSS 8.8 finding (CWE-863 — Incorrect Authorization):

POST /api/agents/deploy-local → 200  (agent created, owned by calling user)

The same authorisation gap exists at POST /api/agents on the live deployment — the check gates on a process:create permission string that the process_viewer role lacks, but the route itself is not gated behind require_role("creator") in the open-source code path.

In open-source Trinity, POST /api/agents correctly requires the creator role via Depends(require_role("creator")). The deploy-local endpoint may be missing this dependency.

CVSS 8.8 (AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H).

Acceptance Criteria

  • POST /api/agents/deploy-local requires Depends(require_role("creator")) — same dependency as POST /api/agents
  • Audit all agent-creation routes (/api/agents, /api/agents/deploy-local, any template-deploy endpoints) to confirm each has an identical role check applied via a shared dependency — not ad-hoc inline checks
  • Per-account agent quota enforced: a single user-role account cannot consume the platform's entire container budget regardless of role
  • Regression test: assert that a user-role token receives 403 on POST /api/agents/deploy-local

Technical Notes

  • routers/agents.py — look for the deploy-local route handler; compare its Depends() chain against the main POST /api/agents handler
  • The correct pattern per Architectural Invariant security: implement safe tar extraction with symlink/hardlink validation #8: all authenticated endpoints use Depends(get_current_user); agent-creation endpoints additionally use Depends(require_role("creator"))
  • If a per-account agent count quota already exists (see agent_ownership.max_parallel_tasks), verify it is also enforced at creation time, not just at runtime

Activity

  1. added
    priority-p1
    security
    pentest
    severity-high
    on Apr 29, 2026
  2. dolho commented on May 1, 2026

    @dolho
    Contributor

    /claim

  3. github-actions commented on May 1, 2026

    @github-actions

    Claimed by @dolho. Label status-in-progress added.

    Next steps:

    1. Create branch: feature/592-<short-slug>
    2. Implement the feature
    3. Open a PR with Fixes #592
  4. added
    status-in-progress
    on May 1, 2026
  5. added
    status-in-dev
    and removed
    status-in-progress
    on May 4, 2026
  6. added a commit that references this issue on Jun 1, 2026
  7. vybe commented on Jun 1, 2026

    @vybe
    ContributorAuthor

    Shipped in v0.6.0 (released via #998).

  8. removed
    status-in-dev
    on Jun 1, 2026
  9. added
    complexity-low
    theme-security
    on Jun 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

complexity-lowpentestpriority-p1securityseverity-hightheme-security

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions