mirror of
https://github.com/tdurieux/anonymous_github.git
synced 2026-10-21 15:02:39 +02:00
Merge commit 'refs/security-review/pr849' into HEAD
# Conflicts: # src/server/service/review-consent-http.ts
This commit is contained in:
commit
eb4fbb6b15
165 files changed
+16267
-22725
No files matched your search
@@ -188,6 +188,25 @@ export function createReviewConsentRouter(
|
||||
}
|
||||
});
|
||||
router.use(express.json({ limit: 12288, strict: true, inflate: false }));
|
||||
// Uploads can outlive the session checked before body parsing. Revalidate
|
||||
// before any provider call or consent write, not only before the response.
|
||||
router.use(async (req, res, next) => {
|
||||
try {
|
||||
const actor = res.locals.consentActor as Context;
|
||||
const fresh = await current(req);
|
||||
if (res.destroyed || res.headersSent || res.locals.consentSignal.aborted)
|
||||
return;
|
||||
if (
|
||||
!fresh ||
|
||||
fresh.accountId !== actor.accountId ||
|
||||
fresh.sessionId !== actor.sessionId
|
||||
)
|
||||
return reject(res, 401, "unauthorized");
|
||||
next();
|
||||
} catch {
|
||||
reject(res, 503, "unavailable");
|
||||
}
|
||||
});
|
||||
router.post(["/preview", "/confirm", "/handoff"], async (req, res) => {
|
||||
const actor = res.locals.consentActor as Context;
|
||||
try {
|
||||
|
||||
Reference in new issue
Block a user