Skip to content

Commit d49247e

Browse files
authored
Remove the undocumented login-with-token page (#8336)
There are several problems with this feature: 1. To use it, you have to put the user's token in the URL. This token lasts forever (unless the user explicitly logs out), so it is nearly as sensitive as the user's password. Embedding such sensitive information in the URL is problematic, because URLs are saved in the browser history, dumped to server logs and displayed on the screen, none of which are secure locations. A user could also accidentally share a URL with an embedded token. 2. If an attacker can get a user to follow a malicious link, they could forcibly log that user into the attacker's account (AKA "login CSRF"). This by itself is just a nuisance, but the attacker could potentially use this to trick the victim into, for example, uploading confidential data to the attacker's account. 3. By design, it requires the use of token authentication, whose drawbacks I have explained in #8289. In fairness, when originally implemented, this feature set the session cookie rather than the token, but this cannot work if the user is already logged in, as the `sessionid` cookie is marked `HTTPOnly` and cannot be overridden by JavaScript. So the only way for this feature to work in all circumstances is to set the token. Generally, the use cases of this feature are better served by single sign-on protocols, which don't suffer from these drawbacks.
1 parent 9393681 commit d49247e

File tree

5 files changed

+5
-55
lines changed

5 files changed

+5
-55
lines changed
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
### Removed
2+
3+
- Removed the `/auth/login-with-token` page
4+
(<https://github.com/cvat-ai/cvat/pull/8336>)

cvat-ui/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "cvat-ui",
3-
"version": "1.64.6",
3+
"version": "1.65.0",
44
"description": "CVAT single-page application",
55
"main": "src/index.tsx",
66
"scripts": {

cvat-ui/src/components/cvat-app.tsx

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ import Text from 'antd/lib/typography/Text';
1717

1818
import LogoutComponent from 'components/logout-component';
1919
import LoginPageContainer from 'containers/login-page/login-page';
20-
import LoginWithTokenComponent from 'components/login-with-token/login-with-token';
2120
import RegisterPageContainer from 'containers/register-page/register-page';
2221
import ResetPasswordPageConfirmComponent from 'components/reset-password-confirm-page/reset-password-confirm-page';
2322
import ResetPasswordPageComponent from 'components/reset-password-page/reset-password-page';
@@ -501,11 +500,6 @@ class CVATApplication extends React.PureComponent<CVATAppProps & RouteComponentP
501500
<Layout.Content style={{ height: '100%' }}>
502501
<ShortcutsDialog />
503502
<Switch>
504-
<Route
505-
exact
506-
path='/auth/login-with-token/:token'
507-
component={LoginWithTokenComponent}
508-
/>
509503
<Route exact path='/auth/logout' component={LogoutComponent} />
510504
<Route exact path='/projects' component={ProjectsPageComponent} />
511505
<Route exact path='/projects/create' component={CreateProjectPageComponent} />
@@ -590,11 +584,6 @@ class CVATApplication extends React.PureComponent<CVATAppProps & RouteComponentP
590584
<Route exact path='/auth/email-verification-sent' component={EmailVerificationSentPage} />
591585
<Route exact path='/auth/incorrect-email-confirmation' component={IncorrectEmailConfirmationPage} />
592586
<Route exact path='/auth/login' component={LoginPageContainer} />
593-
<Route
594-
exact
595-
path='/auth/login-with-token/:token'
596-
component={LoginWithTokenComponent}
597-
/>
598587
{isPasswordResetEnabled && (
599588
<Route exact path='/auth/password/reset' component={ResetPasswordPageComponent} />
600589
)}

cvat-ui/src/components/login-with-token/login-with-token.tsx

Lines changed: 0 additions & 25 deletions
This file was deleted.

tests/cypress/e2e/actions_users/issue_1810_login_logout.js

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -58,24 +58,6 @@ context('When clicking on the Logout button, get the user session closed.', () =
5858
cy.contains('.cvat-task-details-task-name', `${taskName}`).should('be.visible');
5959
});
6060

61-
it('Logout and login to task via token', () => {
62-
cy.logout();
63-
// get token and login to task
64-
cy.request({
65-
method: 'POST',
66-
url: '/api/auth/login',
67-
body: {
68-
username: Cypress.env('user'),
69-
email: Cypress.env('email'),
70-
password: Cypress.env('password'),
71-
},
72-
}).then(async (response) => {
73-
const token = response.body.key;
74-
cy.visit(`/auth/login-with-token/${token}?next=/tasks/${taskId}`);
75-
cy.contains('.cvat-task-details-task-name', `${taskName}`).should('be.visible');
76-
});
77-
});
78-
7961
it('Login via email', () => {
8062
cy.logout();
8163
login(Cypress.env('email'), Cypress.env('password'));

0 commit comments

Comments
 (0)