diff --git a/libervia/backend/core/constants.py b/libervia/backend/core/constants.py index 2c07f6b5..4390740a 100644 --- a/libervia/backend/core/constants.py +++ b/libervia/backend/core/constants.py @@ -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: