fix(security): Rechteprüfung deny by default, API-Keys nur auf freigegebenen Routen
- PermissionsGuard lehnt Routen ohne @RequirePermissions/@AllowAnyAuthenticated
ab. API-Keys umgehen keine Rechteprüfung mehr, sondern gelten nur auf
Routen mit @AllowApiKey (Paperless-Webhook, externer Upload, checksum,
Agent-Routen des Etikettendrucks).
- Rechte für 24 bisher offene Routen ergänzt, u.a. paperless/documents
(nur Admin), paperless/documents/:id und Kontonummern (Posteingang/
manuell), webhook/status (Admin). routen-rechte.spec.ts prüft alle Routen.
- Etiketten-Agent: printed/error nur für abgeholte, offene Jobs (bedingtes
Update, sonst 409) – ein gedruckter Job kann seine Nummer nicht mehr
freigeben. Feldwerte nur aus den Eingabefeldern der Vorlage ({number}
nicht vorgebbar) und URL-kodiert in GET-/Callback-URLs.
- PUT paperless/inbox/:id ignoriert Freigabe (CF15) und Zahlung (CF16)
ohne die jeweilige Rolle (Funktionstrennung).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
de9cb09bcd
commit
3f98dfd98f
21 files changed
+699
-51
No files matched your search
@@ -78,6 +78,12 @@ Decorate controllers/handlers with:
|
||||
@RequirePermissions(Permission.VIEW_SCANNER)
|
||||
```
|
||||
|
||||
`PermissionsGuard` is **deny by default**: every route needs `@RequirePermissions(...)`,
|
||||
`@AllowAnyAuthenticated()` (any logged-in user, e.g. own user settings) or `@Public()`.
|
||||
API keys carry no permissions and are rejected everywhere except routes marked
|
||||
`@AllowApiKey()` (Paperless webhook, external upload, label-print agent). `routen-rechte.spec.ts`
|
||||
fails if a route has no explicit decision or if the API-key route list changes.
|
||||
|
||||
Permissions map from OIDC groups (`PM_Admin`, `PM_Buchhaltung`, `PM_Posteingang`, etc.) to the
|
||||
`Permission` enum in `src/auth/permissions.enum.ts`. **This mapping is duplicated in
|
||||
`paperless-frontend/src/auth/permissions.ts` and both copies must list the same group names** —
|
||||
@@ -89,6 +95,9 @@ every authenticated request — do not re-introduce ad-hoc writes to those ident
|
||||
|
||||
Use `@Public()` to bypass auth guards entirely.
|
||||
|
||||
Paperless custom fields 15 (Freigabe) and 16 (Zahlung) may only be set by the matching role —
|
||||
see `src/paperless/status-felder.util.ts`.
|
||||
|
||||
### Database
|
||||
|
||||
- TypeORM with MySQL/MariaDB, UTF8MB4
|
||||
|
||||
Reference in new issue
Block a user