Added whitelist for locales path.

This commit is contained in:
Marco Rodolfi
2023-01-29 17:42:32 +01:00
parent 92e3cc7790
commit eaf7239dd1
3 changed files with 7 additions and 7 deletions
+1 -1
View File
@@ -32,7 +32,7 @@ def get_csrf_token():
@middleware
async def csrf_middleware(request, handler):
if str(request.method) == "OPTIONS" or request.headers.get('Authentication') == csrf_token or str(request.rel_url) == "/auth/token" or str(request.rel_url).startswith("/plugins/load_main/") or str(request.rel_url).startswith("/static/") or str(request.rel_url).startswith("/legacy/") or str(request.rel_url).startswith("/steam_resource/") or str(request.rel_url).startswith("/frontend/") or assets_regex.match(str(request.rel_url)) or frontend_regex.match(str(request.rel_url)):
if str(request.method) == "OPTIONS" or request.headers.get('Authentication') == csrf_token or str(request.rel_url) == "/auth/token" or str(request.rel_url).startswith("/plugins/load_main/") or str(request.rel_url).startswith("/static/") or str(request.rel_url).startswith("/locales/") or str(request.rel_url).startswith("/legacy/") or str(request.rel_url).startswith("/steam_resource/") or str(request.rel_url).startswith("/frontend/") or assets_regex.match(str(request.rel_url)) or frontend_regex.match(str(request.rel_url)):
return await handler(request)
return Response(text='Forbidden', status='403')
+1 -1
View File
@@ -47,7 +47,7 @@
"i18next-http-backend": "^2.1.1",
"i18next-browser-languagedetector": "^7.0.1",
"react-file-icon": "^1.2.0",
"react-i18next": "^12.0.0",
"react-i18next": "^12.1.4",
"react-icons": "^4.4.0",
"react-markdown": "^8.0.3",
"remark-gfm": "^3.0.1"
+5 -5
View File
@@ -23,7 +23,7 @@ specifiers:
react: 16.14.0
react-dom: 16.14.0
react-file-icon: ^1.2.0
react-i18next: ^12.0.0
react-i18next: ^12.1.4
react-icons: ^4.4.0
react-markdown: ^8.0.3
remark-gfm: ^3.0.1
@@ -40,7 +40,7 @@ dependencies:
i18next-browser-languagedetector: 7.0.1
i18next-http-backend: 2.1.1
react-file-icon: 1.2.0_wcqkhtmu7mswc6yz4uyexck3ty
react-i18next: 12.0.0_goxgninut6ie3oe2kpsp3ellgm
react-i18next: 12.1.4_goxgninut6ie3oe2kpsp3ellgm
react-icons: 4.4.0_react@16.14.0
react-markdown: 8.0.3_vshvapmxg47tngu7tvrsqpq55u
remark-gfm: 3.0.1
@@ -2211,8 +2211,8 @@ packages:
tinycolor2: 1.4.2
dev: false
/react-i18next/12.0.0_goxgninut6ie3oe2kpsp3ellgm:
resolution: {integrity: sha512-/O7N6aIEAl1FaWZBNvhdIo9itvF/MO/nRKr9pYqRc9LhuC1u21SlfwpiYQqvaeNSEW3g3qUXLREOWMt+gxrWbg==}
/react-i18next/12.1.4_goxgninut6ie3oe2kpsp3ellgm:
resolution: {integrity: sha512-XQND7jYtgM7ht5PH3yIZljCRpAMTlH/zmngM9ZjToqa+0BR6xuu8c7QF0WIIOEjcMTB2S3iOfpN/xG/ZrAnO6g==}
peerDependencies:
i18next: '>= 19.0.0'
react: '>= 16.8.0'
@@ -2224,7 +2224,7 @@ packages:
react-native:
optional: true
dependencies:
'@babel/runtime': 7.20.1
'@babel/runtime': 7.20.13
html-parse-stringify: 3.0.1
i18next: 22.4.9
react: 16.14.0