Skip to content
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

Marshaling Back to YAML #13

Open
pquerna opened this issue Sep 17, 2024 · 2 comments
Open

Marshaling Back to YAML #13

pquerna opened this issue Sep 17, 2024 · 2 comments

Comments

@pquerna
Copy link

pquerna commented Sep 17, 2024

Curious if Marshaling back into YAML is in scope for sigmalite. I think the main gap would be being able to construct the Expressions without Parse() being involed, and then handling JSON/YAML Marshaler tags or functions as needed? [mostly there, but private structs]?

@abraithwaite
Copy link
Member

I think marshaling a rule back to YAML a reasonable thing to consider. Can you elaborate with a concrete example of what you mean by the gap though? Do you already have expressions that you're now trying to convert into a Sigma rule without a source rule?

@pquerna
Copy link
Author

pquerna commented Sep 29, 2024

Yes, basically I am programmatically building Sigma rules based on my code that generates events, what I've done right now is build the struct with YAML struct tags myself generally like this:

dt := Detection{
	Selectors: map[string]any{
		"selection": map[string]any{
			"category_uid":  int32(appEnums.API_ACTIVITY_CATEGORY_UID_API_ACTIVITY_CATEGORY_UID_APPLICATION_ACTIVITY.Number()),
			"class_uid":     int32(appEnums.API_ACTIVITY_CLASS_UID_API_ACTIVITY_CLASS_UID_API_ACTIVITY.Number()),
			"api.operation": methodFullName,
		},
	},
	Condition: "selection",
}

Then I serialize these to YAML... and then Parse them with Sigmalite [which is fine as a round trip test case]. Was mostly wondering if I could pure "construct" the Sigma Rule "AST" in sigmalite code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants