feat(core): Prevent session hijacking (#9057)

This commit is contained in:
कारतोफ्फेलस्क्रिप्ट™
2024-04-09 11:20:35 +02:00
committed by GitHub
parent 5793e5644a
commit 28261047c3
15 changed files with 124 additions and 53 deletions

View File

@@ -82,6 +82,7 @@ describe('OwnerController', () => {
role: 'global:owner',
authIdentities: [],
});
const browserId = 'test-browser-id';
const req = mock<OwnerRequest.Post>({
body: {
email: 'valid@email.com',
@@ -90,6 +91,7 @@ describe('OwnerController', () => {
lastName: 'Doe',
},
user,
browserId,
});
const res = mock<Response>();
configGetSpy.mockReturnValue(false);
@@ -103,7 +105,7 @@ describe('OwnerController', () => {
where: { role: 'global:owner' },
});
expect(userRepository.save).toHaveBeenCalledWith(user, { transaction: false });
expect(authService.issueCookie).toHaveBeenCalledWith(res, user);
expect(authService.issueCookie).toHaveBeenCalledWith(res, user, browserId);
});
});
});