MBot Posted September 9, 2024 Posted September 9, 2024 remove unused derive macro HasSpan prepare for publishing crate rename top-level directories. In the future we want to add a go directory that contains the Go bindings for YARA-X. Having a yara-x-go directory is not ideal, because the import path for that Go module would be github.com/VirusTotal/yara-x/yara-x-go. Instead we want the more natural github.com/VirusTotal/yara-x/go. However, adding a go directory makes the current naming incoherent, but with this change everything fits well again. fix typos remove unused dependencies Documentation improve API documentation New Features add support for the --module-data option Adds support for the --module-data option. This required some changes in the API, particularly the introduction of two new methods to Scanner. add error/warning codes and allow disabling warnings by code. This is the detailed list of changes: Assign a code to each error and warning Add a Compiler::switch_warning API that allows enabling/disabling specific warnings. Add a Compiler::switch_all_warnings API that allows enabling/disabling all warnings. Add a command-line option --disable-warning for disabling specific warnings, or all warnings. Move warnings from parser to compiler. implement method calls A mechanism for supporting method calls is now implemented. Only structs can have methods at this time, but in the future this can be extended to other types like maps and arrays. The module_export and wasm_export now have a new argument method_of that allows to specify that a WASM-exported function is a method of some type. For example: #[module_export(method_of = "test_proto2.NestedProto2")] fn some_function(ctx: &mut ScanContext, structure: Rc<Struct>) { ... // here the `structure` argument is a `NestedProto2` } implement new API that allows invoking YARA modules directly With this new API you use a YARA module as a file-parsing tool, and obtain the results produced by the module without any YARA rule involved in the process. This is useful for external tools that what to leverage YARA's file parsing capabilities for their own purposes. This required changing the arguments passed to the main function of each module, from &ScanContext to &[u8]. implement the --timeout option for the scan command implement the matches operator Other run tests with nightly and MSRV 1.66.1 Refactor large refactoring of how compilation errors are handled The changes in this PR include: Redesign how the compilation errors are exposed in the Rust API. With this change users of the API have access to more details about the error, including the structure of error reports (report title, individual labels with their corresponding text and code spans, etc). These changes are backward-incompatible, though. The CLI now shows multiple compilation errors at a time, instead of showing only the first error found. All the error details exposed in the Rust API are also exposed in the C API and the Golang API. change arguments to ReportBuilder::create_report migrate macros to syn v2 and do some improvements to errors and warnings. Errors and warnings now support more label types, like info, note and help. start the migrating the compiler to the new parser replace theariadne crate with annotate-snippets-rs for error reporting. The annotate-snippets-rs crate handles very long string in the source code better, and seems to be better maintained. big refactor that addresses multiple issues This refactor started as an attempt to fix a bug in the logic for structure field lookups, but fixing this issue required more fundamental changes. Some of the changes are: TypeValue::String now has a reference-counted string WasmArg has been refactored for making Rust-to-WASM type conversions simpler ScanContext now contains a map of used objects (structs, arrays, maps or strings) for tracking values that are passed from Rust to WASM and back to Rust. The field lookup mechanism for finding fields a structure has been refactored. ast::FieldAccess is now an n-ary expression. improve error reporting logic Introduce the SourceId field on each Span, which indicates the original source code the span is associated with. With this change we don't need to pass a reference to the original source code to ReportBuilder::build_report, making the code simpler. Also, it allows to create multi-file error reports, showing code snippets from different source files. Fix an issue where duplicate rule declarations were not being detected if the rules where in different source files under the same namespace. Style remove trailing whitespaces remove trailing spaces minor stylistic changes Commit Statistics 42 commits contributed to the release. 23 commits were understood as conventional. 7 unique issues were worked on: #140, #180, #183, #30, #52, #57, #59 Commit Details #140 Add error/warning codes and allow disabling warnings by code. (f1b91a9) #180 Large refactoring of how compilation errors are handled (7def597) #183 Add support for the --module-data option (57ebf6e) #30 Improve error reporting logic (d27e9ce) #52 Implement new API that allows invoking YARA modules directly (8c0a57b) #57 Big refactor that addresses multiple issues (debde08) #59 Implement method calls (83ea59a) Uncategorized Remove trailing whitespaces (5c6e03e) Change arguments to ReportBuilder::create_report (7ee166a) Remove trailing spaces (209afa5) Migrate macros to syn v2 and do some improvements to errors and warnings. (205b29d) Remove unused derive macro HasSpan (d9aa851) Start the migrating the compiler to the new parser (fd42c93) Prepare for publishing crate (78de92a) Replace theariadne crate with annotate-snippets-rs for error reporting. (9fc17d1) Rename top-level directories. (e7374d6) Merge branch 'main' into fast_regexp (912e250) Implement the --timeout option for the scan command (f14be43) Implement the matches operator (f11b259) Minor stylistic changes (9a2324a) Fix typos (46bdb25) Run tests with nightly and MSRV 1.66.1 (afc2bdb) Improve API documentation (89fbacc) Remove unused dependencies (c31c3ff) Stop using literals for function mangled names and rely on the export entry. (bfe52d5) Allow returning a tuple from #[wasm_export] functions. (637ba8b) Fix all issues found by clippy. (2c2e8fa) Fix all warnings. (c9ee9b4) Remove MaybeUndef<T> and use Option<T> instead. (fd4b990) Improvements in comments and documentation. (52b86d7) Fix wrong merge. (ff32319) Multiple changes in preparation for implementing built-in functions (9ffe658) Prepare for implementing built-in functions. (6dfd8cf) Start implementing built-in functions uintXX. (b58a5cc) Remove RuntimeStringWasm from the types accepted or returned from a module function. (947c688) Allow associating module's functions with nested structures. (e257ca2) Implement the #[module_export] attribute. (f672a01) Allow returning strings and undefined values from #[wasm_export] functions. (7b1e62c) Implement module function calls. (7169173) Implement the #[wasm_export] for decorating the functions that can be called from WASM. (0e4f850) Improve documentation. (525a30f) Split the project into multiple crates. (8098de4) Download
Recommended Posts