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
@@ -0,0 +1,35 @@
|
||||
import { describe, expect, it } from "vitest";
|
||||
import { pathOnlyUrl } from "../../lib/server/pathOnlyUrl";
|
||||
|
||||
describe("pathOnlyUrl", () => {
|
||||
it("drops the query string from an absolute URL", () => {
|
||||
expect(
|
||||
pathOnlyUrl(
|
||||
"https://communityrule.info/api/auth/magic-link/verify?token=secret",
|
||||
),
|
||||
).toBe("https://communityrule.info/api/auth/magic-link/verify");
|
||||
});
|
||||
|
||||
it("drops invite tokens and hashes", () => {
|
||||
expect(
|
||||
pathOnlyUrl(
|
||||
"https://communityrule.info/api/invites/rule-stakeholder/verify?token=abc#frag",
|
||||
),
|
||||
).toBe(
|
||||
"https://communityrule.info/api/invites/rule-stakeholder/verify",
|
||||
);
|
||||
});
|
||||
|
||||
it("keeps a share path with no query string", () => {
|
||||
expect(pathOnlyUrl("https://communityrule.info/r/share-slug")).toBe(
|
||||
"https://communityrule.info/r/share-slug",
|
||||
);
|
||||
});
|
||||
|
||||
it("strips a relative URL at the first ? or #", () => {
|
||||
expect(pathOnlyUrl("/create/community-name?facet.size=small")).toBe(
|
||||
"/create/community-name",
|
||||
);
|
||||
expect(pathOnlyUrl("/login#sent")).toBe("/login");
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user