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
@@ -1,6 +1,7 @@
|
||||
import { afterEach, beforeEach, describe, expect, it } from "vitest";
|
||||
import {
|
||||
getDatabaseUrl,
|
||||
getOpsPruneToken,
|
||||
getSmtpUrl,
|
||||
isDatabaseConfigured,
|
||||
} from "../../lib/server/env";
|
||||
@@ -11,6 +12,7 @@ const ENV_KEYS = [
|
||||
"CLOUDRON_MAIL_SMTP_PORT",
|
||||
"CLOUDRON_MAIL_SMTP_USERNAME",
|
||||
"CLOUDRON_MAIL_SMTP_PASSWORD",
|
||||
"OPS_PRUNE_TOKEN",
|
||||
] as const;
|
||||
|
||||
const ORIGINAL_ENV = Object.fromEntries(
|
||||
@@ -97,3 +99,16 @@ describe("getSmtpUrl", () => {
|
||||
expect(getSmtpUrl()).toBe("smtp://apikey:@smtp.example.com:25");
|
||||
});
|
||||
});
|
||||
|
||||
describe("getOpsPruneToken", () => {
|
||||
it("returns null when unset or blank", () => {
|
||||
expect(getOpsPruneToken()).toBeNull();
|
||||
process.env.OPS_PRUNE_TOKEN = " ";
|
||||
expect(getOpsPruneToken()).toBeNull();
|
||||
});
|
||||
|
||||
it("returns the trimmed token", () => {
|
||||
process.env.OPS_PRUNE_TOKEN = " secret-token ";
|
||||
expect(getOpsPruneToken()).toBe("secret-token");
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user