Pentest 2026-05-20 MEDIUM+LOW Follow-ups
MEDIUM – Consent-Mass-Assignment:
PUT /api/gdpr/customer/:id/consents/:type nahm source/documentPath/
version ungefiltert aus dem Body. Portal-User konnte
source="ADMIN_OVERRIDE", version="<script>" oder
documentPath="../../etc/passwd" durchschmuggeln.
Fix: nur status aus Body, source server-seitig auf "portal"
hardcoded, documentPath/version bleiben NULL (werden dediziert
vom Authorization-Upload server-seitig gesetzt). Whitelist
ALLOWED_CONSENT_SOURCES für source-Werte. grantAuthorization
(Admin) erzwingt die Whitelist ebenfalls; notes läuft jetzt
durch stripHtml.
LOW – javascript:-URI in companyName:
stripHtml() entfernte HTML-Tags, ließ aber javascript:/data:/
vbscript:-Schemata stehen. companyName="javascript:alert(1)"
hätte in <a href={companyName}> aktiv werden können.
Fix: stripHtml ersetzt jene Schemata mit "blocked:" – legitimer
Text bleibt unangetastet, das Schema wird unschädlich.
LOW – documentPath ohne Validierung:
Bereits durch obigen Consent-Fix erledigt; Cleanup-Pass strippt
zusätzlich vorhandene dreckige Pfade.
cleanup-xss-and-mass-assignment.ts: neue cleanupConsents() läuft
beim Container-Start, normalisiert source per Whitelist auf
"unknown" + stripHtml über version/documentPath.
Live-verifiziert auf dev (alle drei Payloads geblockt + Cleanup
auf dirty DB greift).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -3,6 +3,24 @@ import prisma from '../lib/prisma.js';
|
||||
import fs from 'fs';
|
||||
import path from 'path';
|
||||
|
||||
// Whitelist legitimer Werte für CustomerConsent.source. Schema-Kommentar:
|
||||
// "portal", "telefon", "papier", "email". Public-Link-Flow nutzt
|
||||
// 'public-link', CRM-Backend-Override 'crm-backend'. Alles andere
|
||||
// (z.B. "ADMIN_OVERRIDE", "<script>") wird abgelehnt – Pentest 2026-05-20.
|
||||
export const ALLOWED_CONSENT_SOURCES: ReadonlySet<string> = new Set([
|
||||
'portal',
|
||||
'public-link',
|
||||
'telefon',
|
||||
'papier',
|
||||
'email',
|
||||
'crm-backend',
|
||||
]);
|
||||
|
||||
export function sanitizeConsentSource(value: unknown, fallback: string): string {
|
||||
const v = typeof value === 'string' ? value : '';
|
||||
return ALLOWED_CONSENT_SOURCES.has(v) ? v : fallback;
|
||||
}
|
||||
|
||||
export interface UpdateConsentData {
|
||||
status: ConsentStatus;
|
||||
source?: string;
|
||||
|
||||
Reference in New Issue
Block a user