CAPABILITIES
guide
8 min read

Permissions, Hooks, Custom Routes, Admin UI & SecretStore

Every OpenDash capability — database KV, outbound SSRF-pinned HTTP, lifecycle hooks, custom HTTP endpoints, dashboard widgets, cron tasks, and encrypted secrets — must be declared explicitly inside manifest.json and enforced by the host runtime.

Least-Privilege Permissions & Destructive Guardrails

Declare exact grants inside permissions: sqlite (kv_read, kv_write), http / structured network allowlists (scheme/host/port/methods/path prefix), content_read|write|delete per CPT, explicit content_read_private|write_private (wildcard "*" forbidden), taxonomy_read, media_read, site_options_read, plugin_settings_read, and explicit secret key arrays in plugin_secrets_read.

  • Lifecycle Permissions (Schema 3, min_host_version >= "0.1.1"): content_trash_read, content_restore, and Admin-only content_purge enforce strict safeguards: actions cannot combine multiple write scopes (ERR_MIXED_WRITE_SCOPE), content_restore/content_purge cannot combine outbound http, and content_purge always requires explicit one-time Host Confirmation (409 confirmation_required, 120s TTL).

Hooks, Filters, Projections & Cron Jobs

  • Lifecycle Hooks: Synchronous veto gate content/before_save plus post-commit async hooks (content/after_save, content/after_delete, content/after_publish, content/after_unpublish, contact/after_submit, plugin/after_enable|disable, settings/after_save, theme/after_activate).
  • Synchronous Filters: filter:content/prepare_save, filter:contact/before_submit (HTTP 422 veto), filter:seo/head, filter:entry/view, and public template hooks filter:render/head, filter:render/footer, and filter:render/slot backed by ExtensionRenderCache (render_cache: "by_route" | "global" | "none").
  • Write-Time Projections: Computed once at publish/enable time into plugin_entry_projections under precedence Admin > Plugin > Theme, keeping public GET at 0 worker spawns for entry projections while preserving final_noindex = core_noindex || plugin_noindex.
  • Scheduled Cron Jobs (<= 8 per plugin): Declare { id, schedule, description } under cron using 5-field expressions, query schedule history at GET /api/admin/plugins/{id}/cron, and trigger on-demand runs via POST /api/admin/plugins/{id}/cron/{job_id}/run.

Scoped Custom Routes (<= 32 per Plugin)

Declare HTTP GET or POST handlers in routes without overlapping core namespaces. OpenDash exposes them strictly under your package prefix across three surfaces:

  • /p/{pkg}/* & /api/public/p/{pkg}/* for access: "public" (strict Origin on POST) or access: "webhook" (POST-only raw body, allowlisted HMAC headers, rate limited; content_save/content_delete denied).
  • /api/p/{pkg}/* for authenticated access: "session" or access: "admin" calls.

Declarative Admin UI & SecretStore

Plugins extend Admin using typed declarations (never arbitrary Admin scripts):

  • admin_extensions (manifest_schema >= 2): Add up to 16 custom table columns per owner (text, badge, link; 32 effective cap) and up to 8 dashboard_widgets per owner (stat, list, status, action; 24 effective cap) with role gating.
  • settings_schema & SecretStore: Declare up to 64 OwnerSettings fields (including write-only type: "secret"). Plaintext secrets stay out of SQLite inside encrypted-at-ops 0600 files under database/secrets/plugins/<id>/<64-hex>.json (max 4096 B); GET /api/admin/plugins/{id}/settings returns only {"configured": bool} and {"clear": true} deletes the secret cleanly.
manifest.json (Schema 3 Example) json
{
  "id": "acme-sync",
  "name": "Acme Sync",
  "version": "1.0.0",
  "api_version": 1,
  "manifest_schema": 3,
  "min_host_version": "0.1.1",
  "entrypoint": "plugin.js",
  "hooks": ["content/after_publish"],
  "filters": ["filter:render/footer"],
  "routes": [
    { "id": "hook_in", "method": "POST", "path": "/webhook", "access": "webhook" }
  ],
  "cron": [
    { "id": "nightly_sync", "schedule": "0 2 * * *", "description": "Sync nightly items" }
  ],
  "admin_extensions": {
    "schema_version": 1,
    "dashboard_widgets": [
      { "local_key": "sync_status", "title": "Sync Health", "kind": "status", "required_role": "admin" }
    ]
  },
  "settings_schema": [
    { "key": "webhook_secret", "label": "Webhook Secret", "type": "secret" }
  ],
  "permissions": {
    "sqlite": ["kv_read", "kv_write"],
    "content_read": ["post"],
    "plugin_settings_read": true,
    "plugin_secrets_read": ["webhook_secret"]
  }
}

Next Steps

Edit Source URL:

Search OpenDash

Use Arrow keys & Enter to navigate Full search page →