MVP-1.2 · Enforce entitlement limits, trial 429, paid overage usage #263

Closed
opened 2026-09-20 20:17:20 +00:00 by sharang · 1 comment
Owner

Goal

Contract 2.0 §4.4 entitlements are read but not enforced, so a tenant can exceed the SKU limits (STD 5/50, BUS 25/500, ENT unlimited targets/scans per month) at will. Decision 1 of the plan: a trial over quota gets a hard 429; a paying tenant may exceed the quota and the overage is emitted as usage for CRA-CSA-CLD-SCAN with a banner.

What to change

  • Enforce limits.targets on target create, demo-seed and DAST target add.
  • Enforce scans_per_month on every scan trigger: manual, scheduled and webhook.
  • Trial over quota → 429 + X-Trial-Limit-Reset.
  • Paying tenant over quota → allow, emit the overage as usage for CRA-CSA-CLD-SCAN, and show a banner (dashboard side in MVP-1.10).
  • Re-check freshly on writes when the cached entitlement is older than 60 s.
  • Check the Werkbank add-on entitlement.
  • Emit the bp_entitlement_check_* metrics.
  • When the registry is unset in production, fail closed (api/server.rs:63-98, registry.rs).

Acceptance

  • Creating one target past limits.targets is refused for both trial and paid, with the SKU limit in the error.
  • A trial tenant over scans_per_month receives 429 with X-Trial-Limit-Reset; a stage script covers it.
  • A paid tenant over quota still scans and produces an overage usage record.
  • Manual, scheduled and webhook triggers all go through the same check.
  • bp_entitlement_check_* metrics appear on /metrics (MVP-1.7).
  • With APP_ENV=production and no registry configured, the agent fails closed (MVP-0.1).
## Goal Contract 2.0 §4.4 entitlements are read but not enforced, so a tenant can exceed the SKU limits (STD 5/50, BUS 25/500, ENT unlimited targets/scans per month) at will. Decision 1 of the plan: a trial over quota gets a hard 429; a paying tenant may exceed the quota and the overage is emitted as usage for `CRA-CSA-CLD-SCAN` with a banner. ## What to change - Enforce `limits.targets` on target create, demo-seed and DAST target add. - Enforce `scans_per_month` on every scan trigger: manual, scheduled and webhook. - Trial over quota → **429 + `X-Trial-Limit-Reset`**. - Paying tenant over quota → allow, emit the overage as usage for `CRA-CSA-CLD-SCAN`, and show a banner (dashboard side in MVP-1.10). - Re-check freshly on writes when the cached entitlement is older than 60 s. - Check the Werkbank add-on entitlement. - Emit the `bp_entitlement_check_*` metrics. - When the registry is unset in production, fail closed (`api/server.rs:63-98`, `registry.rs`). ## Acceptance - [ ] Creating one target past `limits.targets` is refused for both trial and paid, with the SKU limit in the error. - [ ] A trial tenant over `scans_per_month` receives 429 with `X-Trial-Limit-Reset`; a stage script covers it. - [ ] A paid tenant over quota still scans and produces an overage usage record. - [ ] Manual, scheduled and webhook triggers all go through the same check. - [ ] `bp_entitlement_check_*` metrics appear on `/metrics` (MVP-1.7). - [ ] With `APP_ENV=production` and no registry configured, the agent fails closed (MVP-0.1).
sharang added this to the Production MVP milestone 2026-09-20 20:17:20 +00:00
sharang added the highenhancement labels 2026-09-20 20:17:20 +00:00
Author
Owner

Closing as superseded by t72 metering (#927-#932): extra targets are billed instead of refused and Prüftage replace the overage, with admission in compliance-core/src/models/metering.rs. A trial 429 or entitlement metrics would be new issues if still wanted.

Closing as superseded by t72 metering (#927-#932): extra targets are billed instead of refused and Prüftage replace the overage, with admission in `compliance-core/src/models/metering.rs`. A trial 429 or entitlement metrics would be new issues if still wanted.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: platform/pruefwerk#263