668 lines
33 KiB
Markdown
668 lines
33 KiB
Markdown
# Product Integration Specification
|
||
**Status:** Revised design (2026-09 revision)
|
||
**Authors:** Sharang, Benjamin
|
||
**Date:** 2026-05-11 · **revised 2026-09-11**
|
||
**Companion docs:** PLATFORM_ARCHITECTURE.md, INFRASTRUCTURE.md, ERP/02 Billing and Entitlements
|
||
**Contract version:** 2.0
|
||
|
||
---
|
||
|
||
> **Contract 2.0 (2026-09-11) — breaking changes vs 1.0.** (1) The web-component / widget frontend contract is removed; frontend types are now `standalone | headless | cli`. (2) Entitlements are no longer read from a `products` JWT claim; products ask the tenant-registry (`entitlements/check`). (3) Usage is pushed by the product as events, continuously, instead of being polled daily. (4) The tenant status ladder is `demo | trial | active | warning | restricted | halted | archived`. (5) A licence contract for CLI products is added. No product shipped 1.0, so there is no N-1 support obligation for 1.0.
|
||
|
||
## 1. Purpose
|
||
|
||
This document defines the contract that **every product** must implement to be sold on the platform as a B2B building block. The contract is enforced by the Tenant Registry, Customer Portal, and Orca deployment pipeline. A product that does not implement the contract cannot be activated for a tenant.
|
||
|
||
The contract is **first-party today, third-party-ready tomorrow** — the technical surface is identical for our own products and any future external developers, with stricter verification gates for the latter.
|
||
|
||
---
|
||
|
||
## 2. Core Principles
|
||
|
||
```
|
||
1. ONE TENANT, ONE TRUTH
|
||
Every request is scoped by tenant_id from the JWT, API key or licence token. Cross-tenant
|
||
data leakage is the single largest commercial risk; the spec treats it as a contract violation.
|
||
|
||
2. PLATFORM OWNS IDENTITY, ENTITLEMENTS, BILLING, ROUTING
|
||
Products NEVER implement their own login, never store passwords, never decide entitlements
|
||
locally, never invoice customers. These are platform concerns.
|
||
|
||
3. PRODUCTS OWN THEIR DOMAIN AND DATA
|
||
Products own their database, their data model, their backup, their RTO/RPO.
|
||
No cross-product database sharing. Composition is via APIs, not via DB joins.
|
||
|
||
4. STATELESS APPLICATIONS, STATEFUL DATA STORES
|
||
Application containers are replaceable in seconds. State lives in databases
|
||
that have explicit backup contracts.
|
||
|
||
5. FAIL CLOSED
|
||
If the tenant-registry cannot be reached and the entitlement cache is stale, deny.
|
||
CLI products degrade along the licence ladder instead.
|
||
|
||
6. CONTRACT EVOLVES, PRODUCTS DECLARE COMPATIBILITY
|
||
Products declare which contract version they implement. The platform supports
|
||
N and N-1; deprecation is announced before removal.
|
||
```
|
||
|
||
---
|
||
|
||
## 3. Required Surfaces
|
||
|
||
```
|
||
┌──────────────────────┬──────────────────────────────────────────────┬───────────────────────┐
|
||
│ Surface │ What │ Requirement │
|
||
├──────────────────────┼──────────────────────────────────────────────┼───────────────────────┤
|
||
│ Backend API │ REST + OpenAPI 3.0 spec (§4) │ REQUIRED (standalone, │
|
||
│ │ │ headless); cli: the │
|
||
│ │ │ licence client (§5.C) │
|
||
│ Frontend │ one of: standalone app on its own host │ REQUIRED to declare │
|
||
│ │ behind SSO · headless (portal-rendered) │ the type; no │
|
||
│ │ · cli (downloads + licence page) │ embedding of any kind │
|
||
│ MCP Server │ MCP server exposing tenant-scoped tools │ REQUIRED for │
|
||
│ │ │ Enterprise tier │
|
||
│ Documentation │ README, API docs, integration guide, │ REQUIRED │
|
||
│ │ runbook, data model, GDPR retention │ │
|
||
│ Observability │ /health, /metrics, structured logs, │ REQUIRED │
|
||
│ │ audit + usage event emission │ │
|
||
└──────────────────────┴──────────────────────────────────────────────┴───────────────────────┘
|
||
```
|
||
|
||
---
|
||
|
||
## 4. Backend API Contract
|
||
|
||
### 4.1 Mandatory Endpoints
|
||
|
||
```
|
||
GET /health
|
||
200 {"status": "ok"|"degraded", "checks": {...}} · 503 {"status": "down"}
|
||
Authentication: NONE (Orca probe)
|
||
|
||
GET /version
|
||
{"product": "pruefwerk", "version": "1.4.2", "contract": "2.0",
|
||
"build": "<git sha>", "deployed_at": "..."}
|
||
Authentication: NONE
|
||
|
||
GET /v1/usage
|
||
?tenant_id=<uuid>&from=<iso>&to=<iso>[&project_id=]
|
||
Aggregated usage for dashboards (seats_active, scans, targets, environments, ...).
|
||
Authentication: SERVICE TOKEN (portal / registry)
|
||
NOTE: billing does NOT poll this. Billing-relevant usage is PUSHED (§9.2):
|
||
POST https://registry[-stage].breakpilot.com/v1/usage/events
|
||
|
||
POST /v1/tenants/{id}/provision
|
||
{"plan": "...", "limits": {...}, "addons": {...}, "contract_version": "2.0"}
|
||
Idempotent. Authentication: SERVICE TOKEN (tenant-registry)
|
||
|
||
POST /v1/tenants/{id}/suspend ladder → restricted/halted (writes blocked)
|
||
POST /v1/tenants/{id}/reactivate ladder → active
|
||
POST /v1/tenants/{id}/terminate {"reason", "scheduled_erasure_at"}
|
||
Authentication: SERVICE TOKEN
|
||
|
||
POST /v1/tenants/{id}/export GDPR Art. 20 — signed URL to a ZIP
|
||
Authentication: USER JWT (IT_ADMIN or LEGAL) or SERVICE TOKEN (offboarding)
|
||
|
||
DELETE /v1/tenants/{id}/data GDPR Art. 17 — {"confirm": "<tenant_slug>"}
|
||
Authentication: SERVICE TOKEN + USER JWT (IT_ADMIN)
|
||
|
||
POST /v1/tenants/demo/reset restores seed data; portal service token only
|
||
```
|
||
|
||
`cli` products implement the tenant endpoints on their cloud component if they have one (Firmwerk cloud-server); pure CLIs (Werkpilot) have no backend and are exempt from §4.1 except `/version` inside the binary.
|
||
|
||
### 4.2 Authentication Modes
|
||
|
||
```
|
||
USER JWT Bearer token issued by Keycloak (realm breakpilot-{env}).
|
||
Claims: sub, email, tenant_id, tenant_slug, org_roles, realm_roles,
|
||
tenant_status, aud, iss. ← NO products / plan claim.
|
||
Validate via JWKS (cache 5 min), pin iss AND aud.
|
||
Used for: all customer-facing endpoints.
|
||
|
||
SERVICE TOKEN Short-lived JWT via client_credentials (clients: portal-svc-{env},
|
||
tenant-registry-svc-{env}, {product}-svc-{env}). TTL ≤ 15 min.
|
||
Used for: platform-to-product and product-to-product calls.
|
||
|
||
API KEY `Authorization: ApiKey k_...` issued by the portal, verified through
|
||
tenant-registry POST /v1/internal/api-keys/verify → {valid, tenant_id,
|
||
product, scopes}. Used for: headless products, MCP, Werkbank runners.
|
||
|
||
LICENCE TOKEN Ed25519-signed JWT issued by tenant-registry (§5.C). Verified OFFLINE
|
||
against /.well-known/licence-keys.json. Used for: CLIs and their cloud
|
||
components.
|
||
|
||
ORCA PROBE No authentication, local only: /health, /version.
|
||
```
|
||
|
||
### 4.3 Tenant Scoping Rules
|
||
|
||
```
|
||
1. EVERY non-probe endpoint derives the tenant from the credential (JWT tenant_id, API key
|
||
binding, licence token tenant) — never from a client-supplied header.
|
||
2. EVERY query to the product database is tenant-scoped (per-tenant database, RLS, or
|
||
WHERE tenant_id = $1). No exceptions. Code review enforces this; tests verify it.
|
||
3. EVERY response includes only data for the requested tenant (asserted in middleware).
|
||
4. EVERY log line, audit event and usage event includes tenant_id.
|
||
```
|
||
|
||
### 4.4 Entitlement Check (replaces the `products` claim)
|
||
|
||
```
|
||
POST https://registry[-stage].breakpilot.com/v1/internal/entitlements/check
|
||
Authorization: Bearer <SERVICE TOKEN of {product}-svc-{env}>
|
||
{"tenant_id": "...", "product": "pruefwerk", "addon": "werkbank" | null}
|
||
→ 200 {"allowed": true|false, "status": "active|warning|restricted|halted|trial|demo|archived",
|
||
"limits": {"targets": 25, "scans_per_month": 500, "runners": 2, ...},
|
||
"expires_at": "...", "reason": "..."}
|
||
|
||
Rules:
|
||
- Call on tenant-context creation (login, first request of a session, API-key verify) and
|
||
cache per tenant for ≤ 60 s. Re-check on every write if the cache is older than 60 s.
|
||
- allowed=false → 403 with {"error": "not_entitled", "product": "..."} and the portal's
|
||
catalog URL in the body so the UI can show "Not in your plan".
|
||
- registry unreachable + cache stale → deny (fail closed). Emit a `bp_entitlement_check_errors`
|
||
metric so it is visible.
|
||
- `status` drives the lifecycle behaviour in §9.3; limits are enforced by the product.
|
||
```
|
||
|
||
### 4.5 OpenAPI Spec
|
||
|
||
Every product with a backend publishes `openapi.yaml` at `/openapi.yaml` (OpenAPI 3.0), including all §4.1 endpoints, the authentication mode per endpoint, scopes consumed, and 4xx/5xx schemas. The registry validates it at registration.
|
||
|
||
---
|
||
|
||
## 5. Frontend Contract
|
||
|
||
A product declares its frontend type in the manifest. **No type embeds product UI in the portal**: no iframes, no custom elements, no remote bundles. The portal links; the product owns its UI.
|
||
|
||
```
|
||
standalone Full UI served by the product on its own host (pruefwerk[-stage].breakpilot.com),
|
||
behind the platform Keycloak realm (SSO). The portal shows a tile → "Open".
|
||
Examples: Prüfwerk dashboard, Firmwerk cloud-server pages.
|
||
|
||
headless No frontend code. The portal renders a generic management UI (API keys,
|
||
webhooks, usage, docs, code samples) from a portal_config block in the manifest.
|
||
Customers consume the product via API / MCP from their own systems.
|
||
|
||
cli Product runs on the customer's machines. The portal renders downloads, licence
|
||
status, seats/environments and a "Sign in from the CLI" hint. A cloud component
|
||
(if any) is declared as a standalone or headless sub-surface.
|
||
```
|
||
|
||
### 5.A Standalone
|
||
|
||
```
|
||
HOST one branded host per environment: {product}-stage.breakpilot.com / {product}.breakpilot.com
|
||
Sub-surfaces on the same host by path: /mcp/*, /docs/*, /api/*.
|
||
SSO OIDC PKCE against realm breakpilot-{env}; the product's Keycloak client is
|
||
{product}-dashboard-{env}. The portal hands off by plain link; Keycloak's realm
|
||
session makes the second login silent.
|
||
RETURN Product UIs show a "Back to portal" link to https://app[-stage].breakpilot.com/{slug}/dashboard
|
||
and read `tenant_slug` from the token for it.
|
||
THEME Consume @breakpilot/design-tokens CSS variables if you want; not required.
|
||
Respect prefers-color-scheme.
|
||
SECURITY Product responses set X-Frame-Options: DENY (or CSP frame-ancestors 'none'),
|
||
a strict CSP, and an explicit CORS allowlist limited to the portal host and
|
||
the product's own host. `CorsLayer::permissive()` and `webOrigins: ["+"]`
|
||
are contract violations.
|
||
TENANT UI must display the tenant name and the ladder banner (warning/restricted/
|
||
halted) it gets from the entitlement check.
|
||
```
|
||
|
||
### 5.B Headless
|
||
|
||
Unchanged from 1.0: the portal renders API keys, webhooks, usage, docs and code samples from `portal_config`; keys are portal-owned and verified via `/v1/internal/api-keys/verify`; webhook configuration and delivery logging are portal-owned (`/internal/webhooks/dispatch`); no impersonation.
|
||
|
||
### 5.C CLI (licence contract)
|
||
|
||
```
|
||
LOGIN `<cli> login` runs the OAuth device-authorization grant against
|
||
https://auth.breakpilot.com/realms/breakpilot-{env} (public client {product}-cli),
|
||
then POSTs the user token to registry /v1/licences {product, machine_id, hostname,
|
||
version} and stores the returned licence token under the CLI's config dir
|
||
(e.g. ~/.config/werkpilot/licence.jwt, ~/.config/firmwerk/licence.jwt).
|
||
|
||
TOKEN JWT, alg EdDSA (Ed25519), kid → key in https://registry[-stage].breakpilot.com/
|
||
.well-known/licence-keys.json (cache the key set for 30 days).
|
||
Claims: iss, sub (tenant_id), tenant_slug, product, sku, tier, seats|environments,
|
||
valid_until, grace {warn_days: 7, degrade_days: 14, stop_days: 30}, machine_id,
|
||
iat, exp (= valid_until + stop_days), jti (= licence id).
|
||
|
||
VERIFY OFFLINE on every start: signature, exp, product, machine_id (unless the SKU is
|
||
floating). Never phone home synchronously on the critical path.
|
||
|
||
HEARTBEAT Hourly (jittered) POST /v1/licences/heartbeat {jti, version, usage: {...}}.
|
||
A 200 returns a refreshed token (new valid_until). 402/410 = revoked/halted:
|
||
keep the old token but start the ladder from `degraded`. Network errors: keep
|
||
counting from the last successful heartbeat.
|
||
|
||
LADDER days since last successful heartbeat (or since valid_until if earlier):
|
||
0–7 Healthy full function
|
||
7–14 Warning full function + banner on every invocation
|
||
14–30 Degraded read-only / analysis only (writes, builds, seals refused)
|
||
> 30 Hard-stop refuse to start except `<cli> login` and `<cli> licence status`
|
||
Firmwerk: read-only usage is free forever, so Degraded == free tier.
|
||
|
||
USAGE Heartbeat carries daily usage counters (sessions, environments, builds) which the
|
||
registry turns into usage events (§9.2). No separate metering call.
|
||
|
||
AIR-GAP Signed offline licence packages (same token, longer validity, monthly Enterprise /
|
||
quarterly Business rotation) issued from Backstage; no heartbeat expected.
|
||
|
||
CLOUD PART A cloud component (firmwerk-cloud-server) verifies the same licence token as a
|
||
bearer credential and calls entitlements/check for limits. It MUST NOT keep its
|
||
own tenant/api-key/licence tables.
|
||
```
|
||
|
||
---
|
||
|
||
## 6. MCP Server (Required for Enterprise)
|
||
|
||
Unchanged in substance. Endpoint per product on its own host: `https://pruefwerk[-stage].breakpilot.com/mcp`. Authentication via scoped API key or tenant-bound MCP token (verified through the registry), tools tenant-scoped by construction, catalog declared in the manifest, every tool call audited.
|
||
|
||
```
|
||
Prüfwerk MCP tools (existing):
|
||
list_targets · run_scan · get_scan_results · list_findings · get_sbom · list_cves ·
|
||
create_pentest_run · get_control_mapping
|
||
Firmwerk cloud MCP (later): list_environments · get_sbom · list_vex
|
||
```
|
||
|
||
`tenant.plan` is no longer a token claim: the registry checks the tier when issuing an MCP key.
|
||
|
||
---
|
||
|
||
## 7. Documentation Contract
|
||
|
||
Unchanged: README, API reference (from openapi.yaml), integration guide, operational runbook, data model + GDPR table. Published at `{product}.breakpilot.com/docs/` (product-owned, e.g. VitePress with `base: '/docs/'`) and linked from the catalog manifest.
|
||
|
||
---
|
||
|
||
## 8. Observability Contract
|
||
|
||
§8.1 health, §8.2 metrics (add `bp_entitlement_check_total{result}`, `bp_entitlement_check_errors_total`, `bp_usage_events_sent_total{metric}`, `bp_licence_heartbeats_total{result}` for CLI cloud parts), §8.3 JSON logs with `tenant_id`, §8.4 audit events (Retraced shape, `POST registry /v1/audit`) — unchanged from 1.0. OTel export goes to `otel.breakpilot.com` (core SigNoz), service name `{product}-{component}-{env}`.
|
||
|
||
---
|
||
|
||
## 9. Plane-by-Plane Integration Requirements
|
||
|
||
### 9.1 Identity Plane
|
||
|
||
```
|
||
[REGISTRATION]
|
||
- Keycloak clients in realm breakpilot-{env}:
|
||
{product}-dashboard-{env} public PKCE (standalone UI)
|
||
{product}-svc-{env} confidential, client_credentials (service token)
|
||
{product}-cli public, device-authorization grant (cli only)
|
||
- Client scope {product}-audience adds aud: {product} to user tokens.
|
||
- Declare role mappings in the manifest (IT_ADMIN → Admin, …).
|
||
|
||
[RUNTIME]
|
||
- Validate JWT via JWKS (cache 5 min). Reject if iss ≠ the realm's issuer, if aud does not
|
||
include {product}, if exp passed / nbf future, or if tenant_id is missing.
|
||
- Entitlement comes from the registry (§4.4), NEVER from the token.
|
||
- tenant_status in the token is a hint for banners; the registry answer is authoritative.
|
||
|
||
[NEVER]
|
||
- Never validate JWT against a static secret. JWKS only.
|
||
- Never issue tokens. Never accept passwords. Never store credentials.
|
||
- Never skip audience/issuer validation ("validate_aud = false" is a contract violation).
|
||
```
|
||
|
||
### 9.2 Control Plane
|
||
|
||
```
|
||
[REGISTRATION]
|
||
- On first deploy, product POSTs its manifest to tenant-registry POST /v1/catalog/products
|
||
(service token). The registry validates it, pulls openapi.yaml, checks §4.1, registers the
|
||
product with its launch URLs per environment and its add-ons.
|
||
|
||
[LIFECYCLE]
|
||
- On tenant.activate: registry → /v1/tenants/{id}/provision (per entitled product, fan-out)
|
||
- ladder → restricted/halted: registry → /suspend ; ladder → active: /reactivate
|
||
- On offboarding: registry → /export then DELETE /v1/tenants/{id}/data
|
||
- Provisioning calls are retried from the registry outbox; products must be idempotent.
|
||
|
||
[USAGE — PUSH, CONTINUOUS]
|
||
- Product POSTs usage events as they happen (batch every ≤ 60 s):
|
||
POST /v1/usage/events
|
||
[{"idempotency_key": "<product>:<tenant>:<event-id>", "tenant_id": "...",
|
||
"product": "pruefwerk", "metric": "scan.completed", "quantity": 1,
|
||
"occurred_at": "...", "properties": {"target_id": "..."}}]
|
||
→ 202. Retry on 5xx with the same idempotency_key; the registry dedups.
|
||
- Metrics per product are declared in the manifest (`usage.metrics`) and map to the SKU
|
||
sheet's quota dimensions (targets, scans/month, seats, environments, tokens).
|
||
- The registry forwards usage to ERPNext (usage records on the tenant's Subscription).
|
||
Invoices are fixed-tier at launch; metered SKUs switch on later without product changes.
|
||
- GET /v1/usage (§4.1) remains for dashboards only.
|
||
|
||
[BACKSTAGE ACTIONS] unchanged (admin_actions in manifest, service-token calls, audited).
|
||
|
||
[AUDIT EVENTS] unchanged (POST registry /v1/audit).
|
||
```
|
||
|
||
### 9.3 App Plane (data + lifecycle)
|
||
|
||
```
|
||
[DATA OWNERSHIP / ISOLATION / PROJECT SCOPING / BACKUP / GDPR / RESIDENCY] unchanged from 1.0.
|
||
|
||
[TENANT LIFECYCLE CONTRACT — ladder]
|
||
Products MUST honor the status returned by entitlements/check (tenant_status in the token
|
||
is a hint):
|
||
|
||
┌────────────┬────────────────────────────────────────────────────────────────────────┐
|
||
│ status │ Product behaviour │
|
||
├────────────┼────────────────────────────────────────────────────────────────────────┤
|
||
│ demo │ Accept all calls, no usage events with billing effect, honour │
|
||
│ │ /v1/tenants/demo/reset, audit tagged {"demo": true}. │
|
||
│ trial │ Accept all calls up to manifest trial_quota; over quota → 429 + │
|
||
│ │ X-Trial-Limit-Reset. Show "Trial" in the UI banner area. │
|
||
│ active │ Normal operation. (Betriebsbereit)│
|
||
│ warning │ Normal operation + persistent banner "payment overdue". (Warnung) │
|
||
│ restricted │ Reads and /export allowed; writes / new runs / scans → 402; │
|
||
│ │ background jobs paused; webhooks stop. (Eingeschränkt) │
|
||
│ halted │ Only /export and read of existing exports; everything else → 402. │
|
||
│ │ Data retained for the export window. (Angehalten) │
|
||
│ archived │ All API calls return 410 Gone. Data already deleted. │
|
||
└────────────┴────────────────────────────────────────────────────────────────────────┘
|
||
|
||
CLI products apply the licence ladder in §5.C instead (Healthy/Warning/Degraded/Hard-stop).
|
||
```
|
||
|
||
### 9.4 Infra Plane
|
||
|
||
```
|
||
[IaC] Orca service file in platform/orca-platform: services/{product}-{env}/service.toml,
|
||
one [[service]] per container, placement.node = the env's VM, resources.memory,
|
||
health check, `${secrets.KEY}` references only. CI runs validate.sh.
|
||
[SECRETS] Orca project-scoped secrets (`orca secrets set --project {product}-{env}`).
|
||
Never global. Licence signing keys live in Infisical, read by the registry only.
|
||
[NETWORK] Products bind to the project network; public routes are declared with
|
||
`domain` / `routes` on the service; cross-node calls (none by design) use HTTPS.
|
||
[BUILD] Dockerfile in repo root (or Dockerfile.{component}); Gitea Actions:
|
||
fmt → lint → test → build → trivy → push repo.breakpilot.com/{product}/{image}
|
||
:sha-<short> + :latest → cosign → signed webhook to the platform master.
|
||
[COLD START] `depends_on` in the service file; Orca orders startup.
|
||
```
|
||
|
||
---
|
||
|
||
## 10. Product Manifest
|
||
|
||
```yaml
|
||
# product.manifest.yaml
|
||
schema_version: "2.0"
|
||
|
||
product:
|
||
id: pruefwerk
|
||
name: "Prüfwerk"
|
||
description: "Compliance scanner: SBOM, DAST, pentest orchestration, PLC provisioning tests"
|
||
vendor: breakpilot
|
||
contract_version: "2.0"
|
||
product_version: "1.4.2"
|
||
repo: git.breakpilot.com/platform/pruefwerk
|
||
|
||
catalog:
|
||
category: "Security" # AI Infrastructure | Compliance | Productivity | Security | Data | Developer
|
||
tagline: "CRA readiness for machine software — scan, prove, fix"
|
||
hero_image: /docs/assets/hero.png # served by the product itself
|
||
pricing_summary: "From €1,490/tenant/month (CRA-CSA-CLD-STD)"
|
||
skus: [CRA-CSA-CLD-STD, CRA-CSA-CLD-BUS, CRA-CSA-CLD-ENT, CRA-CSA-CLD-SCAN]
|
||
addons:
|
||
- id: werkbank
|
||
name: "Werkbank runner"
|
||
skus: [CRA-WBK-CLD-STD, CRA-WBK-CLD-BUS, CRA-WBK-CLD-ENT]
|
||
limit_key: runners
|
||
available_on_plans: [trial, standard, business, enterprise]
|
||
trial_days: 14
|
||
trial_quota: { targets: 2, scans_per_month: 10 }
|
||
works_well_with: [firmwerk, werkpilot]
|
||
demo:
|
||
supported: true
|
||
seed_data_ref: pruefwerk/seed-v1 # platform/seed-data
|
||
reset_endpoint: /v1/tenants/demo/reset
|
||
|
||
identity:
|
||
clients:
|
||
dashboard: pruefwerk-dashboard-{env}
|
||
service: pruefwerk-svc-{env}
|
||
audience: pruefwerk
|
||
role_mappings: { IT_ADMIN: Admin, CXO: Member, USER: Member, FINANCE: Viewer, LEGAL: Viewer }
|
||
|
||
frontend:
|
||
type: standalone # standalone | headless | cli
|
||
url:
|
||
stage: https://pruefwerk-stage.breakpilot.com
|
||
prod: https://pruefwerk.breakpilot.com
|
||
docs_path: /docs
|
||
back_to_portal: true
|
||
|
||
backend:
|
||
openapi_url: /openapi.yaml
|
||
base_url: # internal, per env
|
||
stage: http://pruefwerk-agent-stage:3001
|
||
prod: http://pruefwerk-agent-prod:3001
|
||
health_url: /health
|
||
service_token_audience: pruefwerk
|
||
|
||
mcp:
|
||
enabled: true
|
||
required_plan: enterprise
|
||
path: /mcp
|
||
tools:
|
||
- { name: list_targets, description: "Targets configured for the tenant", required_scope: read:targets }
|
||
- { name: run_scan, description: "Start a scan", required_scope: write:scans }
|
||
# ...
|
||
|
||
usage:
|
||
metrics:
|
||
- { key: scan.completed, unit: scan, quota: scans_per_month }
|
||
- { key: target.added, unit: target, quota: targets }
|
||
- { key: seat.login, unit: user, quota: users }
|
||
push_interval_s: 60
|
||
|
||
data:
|
||
data_stores: [{ type: mongodb, per_tenant_database: true }]
|
||
tenant_scoping: { field: tenant_id, enforcement: per-database }
|
||
supports_projects: false
|
||
retention_default_days: 365
|
||
gdpr_export: /v1/tenants/{id}/export
|
||
gdpr_erasure: /v1/tenants/{id}/data
|
||
offboarding_export_formats: [json, cyclonedx, spdx]
|
||
frozen_behavior: { reads: allow, writes: deny_402, background_jobs: pause }
|
||
|
||
backup: { rpo: 24h, rto: 30min, retention_days: 30 }
|
||
|
||
infra:
|
||
images:
|
||
- repo.breakpilot.com/pruefwerk/compliance-agent
|
||
- repo.breakpilot.com/pruefwerk/compliance-dashboard
|
||
- repo.breakpilot.com/pruefwerk/compliance-mcp
|
||
- repo.breakpilot.com/pruefwerk/compliance-docs
|
||
orca_project: pruefwerk-{env}
|
||
depends_on: [pruefwerk-mongo, browserless]
|
||
|
||
admin_actions:
|
||
- { name: "Re-run CVE monitor", endpoint: "POST /v1/tenants/{id}/admin/cve-monitor", confirm: required, audit_required: true }
|
||
|
||
observability:
|
||
metrics: /metrics
|
||
logs: { format: json, pii_redaction: true }
|
||
audit_endpoint: registry /v1/audit
|
||
```
|
||
|
||
### 10.1 Manifest variants
|
||
|
||
```yaml
|
||
# headless — no frontend.url; portal renders everything
|
||
frontend:
|
||
type: headless
|
||
portal_config:
|
||
sections: [api_keys, webhooks, usage, code_samples, docs]
|
||
api_key_scopes: [...]
|
||
webhook_events: [...]
|
||
code_samples: [...]
|
||
|
||
# cli — Werkpilot
|
||
frontend:
|
||
type: cli
|
||
downloads:
|
||
releases_url: https://git.breakpilot.com/platform/werkpilot/releases
|
||
platforms: [linux-x86_64, linux-aarch64, macos-aarch64, windows-x86_64]
|
||
cloud: null # no hosted component
|
||
licence:
|
||
skus: [DEV-WP-CLD-STD, DEV-WP-CLD-BUS, DEV-WP-CLD-ENT, DEV-WP-OPR-STD, DEV-WP-OPR-BUS, DEV-WP-OPR-ENT]
|
||
seat_model: named_user # named_user | instance
|
||
grace: { warn_days: 7, degrade_days: 14, stop_days: 30 }
|
||
floating: false
|
||
offline_packages: true
|
||
usage:
|
||
metrics:
|
||
- { key: seat.session_started, unit: user, quota: users }
|
||
|
||
# cli — Firmwerk (with cloud component)
|
||
frontend:
|
||
type: cli
|
||
downloads:
|
||
releases_url: https://git.breakpilot.com/api/packages/platform/generic/firmwerk
|
||
cloud:
|
||
type: standalone
|
||
url: { stage: https://firmwerk-stage.breakpilot.com, prod: https://firmwerk.breakpilot.com }
|
||
licence:
|
||
skus: [DEV-FWK-CLD-STD, DEV-FWK-CLD-BUS, DEV-FWK-CLD-ENT, DEV-FWK-OPR-STD, DEV-FWK-OPR-BUS, DEV-FWK-OPR-ENT]
|
||
seat_model: named_user
|
||
grace: { warn_days: 7, degrade_days: 14, stop_days: 30 }
|
||
free_read_only: true
|
||
usage:
|
||
metrics:
|
||
- { key: environment.created, unit: environment, quota: environments }
|
||
- { key: sbom.uploaded, unit: sbom }
|
||
- { key: seat.active, unit: user, quota: users }
|
||
```
|
||
|
||
The registry validates: `standalone` requires `frontend.url` per env; `headless` requires `portal_config` and no `url`; `cli` requires `downloads` and a `licence` block; `addons[].limit_key` must exist in `usage.metrics[].quota` or `plans`.
|
||
|
||
---
|
||
|
||
## 11. Service Token Model (Inter-Product Communication)
|
||
|
||
Unchanged mechanics (client_credentials, 15-min TTL, `X-On-Behalf-Of-User`, audit on both sides). Clients are named `{product}-svc-{env}`; the realm is `breakpilot-{env}`.
|
||
|
||
```
|
||
pruefwerk offers: read:pruefwerk-findings · read:pruefwerk-sbom · write:pruefwerk-scans
|
||
firmwerk offers: read:firmwerk-sbom · read:firmwerk-vex
|
||
compliance offers (after M-MIG-9): read:compliance-status · read:compliance-dsfa · read:control-catalog
|
||
pruefwerk consumes: read:control-catalog (OSCAL master controls from breakpilot-compliance; degrades
|
||
to unmapped findings when unavailable)
|
||
```
|
||
|
||
Third-party readiness (§11.3 of 1.0) unchanged.
|
||
|
||
---
|
||
|
||
## 12. Versioning and Contract Evolution
|
||
|
||
`contract_version` 2.0 from 2026-09-11. No product reached 1.0 compliance, so 1.0 is retired immediately; the N/N-1 rule applies from 2.0 onward. Breaking-change process unchanged (announce here, bump, 12 months for existing products).
|
||
|
||
---
|
||
|
||
## 13. Onboarding Checklist for a New Product
|
||
|
||
```
|
||
☐ Backend API
|
||
☐ openapi.yaml committed and validated
|
||
☐ Mandatory endpoints implemented (§4.1)
|
||
☐ JWT validation via JWKS with iss AND aud pinned
|
||
☐ Service token validation
|
||
☐ Entitlement check via registry, cached ≤ 60 s, fail-closed, tested (§4.4)
|
||
☐ Tenant scoping enforced in middleware + negative test
|
||
☐ /provision idempotency test · /export valid ZIP · DELETE …/data irreversible and audited
|
||
|
||
☐ Frontend (manifest declares one of: standalone | headless | cli)
|
||
standalone: ☐ own host per env ☐ SSO via realm client ☐ back-to-portal link
|
||
☐ X-Frame-Options DENY + CSP + CORS allowlist ☐ ladder banner
|
||
headless: ☐ portal_config complete ☐ api-keys/verify integration ☐ webhooks/dispatch integration
|
||
cli: ☐ `login` (device flow) ☐ offline licence verify ☐ heartbeat ☐ ladder behaviour
|
||
☐ `licence status` command ☐ cloud part verifies licence tokens, keeps no own tenants
|
||
|
||
☐ MCP (if Enterprise) — deployed at /mcp, catalog in manifest, key auth, tenant-scoped, audited
|
||
☐ Documentation — README, API ref, integration guide, runbook, data model + GDPR at {product}/docs
|
||
☐ Observability — /health, /metrics (incl. entitlement + usage counters), JSON logs, audit events, no PII
|
||
☐ Identity — realm clients registered, role mappings tested, aud claim present in tenant JWTs
|
||
☐ Control — manifest registered; lifecycle endpoints tested from Backstage; usage events arrive
|
||
in registry (and in ERPNext mock on stage); add-on limits enforced
|
||
☐ Data — tenant_id everywhere; cross-tenant negative test; backup declared and running; GDPR export tested
|
||
☐ Infra — service file pinned + memory set; validate.sh green; image signed; secrets project-scoped;
|
||
CI webhook redeploys stage
|
||
```
|
||
|
||
---
|
||
|
||
## 14. Gap Analysis — First-Line Products vs Contract 2.0 (as of 2026-09-11)
|
||
|
||
### Prüfwerk (`platform/pruefwerk`)
|
||
```
|
||
✓ Keycloak OIDC PKCE on the dashboard; JWT auth on the agent (JWKS)
|
||
✗ iss/aud not validated (validate_aud = false) — MUST fix
|
||
✗ CORS permissive — MUST fix (allowlist)
|
||
✓ Per-tenant MongoDB, tenant-scoped webhooks, tenant-bound MCP tokens, status gate (402/410)
|
||
✗ Entitlement check — reads claims only; `products` never enforced → switch to registry check
|
||
✗ Scheduler calls a non-existent GET /v1/tenants (falls back to tenant "dev") → use the new list endpoint
|
||
✗ /provision, /suspend, /reactivate, /terminate, /export, DELETE data, demo/reset — missing
|
||
✗ Usage events — none
|
||
✓ /health, OTel; ✗ /metrics contract counters; ✗ audit POST to registry
|
||
✗ Werkbank runner auth is a static token → registry API key with scope werkbank:runner
|
||
Effort: ~3 weeks (M-MIG-6 + M-MIG-7 items)
|
||
```
|
||
|
||
### Werkbank (`platform/werkbank`)
|
||
```
|
||
✓ Leases jobs from Prüfwerk; tenant fixed per runner
|
||
✗ No Dockerfile / CI / service file
|
||
✗ Static runner token → registry API key
|
||
✗ Cargo git dependencies pinned to branch main on the old host → pin to a tag on platform/pruefwerk
|
||
Effort: ~3 days
|
||
```
|
||
|
||
### Werkpilot (`platform/werkpilot`)
|
||
```
|
||
✓ Release pipeline (tarball, SBOM, GPG), Kellnr mirror, no-egress guard, telemetry disabled
|
||
✗ No login / licence client / ladder / heartbeat (§5.C) — new
|
||
✗ Per-tenant LiteLLM virtual key issued with the licence — new
|
||
Effort: ~1.5 weeks
|
||
```
|
||
|
||
### Firmwerk (`platform/firmwerk`)
|
||
```
|
||
✓ CLI + cloud-server exist; device login flow exists (own implementation)
|
||
✗ Own tenant / api_key / licence model in cloud-server → replace with registry licence verification
|
||
✗ Ed25519 licence issuance moves to the registry; CLI verifies registry tokens
|
||
✗ Workflows under .github with runs-on ubuntu-latest → .gitea, runs-on docker
|
||
✗ Entitlement check for environment limits; usage events
|
||
Effort: ~2 weeks
|
||
```
|
||
|
||
---
|
||
|
||
## 15. Open Items
|
||
|
||
```
|
||
- Contract testing — automate manifest + openapi validation in Gitea Actions (validate.sh for manifests).
|
||
- MCP on one host path (/mcp) is decided; a unified mcp.breakpilot.com gateway is deferred.
|
||
- Third-party manifest signing — defer until the first real third-party conversation.
|
||
- Inter-product event bus — deferred; service tokens cover current needs.
|
||
- Floating (concurrent) CLI seats — SKU sheet allows 2–2.5× named; implement after named seats work.
|
||
- Offline licence package tooling in Backstage — after the online path is proven on staging.
|
||
|
||
OSS swap-in points (designed-for, not adopted yet):
|
||
- Audit log storage: Retraced-shape events (§8.4) → BoxyHQ Retraced when needed.
|
||
- Usage metering: usage_events are Lago-compatible (idempotency_key ≈ transaction_id, metric ≈ code)
|
||
should ERPNext usage records ever become the bottleneck.
|
||
- SCIM: BoxyHQ Jackson or Keycloak SCIM when the first enterprise customer asks.
|
||
- Feature flags: OpenFeature when finer-than-plan gating is needed.
|
||
```
|
||
|
||
---
|
||
|
||
*End of document. Contract version 2.0 (2026-09-11). Next review: after Prüfwerk passes the §13 checklist on staging.*
|