Pulp Engine Document Rendering
Get started
Release v0.14.0

Pulp Engine v0.14.0 — Editor Credential Scope

Summary

Adds a narrower editor scope (API_KEY_EDITOR) so the visual editor no longer needs an admin-scoped credential in the browser. Set VITE_API_KEY to API_KEY_EDITOR instead of API_KEY_ADMIN. The browser retains full editor functionality while losing the ability to trigger production renders, delete templates, or restore versions — operations the editor never performs.


What changed

New env var: API_KEY_EDITOR

VariableScopeRoute access
API_KEY_EDITOReditorTemplate management (read/create/update), asset management, POST /render/preview/*

All configured keys must be distinct strings.

Updated authorization matrix

Route groupPathsRequired scope
PublicGET /health, GET /assets/:filename(no auth)
RenderPOST /render, POST /render/htmlrender or admin
PreviewPOST /render/preview/html, POST /render/preview/pdfpreview, editor, or admin
Template management (read/write)GET, POST, PUT on /templates/*editor or admin
Template deleteDELETE /templates/:keyadmin only
Template version restorePOST /templates/:key/versions/:version/restoreadmin only
Asset managementPOST /assets/upload, GET /assets, DELETE /assets/:ideditor or admin
All other authenticated routesAny route not matched aboveadmin

Route scope enforcement is now method-sensitive for template routes. Future routes fail closed to admin unless explicitly classified.

Startup validation extended

  • API_KEY_EDITOR is included in the distinct-value check: it must differ from API_KEY_ADMIN, API_KEY_RENDER, and API_KEY_PREVIEW.
  • API_KEY_EDITOR cannot be set alongside the deprecated API_KEY (same rule as all other scoped keys).

Migration

No breaking changes. Existing deployments continue to work without any configuration changes.

To adopt the narrower editor credential:

  1. Generate a new secret: openssl rand -hex 32
  2. Add API_KEY_EDITOR=<secret> to your server environment.
  3. Set VITE_API_KEY=<same-secret> in the editor’s environment (apps/editor/.env.local or equivalent).
  4. Remove the old VITE_API_KEY=<API_KEY_ADMIN-value> from the editor’s config.
  5. Restart the API.

The visual editor does not call POST /render or POST /render/html, so removing admin access from the browser causes no functional regression.


Breaking changes

None.


Files changed

FileChange
apps/api/src/config.tsAdded API_KEY_EDITOR to Zod env schema
apps/api/src/plugins/auth.plugin.tsAdded editor to Scope type; rewrote requiredScopes() with method-sensitivity and explicit asset arm; fail-closed fallback; updated credential map, duplicate check, deprecation warning
apps/api/src/__tests__/auth-scopes.test.tsNew editor scope describe block (9 tests); 2 new startup validation tests; EDITOR_KEY constant; 3 updated app() helpers
.env.exampleAdded API_KEY_EDITOR entry and bullets; updated VITE_API_KEY comment
README.mdAdded API_KEY_EDITOR row to scoped credentials table
docs/api-guide.mdUpdated scoped credentials table and authorization matrix; resolved “current limitation” in Editor auth section; updated migration steps
docs/deployment-guide.mdAdded API_KEY_EDITOR env var row; updated reverse proxy note, migration steps, and deployment checklist
docs/runbook.mdAdded API_KEY_EDITOR to pre-deployment credential checklist
docs/editor-guide.mdUpdated credential setup to reference API_KEY_EDITOR instead of legacy API_KEY
docs/release-v0.14.0.mdThis file