Refactor sessions to frequently rotate
In order to minimise the window of opportunity to steal a session, automatically rotate it onto a new session on a frequent basis. This makes a session cookie older than the automatic rollover time less likely to grant access and more likely to be detected. Should a stolen session cookie get rotated while the attacker is using it, the user will be notificed that their session has been taken the next time they open the app if the user re-visits the website before the session is discarded.
This commit is contained in:
parent
d9b78bff69
commit
1775fac5fd
18 changed files with 168 additions and 73 deletions
|
@ -11,7 +11,7 @@ const subscriptionSchema = z.strictObject({
|
|||
});
|
||||
|
||||
export default defineEventHandler(async (event) => {
|
||||
const session = await requireServerSession(event);
|
||||
const session = await requireServerSessionWithUser(event);
|
||||
const { success, error, data: body } = subscriptionSchema.safeParse(await readBody(event));
|
||||
if (!success) {
|
||||
throw createError({
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue