Skip to content

Commit 434a0cb

Browse files
Update to handle multiple exc source formats
1 parent 2e1a738 commit 434a0cb

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

detection_rules/rule_validators.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -931,8 +931,8 @@ def remote_validate_rule( # noqa: PLR0913
931931

932932
def extract_error_field(source: str, exc: eql.EqlParseError | kql.KqlParseError, max_attempts: int = 10) -> str | None:
933933
"""Extract the field name from an EQL or KQL parse error."""
934-
# If error reported in subquery, adjust source accordingly
935-
if exc.source != source: # type: ignore[reportUnknownMemberType]
934+
# If error reported in subquery and exc references exc.source rather than source, adjust source accordingly
935+
if exc.source != source and len(exc.source.splitlines()) > exc.line: # type: ignore[reportUnknownMemberType]
936936
source = exc.source # type: ignore[reportUnknownMemberType]
937937
lines = source.splitlines() # type: ignore[reportUnknownMemberType]
938938
mod = -1 if exc.line == len(lines) else 0 # type: ignore[reportUnknownMemberType]

0 commit comments

Comments
 (0)