-
-
Notifications
You must be signed in to change notification settings - Fork 18
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
Add JSON struct tags #39
Conversation
|
||
// Any non-standard fields will end up in here | ||
AdditionalFields map[string]interface{} `yaml:",inline"` | ||
AdditionalFields map[string]interface{} `yaml:",inline,omitempty" json:",inline,omitempty"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unfortunately I don't think the "inline" keyword works for json (in the yaml package used here it outputs the values at the same level of nesting as the other struct fields)
What's the use case for json output? YAML output makes sense here so that you can programmatically edit rules and then marshal them out to valid Sigma rules again
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Velociraptor emits all results in Json and we want to include the rule itself as part of the hit. Without the Json tags we get all the empty fields which just take up space.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes sense 👍🏻
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Though I do wonder if you'd get better results converting YAML to JSON yourself e.g. like this https://github.com/ghodss/yaml/blob/d8423dcdf3440d0a5baffc6f90a11e4128545620/yaml.go#L104
That way you'd get support for things like inline
Anyway, doesn't hurt to have these tags so I'll merge
|
||
// Any non-standard fields will end up in here | ||
AdditionalFields map[string]interface{} `yaml:",inline"` | ||
AdditionalFields map[string]interface{} `yaml:",inline,omitempty" json:",inline,omitempty"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Though I do wonder if you'd get better results converting YAML to JSON yourself e.g. like this https://github.com/ghodss/yaml/blob/d8423dcdf3440d0a5baffc6f90a11e4128545620/yaml.go#L104
That way you'd get support for things like inline
Anyway, doesn't hurt to have these tags so I'll merge
No description provided.