Skip to content

Security and permissions

The plugin runs as the authenticated user. It has no private admin back door. A student token cannot create courses or read hidden grades.

Capabilities

Capability Default roles (archetype) What it allows
local/mcp:use Authenticated user (user) Open the endpoint. Every logged-in user has this role.
local/mcp:read Authenticated user (user) Read tools. Risk: personal data.
local/mcp:write Editing teacher, manager Write tools, in contexts where the role is assigned. Risk: spam, XSS, data loss.
local/mcp:admin Editing teacher, manager The admin scope (includes read and write), in contexts where the role is assigned. Risk: configuration, data loss, XSS, personal data.

The admin scope is not only for site administrators: by default editing teachers and managers have it, in the contexts where they hold that role. This is intentional.

The admin scope works only in contexts where the role is assigned. It does not make an editing teacher a site administrator.

Scopes are offered from any role assignment, not only system-level ones. An editing teacher enrolled in one course can be issued read, write and admin, and the consent page offers that same set. A student or a non-editing teacher is offered read only. Each tool then checks the course again.

All four are defined at system level. On top of them, each tool checks the normal Moodle capability in the course or category, the same one the user interface uses (listed in the tools reference).

Layers of protection

  1. Authentication: OAuth 2.1 with PKCE S256, or an optional web service token.
  2. Scopes: read, write, admin. Missing scope → HTTP 403 insufficient_scope.
  3. Plugin capabilities and Moodle capabilities, checked in context.
  4. Write mode off by default; each tool can also be switched off on its own.
  5. Safe deletions: dry run by default; dryRun: false plus confirm: true to delete.
  6. Origin check: a present, unknown browser Origin gets HTTP 403.
  7. Rate limiting per user and minute.
  8. Audit: every tool call goes to the Moodle event log. Arguments that look like tokens, secrets or passwords are redacted.
  9. Token storage: tokens, codes and client secrets stored as SHA-256 hashes. Raw tokens are never logged.
  10. Redirect URIs: HTTPS, loopback HTTP or a private-use native-app scheme. javascript:, data: and file: are rejected.

Privacy

The privacy provider exports and deletes a user's clients, consents, hashed tokens and sessions.