core: reject dashes in isolation instance names:
To avoid confusion and hard-to-debug behaviours, `-` are now rejected in isolation instance names, only `_` is accepted.
This commit is contained in:
parent
65c775877e
commit
2f0c1d4818
1 changed files with 9 additions and 3 deletions
|
|
@ -57,12 +57,18 @@ class Const:
|
|||
isolation_name = os.environ.get("LIBERVIA_ISOLATION")
|
||||
|
||||
if isolation_name:
|
||||
# Validate isolation name: only allow [A-Za-z0-9_-] to prevent path traversal and
|
||||
# Validate isolation name: only allow [A-Za-z0-9_] to prevent path traversal and
|
||||
# other issues.
|
||||
if not isolation_name.replace("-", "").replace("_", "").isalnum():
|
||||
if "-" in isolation_name:
|
||||
raise ValueError(
|
||||
f"Invalid LIBERVIA_ISOLATION name {isolation_name!r}: dashes are"
|
||||
f" not allowed, please use underscores instead"
|
||||
f" ({isolation_name.replace('-', '_')!r})"
|
||||
)
|
||||
if not isolation_name.replace("_", "").isalnum():
|
||||
raise ValueError(
|
||||
f"Invalid LIBERVIA_ISOLATION name {isolation_name!r}, "
|
||||
f"must only contain [A-Za-z0-9_-]"
|
||||
f"must only contain [A-Za-z0-9_]"
|
||||
)
|
||||
isolation_mode = os.environ.get("LIBERVIA_ISOLATION_MODE", "normal").lower()
|
||||
match isolation_mode:
|
||||
|
|
|
|||
Loading…
Reference in a new issue