Security fix. Before this change, org roles were enforced only for manual findings, so every tenant member could use Prüfwerk fully. That included FINANCE and LEGAL. The user reported this after signing in as FINANCE.
Role matrix (decided 30.09.2026)
Caller
Read (GET/HEAD/OPTIONS and read-only POSTs)
Write (every other POST/PUT/PATCH/DELETE)
IT_ADMIN
yes
yes
USER
yes
yes (manual findings stay IT_ADMIN-only)
CXO
yes
403 forbidden_role (access: read_only)
LEGAL
yes
403 forbidden_role (access: read_only)
FINANCE
403 forbidden_role (access: none)
403
no role / unknown roles
403 (access: none)
403
BreakPilot support (TenantContext.staff)
unchanged (support rules)
unchanged (read-only until confirmed, audited)
Service / machine (platform API, Werkbank runner, admin API, health)
unchanged (no tenant context)
unchanged
If a user holds several roles, the strongest one applies.
Route classification
POSTs treated as read, listed in role_gate::READ_ONLY_POSTS and matched by route template:
POST /api/v1/oscal/assess
POST /api/v1/pentest/sessions/{id}/export
POST /api/v1/chat/{repo_id}
POST /api/v1/help/chat
Writes: every other POST, PUT, PATCH and DELETE. This covers targets (create, update, delete, artifacts, upload, archive password, detect, scan, demo-seed), findings status, bulk status and feedback, manual findings create and import, MCP tokens create and revoke, graph build, DAST targets and scan, chat build-embeddings, notifications read-all, read and dismiss, and pentest sessions (create, chat, stop, pause, resume).
Ambiguous routes, treated as writes: notifications read-all, read and dismiss change tenant-shared state.
/api/v1/support/* is still gated by StaffCtx.
Changes
Agent: a new middleware, api::role_gate::require_org_role, sits right after JWT and before entitlement. It is also mounted in dev mode.
Core: adds ProductAccess and TenantContext::product_access().
Dashboard:
FINANCE and users with no role get a no-access page in DE and EN: "Ihre Rolle hat keinen Zugriff auf Prüfwerk. Wenden Sie sich an Ihre IT-Administration." It links back to the portal and offers sign-out. It has no sidebar and renders no data.
require_auth refuses every server function for these roles.
CXO and LEGAL see a read-only note, and write actions are hidden.
The MCP server functions talk to the dashboard's own database, so they check the role themselves (add, delete and regenerate need write access). Access tokens are withheld from read-only roles. The health refresh still runs for readers.
The role refusal reads as text rather than as a code.
MCP server: unchanged. Its tokens are bound to a tenant and carry no roles, and its tools only read. Creating a token now needs write access.
Docs: a roles table in Getting Started (DE and EN).
Crates are bumped to 0.4.4.
Tests
api::role_gate::router_tests runs against the real build_router(). It covers 8 callers (IT_ADMIN, USER, CXO, LEGAL, FINANCE, no roles, staff, service) across 25 method/route pairs: targets list/create/get/update/delete, scan, detect, demo-seed, findings list/get, status, bulk and feedback, manual findings create and import, evidence pack, SBOM export, MCP tokens, notifications, pentest sessions, and the four read-only POSTs.
A second test checks that every READ_ONLY_POSTS template still matches a real route.
There are also core tests for ProductAccess and a dashboard test for reading roles from the token.
Locally, cargo fmt --check and clippy -D warnings pass for core, agent, mcp and dashboard (server and web). The test runs from CI also pass: core+agent+werkbank-exec+control-map --lib, core --tests, and dashboard server and web.
Note (not fixed here)
The dashboard's mcp_servers collection belongs to the dashboard's own database, not to a tenant. This PR does not change that.
Security fix. Before this change, org roles were enforced only for manual findings, so every tenant member could use Prüfwerk fully. That included FINANCE and LEGAL. The user reported this after signing in as FINANCE.
## Role matrix (decided 30.09.2026)
| Caller | Read (GET/HEAD/OPTIONS and read-only POSTs) | Write (every other POST/PUT/PATCH/DELETE) |
| --- | --- | --- |
| IT_ADMIN | yes | yes |
| USER | yes | yes (manual findings stay IT_ADMIN-only) |
| CXO | yes | 403 `forbidden_role` (`access: read_only`) |
| LEGAL | yes | 403 `forbidden_role` (`access: read_only`) |
| FINANCE | 403 `forbidden_role` (`access: none`) | 403 |
| no role / unknown roles | 403 (`access: none`) | 403 |
| BreakPilot support (`TenantContext.staff`) | unchanged (support rules) | unchanged (read-only until confirmed, audited) |
| Service / machine (platform API, Werkbank runner, admin API, health) | unchanged (no tenant context) | unchanged |
If a user holds several roles, the strongest one applies.
## Route classification
- **POSTs treated as read**, listed in `role_gate::READ_ONLY_POSTS` and matched by route template:
- `POST /api/v1/oscal/assess`
- `POST /api/v1/pentest/sessions/{id}/export`
- `POST /api/v1/chat/{repo_id}`
- `POST /api/v1/help/chat`
- **Writes**: every other POST, PUT, PATCH and DELETE. This covers targets (create, update, delete, artifacts, upload, archive password, detect, scan, demo-seed), findings status, bulk status and feedback, manual findings create and import, MCP tokens create and revoke, graph build, DAST targets and scan, chat build-embeddings, notifications read-all, read and dismiss, and pentest sessions (create, chat, stop, pause, resume).
- **Ambiguous routes, treated as writes**: notifications read-all, read and dismiss change tenant-shared state.
- `/api/v1/support/*` is still gated by `StaffCtx`.
## Changes
- **Agent**: a new middleware, `api::role_gate::require_org_role`, sits right after JWT and before entitlement. It is also mounted in dev mode.
- **Core**: adds `ProductAccess` and `TenantContext::product_access()`.
- **Dashboard**:
- FINANCE and users with no role get a no-access page in DE and EN: "Ihre Rolle hat keinen Zugriff auf Prüfwerk. Wenden Sie sich an Ihre IT-Administration." It links back to the portal and offers sign-out. It has no sidebar and renders no data.
- `require_auth` refuses every server function for these roles.
- CXO and LEGAL see a read-only note, and write actions are hidden.
- The MCP server functions talk to the dashboard's own database, so they check the role themselves (add, delete and regenerate need write access). Access tokens are withheld from read-only roles. The health refresh still runs for readers.
- The role refusal reads as text rather than as a code.
- **MCP server**: unchanged. Its tokens are bound to a tenant and carry no roles, and its tools only read. Creating a token now needs write access.
- **Docs**: a roles table in Getting Started (DE and EN).
- Crates are bumped to 0.4.4.
## Tests
- `api::role_gate::router_tests` runs against the real `build_router()`. It covers 8 callers (IT_ADMIN, USER, CXO, LEGAL, FINANCE, no roles, staff, service) across 25 method/route pairs: targets list/create/get/update/delete, scan, detect, demo-seed, findings list/get, status, bulk and feedback, manual findings create and import, evidence pack, SBOM export, MCP tokens, notifications, pentest sessions, and the four read-only POSTs.
- A second test checks that every `READ_ONLY_POSTS` template still matches a real route.
- There are also core tests for `ProductAccess` and a dashboard test for reading roles from the token.
- Locally, `cargo fmt --check` and `clippy -D warnings` pass for core, agent, mcp and dashboard (server and web). The test runs from CI also pass: core+agent+werkbank-exec+control-map `--lib`, core `--tests`, and dashboard server and web.
## Note (not fixed here)
The dashboard's `mcp_servers` collection belongs to the dashboard's own database, not to a tenant. This PR does not change that.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
https://claude.ai/code/session_01DmXxNULoSNPvjF7buKipsB
Every member of a tenant could use Prüfwerk fully, whatever their org
role: nothing but manual findings checked org_roles. A FINANCE user
could create and delete targets, start scans and triage findings.
Now, as decided on 30.09.2026:
- IT_ADMIN, USER: read and write.
- CXO, LEGAL: read only. GET/HEAD/OPTIONS plus the POSTs that only
read (OSCAL assess, pentest report export, code chat, help chat).
- FINANCE or no role: no access.
- Agent: one middleware (api::role_gate) right after the JWT one
refuses with 403 {"error":"forbidden_role","access":...}. It is
classified by route template, so ids do not matter. Support sessions
(TenantContext.staff) and requests without a tenant context
(platform service API, Werkbank runner and admin APIs, health) are
unchanged. Manual findings stay IT_ADMIN-only.
- Core: ProductAccess and TenantContext::product_access.
- Dashboard: a role without access sees a "no access" page (DE/EN)
with a link back to the portal, and no server function runs for it.
Read-only roles get a read-only note, and write actions (add target,
scan, edit, delete, triage, tokens, MCP servers, pentest control,
graph/embedding builds, notification dismiss) are hidden. The direct
MCP server functions check the role, and access tokens are withheld
from read-only roles.
- MCP server: unchanged. Its tokens are tenant-bound and carry no
roles, its tools only read, and creating a token now needs write
access.
- Docs: the roles table in Getting Started.
- The crates are at version 0.4.4.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DmXxNULoSNPvjF7buKipsB
sharang
merged commit 5429ff6f0e into main2026-09-30 21:59:08 +00:00
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Security fix. Before this change, org roles were enforced only for manual findings, so every tenant member could use Prüfwerk fully. That included FINANCE and LEGAL. The user reported this after signing in as FINANCE.
Role matrix (decided 30.09.2026)
forbidden_role(access: read_only)forbidden_role(access: read_only)forbidden_role(access: none)access: none)TenantContext.staff)If a user holds several roles, the strongest one applies.
Route classification
role_gate::READ_ONLY_POSTSand matched by route template:POST /api/v1/oscal/assessPOST /api/v1/pentest/sessions/{id}/exportPOST /api/v1/chat/{repo_id}POST /api/v1/help/chat/api/v1/support/*is still gated byStaffCtx.Changes
api::role_gate::require_org_role, sits right after JWT and before entitlement. It is also mounted in dev mode.ProductAccessandTenantContext::product_access().require_authrefuses every server function for these roles.Tests
api::role_gate::router_testsruns against the realbuild_router(). It covers 8 callers (IT_ADMIN, USER, CXO, LEGAL, FINANCE, no roles, staff, service) across 25 method/route pairs: targets list/create/get/update/delete, scan, detect, demo-seed, findings list/get, status, bulk and feedback, manual findings create and import, evidence pack, SBOM export, MCP tokens, notifications, pentest sessions, and the four read-only POSTs.READ_ONLY_POSTStemplate still matches a real route.ProductAccessand a dashboard test for reading roles from the token.cargo fmt --checkandclippy -D warningspass for core, agent, mcp and dashboard (server and web). The test runs from CI also pass: core+agent+werkbank-exec+control-map--lib, core--tests, and dashboard server and web.Note (not fixed here)
The dashboard's
mcp_serverscollection belongs to the dashboard's own database, not to a tenant. This PR does not change that.🤖 Generated with Claude Code
https://claude.ai/code/session_01DmXxNULoSNPvjF7buKipsB
Every member of a tenant could use Prüfwerk fully, whatever their org role: nothing but manual findings checked org_roles. A FINANCE user could create and delete targets, start scans and triage findings. Now, as decided on 30.09.2026: - IT_ADMIN, USER: read and write. - CXO, LEGAL: read only. GET/HEAD/OPTIONS plus the POSTs that only read (OSCAL assess, pentest report export, code chat, help chat). - FINANCE or no role: no access. - Agent: one middleware (api::role_gate) right after the JWT one refuses with 403 {"error":"forbidden_role","access":...}. It is classified by route template, so ids do not matter. Support sessions (TenantContext.staff) and requests without a tenant context (platform service API, Werkbank runner and admin APIs, health) are unchanged. Manual findings stay IT_ADMIN-only. - Core: ProductAccess and TenantContext::product_access. - Dashboard: a role without access sees a "no access" page (DE/EN) with a link back to the portal, and no server function runs for it. Read-only roles get a read-only note, and write actions (add target, scan, edit, delete, triage, tokens, MCP servers, pentest control, graph/embedding builds, notification dismiss) are hidden. The direct MCP server functions check the role, and access tokens are withheld from read-only roles. - MCP server: unchanged. Its tokens are tenant-bound and carry no roles, its tools only read, and creating a token now needs write access. - Docs: the roles table in Getting Started. - The crates are at version 0.4.4. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01DmXxNULoSNPvjF7buKipsB