novinzodevelopers
Plugins

Security checklist

Understand invocation identity, isolate store data and fail closed when authentication or required permissions fail.

A plugin serves multiple stores. Novinzo controls which store invokes it. Your Worker keeps each store's data separate.

The trust model

The binding boundary limits who reaches your Worker. Set workers_dev and preview_urls to false. Novinzo dispatches known surfaces through its platform Workers.

Production registration, binding access and deployment require coordination with Novinzo. Do not expose an alternate public route to platform-only handlers.

The invocation token identifies the plugin and store. Every store-scoped Novinzo plugin request carries x-novinzo-plugin-invocation, a signed token valid for 15 minutes.

Only Novinzo holds the signing secret. Forward the token unchanged to core-for-plugins and backend RPC during the current invocation.

Binding props do not authenticate calls. x-novinzo-plugin-name does not identify a caller in any environment, including development.

Plugin authors do not authenticate invocation signatures themselves. Treat the token as opaque and rely on the restricted dispatch boundary for incoming requests.

The platform authenticates the token on calls back. Caller-written store ids never override its plugin or store identity.

SurfaceCallerStore scope inside your Worker
/admin/**Seller admin proxyTrusted x-novinzo-store-id header.
/storefront-public/**Storefront forwarderTrusted domain-store header. The invocation also names a signed-in visitor. Bearer-guarded handlers use the successful credential response.
/storefront-order/**Storefront order-viewer forwarderTrusted x-novinzo-store-id header. The invocation also names the viewed order.
/storefront/**, /theme/blocks/**Theme PluginBridgeTrusted x-novinzo-store-id header.
/assets/**Storefront asset proxyNo store-scoped data access.
/webhooks/**CoreTrusted x-novinzo-store-id header. Without one, from an older sender, the decoded payload storeId, subject to checkout-outcome compatibility below.
/functions/**CoreTrusted x-novinzo-store-id header. Compare payload storeId when present.
/partner/**Partner proxy, /plugin-partner/<code>/*x-novinzo-partner-store-id when the partner picked a store. It is not a membership check, so it is never sent as x-novinzo-store-id.
/payment-webhooks/**Unauthenticated payment provider, through /plugin-payment-webhooks/<connectionId>/*Trusted x-novinzo-store-id of the connection's store. Verify each notification with the provider.
GET /oauth-callbackA browser an OAuth provider returned, through /plugin-oauth/<code>/callbackNone: only the provider's query arrives, with no caller header, store header or invocation. Find the flow and its store from the state you issued.

An OAuth provider's redirect authenticates nobody, and whoever followed the provider's page can be someone the flow's starter handed a link to. Answer 200 with { "storeId": "<uuid>", "returnTo": … }, where returnTo is { "_tag": "Storefront", "url": "…" } or { "_tag": "PluginPage", "view": "<view>" }, with null for your dashboard page's default view. Novinzo redirects the browser only after it checks that the plugin is installed on that store and that the destination is the store's own storefront or your plugin's page in its dashboard. Any other answer, such as a 404 for a state you do not know, ends on Novinzo's own page saying the link expired. Bind the result to an account only in a later call from that account's own surface, such as the order viewer's or the dashboard's, carrying a code you put in the return.

Order-viewer calls carry an invocation that also names an authorized order. A store-only invocation cannot read the order-viewer endpoint.

What the platform guarantees

Novinzo applies these boundaries:

  • Installing stores reach store-scoped handlers. Retired plugins and deleted stores are excluded. Calls back require a current installation.
  • Uninstalled and unknown plugins receive indistinguishable proxy responses. Platform authorization failures do not reveal store existence.
  • Each caller reaches only its supported prefix. Resolved paths and encoded traversal cannot cross into admin, webhook or function surfaces.
  • Only allowlisted caller headers are forwarded. Admin and partner routes forward accept, content-type and if-none-match; storefront routes forward accept, authorization, content-type and idempotency-key; payment webhooks forward only content-type, idempotency-key, x-signature and x-timestamp; OAuth callbacks forward none. Seller cookies never reach plugins.
  • Proxied requests carry traceparent and b3 headers naming Novinzo's call, so your Worker's spans can join the request's trace. A caller's own trace headers are never forwarded.
  • Response headers cannot change the store origin's cookies or security policy. Cookie, reporting, origin-policy and CORS credential headers are stripped.
  • API and admin redirects become 502. Credentials are not replayed against redirect targets.
  • Admin frames use an opaque sandbox origin without storage or sessions. They communicate through a message port.
  • Admin bridge limits are 6 concurrent requests, 1 MiB requests and 5 MiB responses.
  • Sellers grant only permissions requested by the plugin. Backend RPCs without a plugin permission remain seller-only.
  • API credentials are stored as hashes. C4p authenticates them only for the current invocation's plugin and store.

What your plugin must do

Scope every database read and write by store id. Include it in updates, deletes, joins and unique indexes.

Use the trusted header for admin, storefront, function and webhook requests. Use authenticated credential scope for bearer routes.

Never let shopper-controlled paths, queries or body fields choose the tenant.

Make sure that store headers contain UUIDs. Reject absent headers with 400 MissingStoreIdError and reason missing-header.

Reject invalid UUIDs with reason invalid-uuid. Decode fields before querying your database.

Novinzo does not retry a webhook answered with 400 MissingStoreIdError, so return it only when the header is absent or malformed, never for a failure of your own.

Forward the invocation header on every platform call. Never reuse it across requests or use signing secrets in plugin configuration.

Background and cron jobs cannot independently obtain store access. Coordinate platform invocation requirements with Novinzo.

Authenticate merchant bearer credentials through c4p for every request. A bearer token alone does not authorize access to its issuing store.

Map c4p/ApiAccessCredentialRejected to 401. Fail closed on outages, missing platform context and malformed responses.

See API access credentials for a complete implementation.

Make webhook work idempotent. Deliveries repeat, and failed deliveries are retried.

Return 2xx only after durable work completes. 410 permanently fails delivery; 404 VariantNotEnabledError declines a variant-purchased or variant-refunded delivery.

Persist issued deliverables before acknowledging or reporting stock. See Webhooks.

Decode all external values before use, including JSON, database rows and platform responses. Narrow the fields your handler consumes.

Bound caller-controlled arrays, quantities and pagination. Pass non-negative bounded values to SQLite LIMIT; negative values disable the limit.

Keep /admin/ui self-contained with inline scripts and styles. Keep no persistent state in the sandbox frame.

See Admin screens.

Return data instead of redirects from API and admin routes. Let the caller navigate.

Treat PermissionDenied as an access refusal, not proof of a withheld grant. Authorization lookup failures use the same response.

Degrade optional enrichment only when correctness and authorization remain intact. Required operations stay closed.

See Reading dashboard data.

A standalone store-header decoder uses public JavaScript only:

const uuid = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;

function storeScope(request) {
  const value = request.headers.get("x-novinzo-store-id");
  if (value === null) {
    return Response.json(
      { _tag: "MissingStoreIdError", reason: "missing-header" },
      { status: 400 },
    );
  }
  if (!uuid.test(value)) {
    return Response.json({ _tag: "MissingStoreIdError", reason: "invalid-uuid" }, { status: 400 });
  }
  return value;
}

This decoder accepts header syntax, not arbitrary caller identity. Use it only behind Novinzo's restricted platform dispatch.

Trusting payload store ids

Webhooks receive a trusted store header alongside the invocation, as functions do. Scope your own records by it. A delivery from before the header carries none: only then scope by the store id the payload names.

Only core reaches webhook and function prefixes. Never mount these handlers under admin, storefront or storefront-public paths.

Calls back act on the invocation store regardless of a payload's contents. Do not decode JWT claims as an alternative authorization mechanism.

Functions receive a trusted store header alongside the invocation. Reject a conflicting payload storeId before accessing data.

ImportMigratedReviews has no payload store id. Its tenant comes from the function request's trusted store header.

checkout-completed and checkout-cancelled retain optional storeId for older senders. Look up the order in your own durable records.

When a store id is present, require it to match the stored order's tenant. When absent, act only on the matched order's stored tenant.

Do not scan other stores for matching codes or license keys. An unknown order produces no cross-store action.

Tenancy rules

Apply these rules consistently:

  • Use one tenant per request. Store-managed codes, slugs and keys belong to that tenant.
  • Include store id in unique indexes so stores can reuse the same code without collisions or existence leaks.
  • Return the same not-found response for another store's ids and missing ids.
  • Retain store data after uninstall. The platform removes your plugin from the store's API keys; reinstallation does not put it back.
  • Test store isolation with separate random tenant ids. See Testing.

Never log merchant credentials, invocation tokens, authorization headers or request-containing transport errors. Log sanitized categories and status codes only.

On this page