Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Improve cookie security. Fixes #2759 #2763

Merged
merged 2 commits into from
Apr 20, 2020
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
fix: Improve cookie security. Fixes #2759
  • Loading branch information
alexec committed Apr 20, 2020
commit bbace9d703545622efb85600e3b7ef4fe4eac12d
8 changes: 4 additions & 4 deletions ui/src/app/login/components/login.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,24 +15,24 @@ const getToken = () => {

const maybeLoggedIn = () => !!getToken();
const logout = () => {
document.cookie = 'authorization=;';
document.cookie = 'authorization=;Max-Age=0';
document.location.reload(true);
};
const login = (token: string) => {
document.cookie = 'authorization=' + token + ';';
document.cookie = 'authorization=' + token + ';SameSite=Strict' ;
document.location.href = uiUrl('');
};
export const Login = () => (
<Page title='Login' toolbar={{breadcrumbs: [{title: 'Login'}]}}>
<div className='argo-container'>
<p>
<i className='fa fa-info-circle' /> You appear to be logged {maybeLoggedIn() ? 'in' : 'out'}. It may not be necessary to login to use Argo, it depends on how it is
<i className='fa fa-info-circle' /> You appear to be <b>logged {maybeLoggedIn() ? 'in' : 'out'}</b>. It may not be necessary to login to use Argo, it depends on how it is
configured.
</p>
<p>
Get your token using <code>argo auth token</code> and paste in this box.
</p>
<textarea id='token' cols={100} rows={20} defaultValue={getToken()} />
<textarea id='token' cols={100} rows={20} />
<div>
{maybeLoggedIn() && (
<button className='argo-button argo-button--base-o' onClick={() => logout()}>
Expand Down