fix: harden WeKnora proxy and configurable search
This commit is contained in:
1 parent
b527bc94bb
commit
11e54550ed
10 files changed
+721
-72
No files matched your search
@@ -28,6 +28,18 @@ WEKNORA_ROOT_ASSET_PATHS: frozenset[str] = frozenset(
|
||||
"/manifest.webmanifest",
|
||||
}
|
||||
)
|
||||
WEKNORA_STATIC_PATH_PREFIXES: tuple[str, ...] = (
|
||||
"/assets/",
|
||||
"/css/",
|
||||
"/fonts/",
|
||||
"/img/",
|
||||
"/images/",
|
||||
"/js/",
|
||||
"/locales/",
|
||||
"/media/",
|
||||
"/static/",
|
||||
"/tdesign-icons/",
|
||||
)
|
||||
|
||||
|
||||
def _load_weknora_proxy_secret() -> str:
|
||||
@@ -71,9 +83,7 @@ def is_weknora_embed_proxy_path(path: str) -> bool:
|
||||
return (
|
||||
path == "/platform"
|
||||
or path.startswith("/platform/")
|
||||
or path.startswith("/assets/")
|
||||
or path.startswith("/locales/")
|
||||
or path.startswith("/tdesign-icons/")
|
||||
or path.startswith(WEKNORA_STATIC_PATH_PREFIXES)
|
||||
or path in WEKNORA_ROOT_ASSET_PATHS
|
||||
or path.startswith(f"{WEKNORA_EMBED_API_PREFIX}/api/v1/")
|
||||
or (path.startswith("/api/v1/") and not path.startswith("/api/v1/auth/"))
|
||||
|
||||
Reference in new issue
Block a user