feat(security): implement IP verification and encryption for sensitive tokens

This commit is contained in:
2026-09-11 13:17:12 +02:00
parent c3001cdd0a
commit 55618ffaed
10 changed files with 437 additions and 20 deletions
+21
View File
@@ -137,3 +137,24 @@ function fociz_cache_delete_pattern(string $prefix): bool {
return false;
}
}
/**
* Verwijdert alle verlopen items actief uit de cache tabel (AVG/GDPR opschoning)
*/
function fociz_cache_cleanup_expired(?PDO $db = null): int {
try {
$pdo = $db ?: get_db_connection();
ensure_app_cache_table($pdo);
$stmt = $pdo->prepare("DELETE FROM app_cache WHERE expires_at < ?");
$stmt->execute([time()]);
return $stmt->rowCount();
} catch (Throwable $e) {
error_log("fociz_cache_cleanup_expired error: " . $e->getMessage());
return 0;
}
}
// Probabilistische automatische GC (5% kans bij elke script execution)
if (mt_rand(1, 20) === 1) {
fociz_cache_cleanup_expired();
}