fix: correctness bugs in collector, evaluator, and model - #62
Merged
Conversation
Bug 1 — WazuhCollector timestamp parsing (highest priority): parseTimestamp() replaces inline time.Parse with an ordered list of 3 layouts covering Wazuh's actual formats (ms+numeric offset, RFC3339, RFC3339Nano). Added table test (9 cases) + window-match test in timestamp_test.go. Bug 2 — "1 of them" / "all of them" silently wrong: evalOneOf/evalAllOf now expand empty Names to all search-identifiers when the condition uses "them". 1 of them now requires at least N matches (was always false); all of them now requires all identifiers to match (was vacuous truth). Added them_test.go with both positive and negative cases. Bug 3 — * wildcards unsupported: matchField now detects * in values and delegates to matchWildcard(), which splits on * and matches segments in order (case-insensitive). Wildcard works with all existing modifiers. Added 14-case wildcard_test.go. Doc fix — PARTIAL verdict removed: Deleted const model.Partial (never emitted by Evaluator). Removed all references from main.go, report.go, dashboard.go, DESIGN.md, docs/index.html. Verdict states now 4: DETECTED, MISSED, NO_TELEMETRY, INCONCLUSIVE. All existing tests pass (10-rule regression, collector, evaluator, normalizer). gofmt applied. make build && make vet clean.
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.
Fixes
Bug 1 — WazuhCollector timestamp parsing (highest priority)
parseTimestamp() replaces fragile inline time.Parse with an ordered list of 3 layouts covering Wazuh's actual formats (ms+numeric offset, RFC3339, RFC3339Nano). Added 9-case table test + window-match test.
Bug 2 — 1 of them / all of them silently wrong
evalOneOf/evalAllOf now expand empty Names to all search-identifiers. 1 of them correctly requires at least N matches; all of them correctly requires all identifiers to match. Added them_test.go.
Bug 3 — * wildcards unsupported
matchField now delegates *-containing values to matchWildcard(), which splits on * and matches segments in order (case-insensitive). Works with all existing modifiers. Added 14-case wildcard_test.go.
Doc fix — PARTIAL verdict removed
Deleted model.Partial (never emitted by Evaluator). Removed all references from Go code, DESIGN.md, docs/index.html.
Verification