Reference Issues
Related but different: #239, #332
Those issues are about human admin roles / panel RBAC. This request is about machine/API credentials for integrations.
Summary
Remnawave currently has API tokens, but they appear to be all-or-nothing ROLE.API credentials. This creates unnecessary risk for common integrations that only need a small subset of API capabilities.
This is not only about custom private scripts. Existing Remnawave ecosystem tools already depend on API tokens:
remnawave/subscription-pagerequiresREMNAWAVE_API_TOKEN, but at runtime it mainly needs metadata, subscription info, subscription page configs, and subscription responses.- Telegram commerce bots such as RWP Shop, Bedolaga Bot, and Remnashop use Remnawave API tokens for user/subscription/payment automation.
- Telegram mini apps need narrow read access for subscription display.
- MCP/AI integrations already implement client-side readonly mode, which is useful UX but not a backend security boundary.
- Monitoring/DNS tools such as Cloudflare Nodes only need node/health read access.
- Auto-installers create a
subscription-pageAPI token, but the current/api/tokenscontract only acceptstokenName, so installers cannot create a least-privilege runtime token.
If one of these services is compromised, leaked, or misconfigured, the blast radius is much larger than the integration actually needs.
Basic Example
Add scopes/permissions to API tokens and expose built-in presets in the API token creation UI/API.
Example presets:
Subscription Page / Mini App
scopes:
- metadata:read
- users:read
- subscriptions:read
- subscription-pages:read
- squads:read
Commerce bot
scopes:
- users:read
- users:write
- users:actions
- subscriptions:read
- squads:read
- hwid:read
- bandwidth-stats:read
Drawbacks
- Requires backend route/action authorization beyond the current
ROLE.APIcheck. - Requires database/model changes for API token scopes.
- Needs careful naming/versioning of scopes so integrations do not break when routes evolve.
- Some integrations need broad access, so a full-access token must probably remain available.
- UI/API token creation becomes more complex, especially if custom scopes are supported in addition to presets.
Unresolved questions
- Should scopes be resource/action based, route based, or both?
- Should the first version start with built-in presets before custom scopes?
- Should future versions support resource constraints, for example specific squads, nodes, or subscription page configs?