Add disableIncludes() support to YaraCompiler - #4
Open
vToMy wants to merge 1 commit into
Open
Conversation
Adds the ability to disable YARA include directives during rule compilation by calling yr_compiler_set_include_callback with a NULL callback. This is a security-relevant feature that prevents rules from using include directives to read arbitrary files from disk. Changes span all layers: - YaraCompiler interface: new disableIncludes() method - Embedded mode: JNI binding to yr_compiler_set_include_callback - External mode: stub with warning log (not supported in CLI mode) - Native wrapper: yara_compiler_set_null_include_callback() C function - Test: verifies compilation fails when includes are disabled Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
disableIncludes()to theYaraCompilerinterface, allowing callers to prevent YARA rules from usingincludedirectivesyr_compiler_set_include_callback(compiler, NULL, NULL, user_data)in embedded modeThis is a security-relevant feature — it prevents rules from using
includedirectives to read arbitrary files from disk.Changes
YaraCompiler.javadisableIncludes()interface methodembedded/YaraCompilerImpl.javaembedded/YaraLibrary.javaexternal/YaraCompilerImpl.javayara-wrapper.hyr_compiler_set_include_callbackYaraCompilerImplTest.javaReferences
Test plan
"includes are disabled"error whendisableIncludes()is called🤖 Generated with Claude Code