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

This commit is contained in:
Torsten Schulz (local)
2026-01-05 11:50:57 +01:00
parent 8bd7ed76cd
commit 673c34ac9d
47 changed files with 1738 additions and 83 deletions

View File

@@ -0,0 +1,46 @@
const regChallenges = globalThis.__HTC_WEBAUTHN_REG_CHALLENGES__ || new Map()
const authChallenges = globalThis.__HTC_WEBAUTHN_AUTH_CHALLENGES__ || new Map()
globalThis.__HTC_WEBAUTHN_REG_CHALLENGES__ = regChallenges
globalThis.__HTC_WEBAUTHN_AUTH_CHALLENGES__ = authChallenges
function nowMs() {
return Date.now()
}
function cleanup(map) {
const now = nowMs()
for (const [k, v] of map.entries()) {
if (!v || !v.expiresAt || v.expiresAt <= now) map.delete(k)
}
}
export function setRegistrationChallenge(userId, challenge, ttlMs = 5 * 60 * 1000) {
cleanup(regChallenges)
regChallenges.set(String(userId), { challenge, expiresAt: nowMs() + ttlMs })
}
export function getRegistrationChallenge(userId) {
cleanup(regChallenges)
const v = regChallenges.get(String(userId))
return v?.challenge || null
}
export function clearRegistrationChallenge(userId) {
regChallenges.delete(String(userId))
}
export function setAuthChallenge(challenge, ttlMs = 5 * 60 * 1000) {
cleanup(authChallenges)
authChallenges.set(String(challenge), { expiresAt: nowMs() + ttlMs })
}
export function consumeAuthChallenge(challenge) {
cleanup(authChallenges)
const key = String(challenge)
const v = authChallenges.get(key)
if (!v) return false
authChallenges.delete(key)
return true
}