Pentest 70.2 (LOW): 500 statt 415 bei verbotenem MIME
Globaler Error-Handler (index.ts:461) matcht /sind erlaubt|nicht erlaubt/i auf 415. Die 70.1-Reject-Message "... WebP erlaubt" (ohne "sind") rutschte durch und landete bei 500 + Error-Log-Spam. Fix: "... WebP-Dateien sind erlaubt" macht den Regex happy. Andere Routes nutzen alle schon dieselbe Phrase.
This commit is contained in:
@@ -29,7 +29,7 @@ const docUpload = multer({
|
|||||||
// Magic-Byte-Check in validateUploadedFile.
|
// Magic-Byte-Check in validateUploadedFile.
|
||||||
const allowed = ['application/pdf', 'image/jpeg', 'image/jpg', 'image/png', 'image/gif', 'image/webp'];
|
const allowed = ['application/pdf', 'image/jpeg', 'image/jpg', 'image/png', 'image/gif', 'image/webp'];
|
||||||
if (allowed.includes(file.mimetype)) cb(null, true);
|
if (allowed.includes(file.mimetype)) cb(null, true);
|
||||||
else cb(new Error('Nur PDF, JPG, PNG, GIF oder WebP erlaubt'));
|
else cb(new Error('Nur PDF, JPG, PNG, GIF oder WebP-Dateien sind erlaubt'));
|
||||||
},
|
},
|
||||||
limits: { fileSize: 10 * 1024 * 1024 },
|
limits: { fileSize: 10 * 1024 * 1024 },
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -97,6 +97,17 @@ isolierte Instanz (keine Multi-Tenancy im Code), Provisioning + Abrechnung
|
|||||||
|
|
||||||
## ✅ Erledigt
|
## ✅ Erledigt
|
||||||
|
|
||||||
|
- [x] **🔒 Pentest 70.2 (LOW): falscher 500 statt 415 bei verbotenem MIME-Type**
|
||||||
|
- Globaler Error-Handler in `index.ts:461` matcht
|
||||||
|
`/sind erlaubt|nicht erlaubt/i` und mappt auf 415. Meine 70.1-
|
||||||
|
Message „… WebP erlaubt" (ohne „sind") rutschte durch und landete
|
||||||
|
bei 500 + Error-Log-Spam.
|
||||||
|
- Fix: 1 Zeile in `contract.routes.ts` – `… WebP-Dateien sind
|
||||||
|
erlaubt` macht den Regex glücklich. Andere Routes
|
||||||
|
(`upload.routes.ts`, `gdpr.routes.ts`, `pdfTemplate.routes.ts`,
|
||||||
|
`factoryDefaults.routes.ts`, `appSetting.routes.ts`) nutzen alle
|
||||||
|
schon „sind erlaubt".
|
||||||
|
|
||||||
- [x] **🔒 Pentest 70.1 (INFO): GIF/WebP-Inkonsistenz in contract.routes Multer-Filter**
|
- [x] **🔒 Pentest 70.1 (INFO): GIF/WebP-Inkonsistenz in contract.routes Multer-Filter**
|
||||||
- `contract.routes.ts` Vertragsdokumente: Multer-fileFilter blockte
|
- `contract.routes.ts` Vertragsdokumente: Multer-fileFilter blockte
|
||||||
`image/gif` und `image/webp`, obwohl `validateUploadedFile` beide
|
`image/gif` und `image/webp`, obwohl `validateUploadedFile` beide
|
||||||
|
|||||||
Reference in New Issue
Block a user