ITADN

Feature request: "declared" keyword for global variables

#557Open1ndahous3 创建于 2026-02-10
1
1ndahous3commented
Currently, if we try to check whether a global variable is defined using the `defined` keyword, an `UnknownIdentifier` error immediately occurs. It would be nice to be able to simply check whether a global variable is declared. This could help in a common scenario where we build YARA-X as a static engine (which is updated infrequently) and regularly build a set of rules that are updated daily/weekly/monthly. This way, when finally building a new version of the engine, we can define (pass) a new external variable, such as `feature_1`. This way, using the special suggested `declared` keyword, I can check the variable (and it will work in an engine without the variable) and use the same rules across different builds without errors. ``` rule test {condition: declared feature_1} ``` Or maybe just add an extra option to change the `defined` keyword default behavior with global variables?
1 条评论