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.
This commit is contained in:
@@ -24,7 +24,8 @@ _SPAN_SECONDS = {"s": 1, "m": 60, "h": 3600, "d": 86400}
|
||||
|
||||
|
||||
def _validate_name(value: str) -> str:
|
||||
if not NAME_PATTERN.match(value):
|
||||
# fullmatch: `$` alone lets a trailing newline through.
|
||||
if not NAME_PATTERN.fullmatch(value):
|
||||
raise ValueError(
|
||||
"Use lowercase letters, digits and underscores, starting with a letter"
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user