Merge branch 'worktree-iso-phase-4' into macros
This commit is contained in:
@@ -555,11 +555,13 @@ def mount_io_endpoint(app: Any, service_name: str) -> None:
|
||||
from .jinja_bridge import _get_request_context
|
||||
from .parser import serialize
|
||||
|
||||
# Allowlist of IO primitives + page helpers the client may call
|
||||
_ALLOWED_IO = {
|
||||
"highlight", "current-user", "request-arg", "request-path",
|
||||
"htmx-request?", "app-url", "asset-url", "config",
|
||||
}
|
||||
# Build allowlist from all component IO refs across this service
|
||||
from .jinja_bridge import _COMPONENT_ENV
|
||||
from .types import Component as _Comp
|
||||
_ALLOWED_IO: set[str] = set()
|
||||
for _val in _COMPONENT_ENV.values():
|
||||
if isinstance(_val, _Comp) and _val.io_refs:
|
||||
_ALLOWED_IO.update(_val.io_refs)
|
||||
|
||||
async def io_proxy(name: str) -> Any:
|
||||
if name not in _ALLOWED_IO:
|
||||
@@ -607,4 +609,4 @@ def mount_io_endpoint(app: Any, service_name: str) -> None:
|
||||
view_func=io_proxy,
|
||||
methods=["GET", "POST"],
|
||||
)
|
||||
logger.info("Mounted IO proxy endpoint for %s at /sx/io/<name>", service_name)
|
||||
logger.info("Mounted IO proxy for %s: %s", service_name, sorted(_ALLOWED_IO))
|
||||
|
||||
Reference in New Issue
Block a user