Warenwirtschaft: OPT-9 AuthZ/CSRF-Härtung (Audit M-2, M-3, M-6, M-7, M-10)

- M-2: Produktionen buchen Bestand — StoreProductionRequest verlangt
  jetzt admin >= 7 (wie manuelle Bestandsbewegungen); create/edit/copy
  im Controller gegated, UI-Buttons für niedrigere Stufen ausgeblendet.
- M-3: Ausschuss-/Bewegungs-/Produktions-Buttons nur noch für
  Berechtigte sichtbar (keine toten Formulare mehr).
- M-6: Zustandsändernde GET-Routen umgestellt — stock-entries/copy
  jetzt POST mit CSRF; /admin/product/delete jetzt DELETE-Formulare
  (Produktliste + Rezeptur-Zeile im Produktformular).
- M-7: ProductController::imageAttribute whitelistet Spalten
  ('active', 'pos') + numerische Werte, sonst 400 — kein beliebiger
  Spalten-Write per URL mehr.
- M-10: URL-Felder (Lieferant, Verpackungsartikel, INCI-Lieferanten-
  Repeater) validieren url:http,https — keine speicherbaren
  javascript:-Links mehr.

Tests: ProductionHardeningTest +2; drei bestehende Tests an neue
Regeln angepasst (admin-Level 7 für Produktions-Formular, POST-Copy).
Suite: 231 grün.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Kevin Adametz 2026-07-15 12:55:11 +00:00
parent fa44af0a1f
commit 9ed47c02f3
19 changed files with 104 additions and 41 deletions

View file

@ -169,7 +169,7 @@ test('copy creates pending duplicate without receiving data', function () {
$this->actingAs($admin, 'user');
$this->get(route('admin.inventory.stock-entries.copy', $source))
$this->post(route('admin.inventory.stock-entries.copy', $source))
->assertRedirect();
$copy = StockEntry::query()->where('status', 'pending')->latest('id')->firstOrFail();
@ -198,6 +198,6 @@ test('copy is blocked for non admin', function () {
$this->actingAs($copyreader->fresh(), 'user');
$this->get(route('admin.inventory.stock-entries.copy', $source))
$this->post(route('admin.inventory.stock-entries.copy', $source))
->assertRedirect(route('home'));
});