Skip to content

security(secrets): any logged-in user can list and delete infrastructure hosts through /api/infrastructure/hosts #16426

Closed

Description

@mrveiss

Part of #16425 (Secrets page templates + admin-only infrastructure hosts umbrella).

Problem

Every route in autobot-backend/api/secrets.py requires admin (Depends(check_admin_permission)). But the infrastructure-host routes in autobot-backend/api/infrastructure.py do not: get_infrastructure_hosts (GET /api/infrastructure/hosts) and delete_infrastructure_host (DELETE /api/infrastructure/hosts/{id}) depend only on Depends(get_current_user). Any authenticated user can list every host's connection metadata (host, ports, username, os, capabilities, description) and delete any host — no admin check, no ownership check.

autobot-frontend/src/components/security/SecretsManager.vue merges these legacy hosts (via composables/security/useSecretsInfraApi.ts) into its list and renders the "Infrastructure Hosts" category with no role gate, so a non-admin user sees and can act on them through the Secrets page too.

The owner's decision: infrastructure hosts are admin-only.

Evidence

  • autobot-backend/api/infrastructure.py: get_infrastructure_hosts and delete_infrastructure_host, both _user: Any = Depends(get_current_user)
  • autobot-backend/api/secrets.py: every route uses Depends(check_admin_permission) for comparison
  • autobot-frontend/src/composables/security/useSecretsInfraApi.ts
  • autobot-frontend/src/components/security/SecretsManager.vue: credentialCategories includes infrastructure_host with no admin check found

Fix

  • Add an admin dependency (matching api/secrets.py's pattern) to both get_infrastructure_hosts and delete_infrastructure_host.
  • Frontend: hide the "Infrastructure Hosts" category and any hosts fetched via useSecretsInfraApi from non-admin users.

Acceptance criteria

  • GET /api/infrastructure/hosts requires admin permission
  • DELETE /api/infrastructure/hosts/{id} requires admin permission
  • Non-admin frontend users never see the Infrastructure Hosts category or any legacy host entries
  • A test confirms a non-admin gets 403 on both GET and DELETE, and an admin gets through on both

🤖 Generated with Claude Code

Activity

  1. added this to the v0.9.0 milestone on Sep 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions