mirror of
https://github.com/donaldzou/WGDashboard.git
synced 2026-04-03 03:16:18 +00:00
Fixed where /api/clients paths are bypassed
Instead of adding `/client` in the white list, we isolate it out to check if the path starts with `APP_PREFIX/client` so then client will bypassed but not `/api/clients`
This commit is contained in:
@@ -249,12 +249,14 @@ def auth_req():
|
|||||||
whiteList = [
|
whiteList = [
|
||||||
'/static/', 'validateAuthentication', 'authenticate', 'getDashboardConfiguration',
|
'/static/', 'validateAuthentication', 'authenticate', 'getDashboardConfiguration',
|
||||||
'getDashboardTheme', 'getDashboardVersion', 'sharePeer/get', 'isTotpEnabled', 'locale',
|
'getDashboardTheme', 'getDashboardVersion', 'sharePeer/get', 'isTotpEnabled', 'locale',
|
||||||
'/client'
|
|
||||||
]
|
]
|
||||||
|
appPrefix = APP_PREFIX if len(APP_PREFIX) > 0 else ''
|
||||||
|
clientPrefix = f"{appPrefix}/client"
|
||||||
|
|
||||||
if (("username" not in session or session.get("role") != "admin")
|
if (("username" not in session or session.get("role") != "admin")
|
||||||
and (f"{(APP_PREFIX if len(APP_PREFIX) > 0 else '')}/" != request.path
|
and (f"{appPrefix}/" != request.path
|
||||||
and f"{(APP_PREFIX if len(APP_PREFIX) > 0 else '')}" != request.path)
|
and f"{appPrefix}" != request.path)
|
||||||
|
and not request.path.startswith(clientPrefix)
|
||||||
and len(list(filter(lambda x : x not in request.path, whiteList))) == len(whiteList)
|
and len(list(filter(lambda x : x not in request.path, whiteList))) == len(whiteList)
|
||||||
):
|
):
|
||||||
response = Flask.make_response(app, {
|
response = Flask.make_response(app, {
|
||||||
|
|||||||
Reference in New Issue
Block a user