Refuse names that are not names at the store boundary

DELETE /flows/%2e%2e reached FlowStore.delete_flow(".."), which removed
the data directory, and /flows/_lib removed every shared node. Every
path the flow and dashboard stores build from a flow, node, library or
dashboard name now goes through checked(), which raises InvalidName
(400) for anything _validate_name refuses. _validate_name uses
fullmatch, so a trailing newline is refused too.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_013GAeg4Jo6xjZzjwy9QDWMQ
This commit is contained in:
2026-10-06 11:59:25 +02:00
co-authored by Claude Opus 5.5
parent 48b87cc16e
commit 7ffdb1a3bf
5 changed files with 115 additions and 10 deletions
+7 -1
View File
@@ -49,7 +49,7 @@ from fluksio.flow.resources import (
from fluksio.flow.runs import RUN_STATE_TTL, RunService, sweep_artifacts
from fluksio.flow.secrets import init_secrets
from fluksio.flow.state import MemoryState, RedisState, StateBackend
from fluksio.flow.store import FlowStore
from fluksio.flow.store import FlowStore, InvalidName
from fluksio.flow.watchdog import LoopWatchdog
from fluksio.flow.workers import PythonWorkerPool
@@ -436,6 +436,12 @@ if settings.all_cors_origins:
app.include_router(api_router, prefix=settings.API_V1_STR)
@app.exception_handler(InvalidName)
async def invalid_name(request: Request, exc: InvalidName) -> JSONResponse: # noqa: ARG001
"""A flow, node, library or dashboard name no store will turn into a path."""
return JSONResponse(status_code=400, content={"detail": str(exc)})
@app.exception_handler(RebuildBusy)
async def rebuild_busy(request: Request, exc: RebuildBusy) -> JSONResponse: # noqa: ARG001
"""Every route that deploys something answers a wedged rebuild the same way.