Add a content security policy and expire mailed export links.

Responses had no CSP, the 48-hour download token never changed, and short share slugs could be guessed without a miss limit.
This commit is contained in:
adilallo committed 2026-11-21 11:46:16 -07:00
1 parent 0fe2624002
commit 75649a9a42
18 files changed
+249 -19

No files matched your search

+7
View File
@@ -147,11 +147,18 @@ export async function patchOwnedRuleShare(opts: {
shareSlug = await allocateShareSlug();
}
const turningLinkOff =
opts.visibility === RULE_VISIBILITY.private &&
row.visibility !== RULE_VISIBILITY.private;
await prisma.publishedRule.update({
where: { id: row.id },
data: {
visibility: opts.visibility,
shareSlug,
...(turningLinkOff
? { exportTokenVersion: { increment: 1 } }
: {}),
},
});