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.

This commit is contained in:
Torsten Schulz (local)
2026-01-05 11:50:57 +01:00
parent 51214c8964
commit 5ce064cff0
47 changed files with 1738 additions and 83 deletions

View File

@@ -0,0 +1,34 @@
export function toBase64Url(buf) {
if (buf == null) return ''
if (typeof buf === 'string') return buf
const b = Buffer.isBuffer(buf) ? buf : Buffer.from(buf)
// Node supports 'base64url' on recent versions; keep fallback for safety.
try {
return b.toString('base64url')
} catch {
return b
.toString('base64')
.replace(/\+/g, '-')
.replace(/\//g, '_')
.replace(/=+$/g, '')
}
}
export function fromBase64Url(s) {
if (!s) return Buffer.alloc(0)
// Node supports 'base64url' on recent versions; keep fallback for safety.
try {
return Buffer.from(String(s), 'base64url')
} catch {
let v = String(s).replace(/-/g, '+').replace(/_/g, '/')
while (v.length % 4) v += '='
return Buffer.from(v, 'base64')
}
}
export function parseClientDataJSON(clientDataJSONB64Url) {
const json = fromBase64Url(clientDataJSONB64Url).toString('utf8')
return JSON.parse(json)
}