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:
1 parent
0fe2624002
commit
75649a9a42
18 files changed
+249
-19
No files matched your search
@@ -52,6 +52,7 @@ export const GET = apiRoute<RouteContext>(
|
||||
document: true,
|
||||
createdAt: true,
|
||||
userId: true,
|
||||
exportTokenVersion: true,
|
||||
},
|
||||
});
|
||||
if (!row) return notFound();
|
||||
@@ -60,7 +61,12 @@ export const GET = apiRoute<RouteContext>(
|
||||
let tokenOk = false;
|
||||
if (token.length > 0) {
|
||||
try {
|
||||
tokenOk = ruleExportTokenMatches(row.id, token, getSessionPepper());
|
||||
tokenOk = ruleExportTokenMatches(
|
||||
row.id,
|
||||
token,
|
||||
getSessionPepper(),
|
||||
row.exportTokenVersion,
|
||||
);
|
||||
} catch {
|
||||
tokenOk = false;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user