awslabs / awslabs/cli-agent-orchestrator
Hardening: local token auth for the loopback API without an external IdP (get_scopes_for_local_token fails open)
- Dominant language
- Python
- Stars
- 1.3k
- Forks
- 267
- Avg merge
- 1d 23h
- Merged PRs (30d)
- 70
Description
## Summary
On a default install (no `AUTH0_DOMAIN` / `CAO_AUTH_JWKS_URI`), `is_auth_enabled()` is false and `get_scopes_for_local_token()` returns `FULL_SCOPE_SET`, so every loopback caller gets every scope. `CAO_AUTH_LOCAL_TOKEN` is only consulted when an IdP is configured. The docstring describes the pre-check as a UX gate and defers to the FastAPI boundary — but with auth off that boundary is also open (`securitySchemes: {}`, global security none on the generated OpenAPI; we counted 45 mutating paths, including `POST /terminals/{id}/input`).
Practical effect: any local process running as the same user can drive any seat terminal. Binding to 127.0.0.1 limits the network exposure but not the same-user exposure, which matters on developer workstations where many unrelated agents/tools run.
Verified on 2.4.1 and re-checked on 2.5.0 (`security/auth.py` `get_scopes_for_local_token`, lines ~302-316).
## Request
Any of these would close the gap for single-user installs without requiring an IdP:
1. Honor `CAO_AUTH_LOCAL_TOKEN` as a standalone bearer requirement when set, even with no IdP configured (fail closed on mismatch).
2. Optionally serve the API on a unix socket with filesystem permissions (`cao-server --uds `).
3. Document in `docs/` that the default posture is unauthenticated-loopback so operators can decide.
Happy to test a patch. Filed as a hardening request rather than a vulnerability report, since the behavior is documented default-off design; I could not use private vulnerability reporting (disabled on this repo).
Contributor guide
Research direction
Start in security/auth.py at get_scopes_for_local_token (around lines 302–316) and trace is_auth_enabled into the FastAPI boundary and generated OpenAPI. Choose one requested closure—standalone local-token enforcement, Unix-socket permissions, or documentation—then verify the default no-IdP behavior and the 45 mutating paths meet that outcome.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- fastapi, python
- Domain
- api, authentication, security
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Active
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100