* feat(yara): scan an admitted artifact with caller-supplied YARA rules
Add inspect_yara_matches (CLI inspect-yara-matches), which runs the
installed yara command (REA_YARA_COMMAND or yara on PATH) with
caller-supplied rule files against one local file. The result lists
matching rules with tags, typed metadata and string match offsets,
bound to the SHA-256 of the scanned file and of each rule file.
yara is launched with an argument list under owned process supervision.
Its stdout is parsed as it streams, and the scanned file is re-verified
after the scan. command_timeout_ms, max_output_bytes and max_matches are
per-call arguments and runtime analysis settings with REA_YARA_* launch
seeds; max_file_bytes is per call. String matches beyond max_matches are
counted and coverage is partial. A rule compile error is an input error
naming the rule file, and a missing yara command is reported as
capability_unavailable without affecting other tools. REA bundles no
rules and downloads nothing.
* Address review feedback
* fix(yara): keep the scanned file's observation when a rule file fails
* fix(yara): require qualified Windows paths and resolve relative POSIX commands
* fix(yara): stage owned snapshot, preserve CLI array bounds, and report file-size required_value
* fix(yara): preserve relative includes, retain completed matches, order snapshot cleanup, and declare writesFilesystem
* chore(yara): update advertised schema summary for inspect_yara_matches
* fix(yara): handle regex arguments in include rewriter and retain completed matches across process cleanup
* fix(yara): preserve raw include bytes and staged file identity across close
* fix(yara): preserve completed rule identities and malformed-output primaries
* fix(yara): bound rewritten rule staging and preserve cleanup cancellation
* fix(yara): record completed rule identity before flushing rewritten includes
* Address review feedback
* Address review feedback
* fix(skills): restore the macOS flat installer guidance this branch dropped
The authored native-and-artifacts reference had lost main's macOS .pkg
paragraph, so the generated Cursor plugin copy no longer matched it and
the skill freshness check failed in docs, source tests and packaging.
* fix(yara): classify compile errors by kind and keep unrecognized diagnostics
yara 4.x prints compiler diagnostics in two forms, with and without a rule
(cli/yara.c print_compiler_error). The include failure in the stub used a
form yara never prints, so a real missing include was untested. Parse both
forms once into severity, source, line, rule and message, classify the
message by libyara's text (include, syntax, undefined, duplicate,
unreadable file, other), and give one repair per kind present. Stderr lines
that match no documented form are kept verbatim instead of only counted.
* fix(yara): decode every meta escape yara prints and anchor diagnostic file names
Meta strings: yara 4.x print_escaped_data also escapes an apostrophe and
writes \a \b \v \f, so a meta value such as "author's" failed the whole
scan as an unknown escape. Decode exactly the escapes yara writes, named
after that function, and refuse octal forms it never writes.
Diagnostics: a file name or message can contain "(N): ". Match the rule
files yara was given exactly and end any other file name at the first
location rather than the last. Name yara's EXIT_FAILURE.
* fix(yara): keep an ambiguous diagnostic location unknown and scope duplicate advice
A file name and a message can both contain "(N): ". Split an unnamed
file only where one complete diagnostic remains; several splits leave the
source and line null with the whole text kept, instead of shortening the
file name or dropping the line to unrecognized stderr. Duplicate advice now
covers string, tag and metadata identifiers within their rule, not only
rule names.
---------
Co-authored-by: Matt Van Horn <455140+mvanhorn@users.noreply.github.com>
Co-authored-by: morluto <76467478+morluto@users.noreply.github.com>