-
Notifications
You must be signed in to change notification settings - Fork 49
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(go): expose rule's metadata in Go API #123
Conversation
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
Now that I see an implementation I'm reconsidering the use of JSON as a format for exchanging metadata information. There are some issues with JSON that make it far from ideal:
|
When I wrote the tests I noticed that as well, maybe a similar implementation as the original Yara did? Which is what I was originally aiming for when attempting to implement it in the C-API. struct YR_META
{
DECLARE_REFERENCE(const char*, identifier);
DECLARE_REFERENCE(const char*, string);
int64_t integer;
int32_t type;
int32_t flags;
}; |
I've refactored the C API for obtaining the rule's metadata. See: 9f90eaa |
There is a slight error with the While you decide on the new name for the float variant, I shall temporary rename to get the go package working. |
Fixed in 497c678 |
Union types are represented as byte arrays in golang but I was able to get it working with that limitation. |
I've added some helper functions for accessing the metadata values in a safer, more legible way. |
Reference issue: #120 & #118