Skip to content

Commit

Permalink
fix: Explicitly set SameSite=Lax for SingleInstanceHandler cookie (W…
Browse files Browse the repository at this point in the history
  • Loading branch information
Yserz committed Jun 3, 2020
1 parent 4ab68dd commit 5b9f2cd
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
8 changes: 7 additions & 1 deletion src/script/main/SingleInstanceHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,13 @@ export class SingleInstanceHandler {
if (!!Cookies.get(cookieName)) {
return false;
}
Cookies.set(cookieName, {appInstanceId: this.instanceId});
Cookies.set(
cookieName,
{appInstanceId: this.instanceId},
{
sameSite: 'Lax',
},
);
if (this.onOtherInstanceStarted) {
this._startSingleInstanceCheck();
}
Expand Down
8 changes: 7 additions & 1 deletion test/unit_tests/main/SingleInstanceHandlerSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,13 @@ describe('SingleInstanceHandler', () => {
spyOn(Cookies, 'set').and.returnValue(undefined);
const result = singleInstanceHandler.registerInstance(instanceId);

expect(Cookies.set).toHaveBeenCalledWith('app_opened', {appInstanceId: instanceId});
expect(Cookies.set).toHaveBeenCalledWith(
'app_opened',
{appInstanceId: instanceId},
{
sameSite: 'Lax',
},
);
expect(result).toBe(true);
});

Expand Down

0 comments on commit 5b9f2cd

Please sign in to comment.