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:
@@ -26,7 +26,7 @@ from pydantic import BaseModel, Field, field_validator, model_validator
|
||||
|
||||
from fluksio.flow.messages import DType, qualify
|
||||
from fluksio.flow.schemas import FlowDef, _validate_name
|
||||
from fluksio.flow.store import FlowStore, StaleVersion, _updated_at
|
||||
from fluksio.flow.store import FlowStore, StaleVersion, _updated_at, checked
|
||||
|
||||
#: Sibling of the shared-node library, and likewise not a flow.
|
||||
DASHBOARD_DIR = "_dashboards"
|
||||
@@ -612,10 +612,10 @@ class DashboardStore:
|
||||
self._lock = threading.Lock()
|
||||
|
||||
def _file(self, name: str) -> Path:
|
||||
return self.root / name / "dashboard.json"
|
||||
return self.root / checked(name) / "dashboard.json"
|
||||
|
||||
def _draft_file(self, name: str) -> Path:
|
||||
return self.root / name / "dashboard.draft.json"
|
||||
return self.root / checked(name) / "dashboard.draft.json"
|
||||
|
||||
@staticmethod
|
||||
def _dump(defn: DashboardDef) -> str:
|
||||
|
||||
Reference in New Issue
Block a user