fix(rules): safely parse non-dotted tags and preserve custom namespaced governance tags - #1807
Open
AAH20 wants to merge 1 commit into
Open
Conversation
…ed governance tags - Prevent ArrayIndexOutOfBoundsException in SigmaRuleTag.fromStr when parsing tags without dot delimiter (e.g. 'tag') - Support empty namespace representation with getFormattedTag() to avoid prepending a dot on single-token tags - Retain arbitrary namespaced governance and compliance tags (e.g. 'grc.nist.*', 'asset.tier.*') across rule serialization - Update SigmaRuleTagTests to assert safe parsing of single-token tags and multi-segment governance tags - Resolves opensearch-project#1724 and supports governance tagging for opensearch-project#1806 Signed-off-by: aah20 <[email protected]>
AAH20
requested review from
AWSHurneyt,
KashKondaka,
amsiglan,
eirsep,
engechas,
getsaurabh02,
goyamegh,
lezzago,
manaswini1920,
nishtham-amazon,
riysaxen-amzn,
toepkerd and
vikhy-aws
as code owners
September 4, 2026 06:26
Contributor
PR Reviewer Guide 🔍Here are some key observations to aid the review process:
|
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.
Description
This pull request addresses two related tag parsing and serialization issues in OpenSearch Security Analytics Sigma rules:
Bug Fix (
ArrayIndexOutOfBoundsExceptionon single-token tags):Previously,
SigmaRuleTag.fromStr(tag)unconditionally split on.and accessedtagParts[1]without checking array length (tag.split("\\.", 2)). If a rule or custom tag did not contain a period (such as"tag","ransomware", or un-namespaced tags),SigmaRuleTag.fromStrthrew an uncaughtArrayIndexOutOfBoundsException: Index 1 out of bounds for length 1..delimiter is present,SigmaRuleTagnow safely treats the entire string as the tag name and initializesnamespaceas"".Rule.java, serialization now delegates toruleTag.getFormattedTag()rather than formatting as"%s.%s", preventing unintended leading periods (e.g.".tag").Support for Non-ATT&CK & Governance / Compliance Namespaced Tags:
Modern SOC teams and detection engineers annotate rules with regulatory, governance, and asset risk tags (e.g.,
grc.nist.800-53.sc-8,compliance.pci-dss.10-2,asset.tier.0_critical).SigmaRuleTagcleanly handles any namespace and multi-dotted sub-namespaces.getFormattedTag()reconstructs the full original tag string identically.Testing:
SigmaRuleTagTests.javawith verification that single-token tags parse cleanly and format back to their original token.testSigmaRuleTagGovernanceAndCompliance) verifying that multi-segment compliance and asset tags (grc.*,asset.*) parse correctly and format back intact.Related Issues
Resolves #1724
Relates to #1806
Check List
--signoff.By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.