Skip to content

Commit ae1e6a1

Browse files
authored
Merge pull request #2 from dmytrotsko/fix_admin_endpoint_access
Fixed _is_public_route method. Added URL_PREFIX to list of routes
2 parents da947fd + 4732467 commit ae1e6a1

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/server/_security.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
from flask_limiter.util import get_remote_address
99
from werkzeug.local import LocalProxy
1010
from sqlalchemy import Table, Column, String, Integer, Boolean
11-
from ._config import API_KEY_REQUIRED_STARTING_AT, RATELIMIT_STORAGE_URL
11+
from ._config import API_KEY_REQUIRED_STARTING_AT, RATELIMIT_STORAGE_URL, URL_PREFIX
1212
from ._common import app, request, db
1313
from ._exceptions import MissingAPIKeyException, UnAuthenticatedException
1414
from ._db import metadata, TABLE_OPTIONS
@@ -246,7 +246,7 @@ def show_hard_api_key_warning() -> bool:
246246

247247

248248
def _is_public_route() -> bool:
249-
return request.path.startswith("/lib") or request.path.startswith('/admin') or request.path.startswith('/version')
249+
return request.path.startswith(f"{URL_PREFIX}/lib") or request.path.startswith(f'{URL_PREFIX}/admin') or request.path.startswith(f'{URL_PREFIX}/version')
250250

251251
@app.before_request
252252
def resolve_user():

0 commit comments

Comments
 (0)