Skip to content

Commit 45999ba

Browse files
committed
(security) use POST for logout rather than GET
see GHSA-m49f-hcxp-6hm6
1 parent 22a8b2b commit 45999ba

File tree

3 files changed

+18
-5
lines changed

3 files changed

+18
-5
lines changed

SECURITY.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ The following versions of Pterodactyl are receiving active support and maintenan
1111

1212
## Reporting a Vulnerability
1313

14-
Please reach out directly to any project team member on Discord when reporting a security vulnerability, or you can send an email to `dane [ät] pterodactyl.io`.
14+
Please reach out directly to any project team member on Discord when reporting a security vulnerability, or you can send an email to `dane@pterodactyl.io`.
1515

1616
We make every effort to respond as soon as possible, although it may take a day or two for us to sync internally and determine the severity of the report and its impact. Please, _do not_ use a public facing channel or GitHub issues to report sensitive security issues.
1717

resources/scripts/components/NavigationBar.tsx

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@ import { ApplicationStore } from '@/state';
77
import SearchContainer from '@/components/dashboard/search/SearchContainer';
88
import tw, { theme } from 'twin.macro';
99
import styled from 'styled-components/macro';
10+
import http from '@/api/http';
11+
import SpinnerOverlay from '@/components/elements/SpinnerOverlay';
12+
import { useState } from 'react';
1013

1114
const Navigation = styled.div`
1215
${tw`w-full bg-neutral-900 shadow-md overflow-x-auto`};
@@ -27,7 +30,7 @@ const Navigation = styled.div`
2730
const RightNavigation = styled.div`
2831
${tw`flex h-full items-center justify-center`};
2932
30-
& > a, & > .navigation-link {
33+
& > a, & > button, & > .navigation-link {
3134
${tw`flex items-center h-full no-underline text-neutral-300 px-6 cursor-pointer transition-all duration-150`};
3235
3336
&:active, &:hover {
@@ -43,9 +46,19 @@ const RightNavigation = styled.div`
4346
export default () => {
4447
const name = useStoreState((state: ApplicationStore) => state.settings.data!.name);
4548
const rootAdmin = useStoreState((state: ApplicationStore) => state.user.data!.rootAdmin);
49+
const [ isLoggingOut, setIsLoggingOut ] = useState(false);
50+
51+
const onTriggerLogout = () => {
52+
setIsLoggingOut(true);
53+
http.post('/auth/logout').finally(() => {
54+
// @ts-ignore
55+
window.location = '/';
56+
});
57+
};
4658

4759
return (
4860
<Navigation>
61+
<SpinnerOverlay visible={isLoggingOut} />
4962
<div css={tw`mx-auto w-full flex items-center`} style={{ maxWidth: '1200px', height: '3.5rem' }}>
5063
<div id={'logo'}>
5164
<Link to={'/'}>
@@ -65,9 +78,9 @@ export default () => {
6578
<FontAwesomeIcon icon={faCogs}/>
6679
</a>
6780
}
68-
<a href={'/auth/logout'}>
81+
<button onClick={onTriggerLogout}>
6982
<FontAwesomeIcon icon={faSignOutAlt}/>
70-
</a>
83+
</button>
7184
</RightNavigation>
7285
</div>
7386
</Navigation>

routes/auth.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,4 +48,4 @@
4848
| Endpoint: /auth
4949
|
5050
*/
51-
Route::get('/logout', 'LoginController@logout')->name('auth.logout')->middleware('auth');
51+
Route::post('/logout', 'LoginController@logout')->name('auth.logout')->middleware('auth', 'csrf');

0 commit comments

Comments
 (0)