An API key with the Sites permission disabled can still read site data and the .env file through the MCP server (https://ploi.io/api/mcp), so the permissions don't limit what the key can access.
Setup: custom API key with only Read permissions on Servers, Daemons, Cronjobs, Certificates, Redirects and Aliases, and "Use MCP server" enabled. Sites, Database, Firewall rules, System users, SSH keys and Auth users are unchecked. The key is used as a bearer token in an MCP client.
Steps to reproduce:
- Create the key as described above, with Sites disabled.
- Connect an MCP client with the key as Authorization: Bearer
- Call the
list-sitestool for a server. This returns the sites, includingdeploy_scriptanddeploy_webhook_url(with token). - Call the
get-site-envtool for a site that has a.envfile.
Expected: both calls are rejected because the key has no Sites permission.
Actual: both calls succeed. list-sites returns the data, and get-site-env returns the file. I tested this with an empty .env, which returned an empty result instead of a permission error. To double check, I also tested its behavior on a site without any .env file and there it did return an error ("Could not retrieve the environment file. The site may not have a .env file, or the server is unreachable.").
Impact: keys that are meant to be read-only and limited are able to read secrets from every site in the account. The deploy_webhook_url token in list-sites can start deployments. IMHO this is baaaad.
Suggestion: make the Sites permission cover list-sites, get-site and get-site-env (and ideally a separate, explicit permission for reading .env files), and don't return deploy_webhook_url unless the key has a deploy-related permission. Related: I can't verify the permissions of an existing key in the UI (feature request filed separately: https://roadmap.ploi.io/projects/6-api-level-requests/items/1634-let-me-view-the-permissions-of-an-existing-api-key-read-only).
-
Anoesj Sadraee moved item to project Bugs
1 day ago -
Anoesj Sadraee created the item
1 day ago