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 all commits
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
10 changes: 5 additions & 5 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
configured.
<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.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes - but not today :(

</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