diff --git a/detection_rules/config.py b/detection_rules/config.py index 132ba0cc2..33be0050b 100644 --- a/detection_rules/config.py +++ b/detection_rules/config.py @@ -227,7 +227,7 @@ def parse_rules_config(path: Path | None = None) -> RulesConfig: # noqa: PLR091 raise ValueError(f"rules config file does not exist: {path}") loaded = yaml.safe_load(path.read_text()) elif CUSTOM_RULES_DIR: - path = Path(CUSTOM_RULES_DIR) / "_config.yaml" + path = Path(CUSTOM_RULES_DIR).expanduser() / "_config.yaml" if not path.exists(): raise FileNotFoundError( """ diff --git a/pyproject.toml b/pyproject.toml index 34a5e74d3..696d25b17 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "detection_rules" -version = "1.5.18" +version = "1.5.19" description = "Detection Rules is the home for rules used by Elastic Security. This repository is used for the development, maintenance, testing, validation, and release of rules for Elastic Security’s Detection Engine." readme = "README.md" requires-python = ">=3.12" diff --git a/tests/base.py b/tests/base.py index cbd3d5259..52280d35b 100644 --- a/tests/base.py +++ b/tests/base.py @@ -26,7 +26,7 @@ RULES_CONFIG = parse_rules_config() def load_rules() -> RuleCollection: if CUSTOM_RULES_DIR: rc = RuleCollection() - path = Path(CUSTOM_RULES_DIR) + path = Path(CUSTOM_RULES_DIR).expanduser() assert path.exists(), f"Custom rules directory {path} does not exist" rc.load_directories(directories=RULES_CONFIG.rule_dirs) rc.freeze() @@ -62,7 +62,7 @@ class BaseRuleTest(unittest.TestCase): RULE_LOADER_FAIL = True RULE_LOADER_FAIL_MSG = str(e) - cls.custom_dir = Path(CUSTOM_RULES_DIR).resolve() if CUSTOM_RULES_DIR else None + cls.custom_dir = Path(CUSTOM_RULES_DIR).expanduser().resolve() if CUSTOM_RULES_DIR else None cls.rules_config = RULES_CONFIG @staticmethod