- Location
- scripts/authorize.py:30
- Finding
- Full-scope shared bearer token and arbitrary tool dispatcher violate least privilege## Vulnerability Details
**File Location**: `scripts/authorize.py:30-33`; arbitrary tool dispatch at `scripts/mcp_client.py:1458-1486`
**Vulnerability Type**: Excessive OAuth authorization and unrestricted MCP tool selection
**Risk Level**: Medium
### Relevant Code
```python
SCOPE = (
"mcp:tools artifacts:write images:generate videos:generate music:generate "
"speech:generate voices:read voices:write wallet:spend tasks:read artifacts:read tasks:cancel"
)
```
```python
def _run_command(command: str, tool_name: str | None = None) -> dict[str, Any]:
session = _session_with_registration(
state_dir=Path.home() / ".beatra",
post_json=_default_post_json,
)
if command == "tools":
return session.request(2, "tools/list", {})
try:
arguments = json.load(os.sys.stdin)
except json.JSONDecodeError as exc:
raise RuntimeError("Tool arguments on stdin must be one JSON object") from exc
if not isinstance(arguments, dict):
raise RuntimeError("Tool arguments on stdin must be one JSON object")
assert tool_name is not None
return session.request(
2,
"tools/call",
{"name": tool_name, "arguments": arguments},
)
```
### Technical Analysis
The declared Skill functionality requires reading model constraints, uploading hotel amenity stills, generating videos, reading generated tasks and artifacts, optionally reading wallet information, and canceling a task only at the user's request.
Instead, authorization requests a shared bearer token covering unrelated capabilities, including image generation, music generation, speech generation, voice reading and writing, general artifact access, wallet spending, and task cancellation. The bundled client also accepts an arbitrary `tool_name` and forwards it to `tools/call` without a package-specific allowlist.
Consequently, restrictions in `SKILL.md` are policy gu
...[truncated 1889 chars]
- Remediation
- ## Remediation Suggestions
1. Request only scopes needed by this package, such as model discovery, amenity-image upload, video generation, task reads, artifact reads, and narrowly defined wallet reads where requested.
2. Remove music, speech, voice-write, unrelated image-generation, and other nonessential scopes.
3. Separate read-only wallet access from wallet spending. A media-generation authorization should not imply unrestricted wallet operations.
4. Replace the shared full-scope device token with package-specific or capability-specific tokens.
5. Add a strict client-side allowlist for this Skill, including only documented operations such as:
- `beatra.models.list`
- `beatra.assets.upload`
- `beatra.videos.animate`
- `beatra.tasks.get`
- `beatra.tasks.list`
- `beatra.tasks.cancel`
- `beatra.wallet.get`
- `beatra.wallet.ledger`
- `beatra.installations.register`
6. Enforce equivalent restrictions server-side; client-side checks alone can be bypassed.
7. Require explicit user confirmation for cancellation and every billable generation request.
8. Use short-lived, audience-bound tokens and support revocation at package granularity.