Delete unused login and invite tokens on a daily job, and keep their URLs out of logs.
Expired sign-in, save-progress, email-change, and invitation tokens (and any draft they carry) are cleared by a Cloudron scheduler task. Page timing logs record the path without the query string, and mail failures log a request id instead of an address.
This commit is contained in:
1 parent
73d0856004
commit
46c34a6323
28 files changed
+636
-45
No files matched your search
@@ -7,11 +7,11 @@ import {
|
||||
import { rateLimitKey } from "./rateLimit";
|
||||
import { logger } from "../logger";
|
||||
import {
|
||||
WORKSHOP_INQUIRY_RETENTION_MS,
|
||||
WORKSHOP_MIN_FILL_MS,
|
||||
suggestWorkshopRoute,
|
||||
type WorkshopFormValues,
|
||||
} from "../workshopSignup";
|
||||
import { deleteExpiredWorkshopInquiries } from "./pruneExpiredRecords";
|
||||
import {
|
||||
parseWorkshopSignupPayload,
|
||||
type ParsedWorkshopSignup,
|
||||
@@ -223,9 +223,5 @@ export async function retryPendingWorkshopInquiryMail(): Promise<number> {
|
||||
/** Delete inquiries older than the retention period. */
|
||||
export async function purgeExpiredWorkshopInquiries(now = new Date()): Promise<number> {
|
||||
if (!isDatabaseConfigured()) return 0;
|
||||
const cutoff = new Date(now.getTime() - WORKSHOP_INQUIRY_RETENTION_MS);
|
||||
const result = await prisma.workshopInquiry.deleteMany({
|
||||
where: { createdAt: { lt: cutoff } },
|
||||
});
|
||||
return result.count;
|
||||
return deleteExpiredWorkshopInquiries(prisma, now);
|
||||
}
|
||||
Reference in new issue
Block a user