chainguard-dev / bincapz

detect malicious program behaviors
Apache License 2.0
379 stars 24 forks source link

Recursive: return first YARA parse error instead of last #248

Closed tstromberg closed 1 month ago

tstromberg commented 1 month ago

Due to how the Recursive() YARA compiler function was organized, it would continue to parse YARA files after the error, resulting in panics or the baffling error message:

yara-rules-full.yar: Compiler cannot be used after parse error"

This now returns the first error encountered, for example:

failed to parse ref/words/ssh_attack.yara: duplicated string identifier \"$ref2\"

With any luck, we won't need the panic handler any longer, so it's been removed.