mirror of
https://github.com/morluto/rea.git
synced 2026-12-01 02:49:12 +00:00
* fix(yara): refuse rule files with include directives before yara starts yara opens an included file while it lexes, outside the hashed snapshot, so the rules it adds were not bound to the scan's Evidence. A selected rule file with an `include` directive is now refused with a typed input error naming each directive's line, byte column and path, and the recovery to pass the included file as another rule_paths entry or inline its rules. Detection follows libyara 4.x's flex lexer (lexer.l at v4.5.0): the `include[ \t]+"` rule fires at any token start in the initial state, including inside a rule body, and never inside comments, text strings or regular expressions. One streaming scanner sees the staged bytes unchanged. The relative-include rewriter, the `include` compile-error kind and its repair advice, and the stub's include support are removed, since no include reaches yara. * test(yara): check the include scanner against libyara's own answers Twenty-four rule sources cover the scanner's lexer assumptions: directives in rule bodies and after punctuation or number tokens, and include inside comments, strings, regexes, hex strings and longer tokens. Each case records the include paths libyara 4.5.4 asked to open through yara-python's include_callback, so the expected values come from yara, not the scanner. A real-yara test compares the same cases with the installed yara's missing include error where one is installed.