Update Apache SSL configuration and enhance security features across multiple files. Changed X-Frame-Options to SAMEORIGIN for better security, added optional Content Security Policy headers for testing, and improved password handling with HaveIBeenPwned checks during user registration and password reset. Implemented passkey login functionality in the authentication flow, including UI updates for user experience. Enhanced image upload processing with size limits and validation, and added rate limiting for various API endpoints to prevent abuse.
Some checks failed
Code Analysis (JS/Vue) / analyze (push) Failing after 51s
Some checks failed
Code Analysis (JS/Vue) / analyze (push) Failing after 51s
This commit is contained in:
21
server/utils/upload-validation.js
Normal file
21
server/utils/upload-validation.js
Normal file
@@ -0,0 +1,21 @@
|
||||
import fs from 'fs/promises'
|
||||
|
||||
export async function assertPdfMagicHeader(filePath) {
|
||||
const fh = await fs.open(filePath, 'r')
|
||||
try {
|
||||
const buf = Buffer.alloc(5)
|
||||
await fh.read(buf, 0, 5, 0)
|
||||
const header = buf.toString('utf8')
|
||||
if (header !== '%PDF-') {
|
||||
throw createError({ statusCode: 400, statusMessage: 'Ungültige Datei: kein PDF' })
|
||||
}
|
||||
} finally {
|
||||
await fh.close()
|
||||
}
|
||||
}
|
||||
|
||||
export function clamp(n, min, max) {
|
||||
return Math.max(min, Math.min(max, n))
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user