Repository navigation
fix(detect): generate labels and markers from pinned dfe-schemas - #169
Merged
Merged
Conversation
Replace the hand-run labels.rs snapshot, which had no drift check, and the marker table coded in signatures.rs. One generator reads the dfe-schemas wheel pinned by version and sha256 in scripts/dfe-schemas.toml. - scripts/gen_detect_tables.py writes src/detect/labels.rs and src/detect/markers.rs. Markers come from each source's catalogue.detect block, in detect.order, then file order. CEF markers go by source name. - The output uses the same static slices and const constructors, so the hot path is unchanged. Builds read no network and run no build script. - tests/scripts_suite.rs runs the generator with --check, so a stale table fails the Test job. - scripts/test_gen_detect_tables.py covers ordering, escaping, refusals and the digest check. - Generated SIGNATURES and CEF match the deleted hand-written tables entry for entry, including verify functions. - Labels are unchanged: 1,069 variants, no entry moved.
MAX_EVERY was fixed at 32 for the table's 32 all-of entries. One more all marker in dfe-schemas would have broken the build. The generator writes MAX_EVERY into markers.rs as the count of all-of entries. The per-line scratch stays a fixed-size stack array. - The generator refuses an all marker over 8 literals and a priority over 255, because the detector holds them in a u8. - The pinned wheel comes from DFE_SCHEMAS_WHEEL, a digest-named cache, or PyPI. Each source must match the pinned sha256. - With none available the generator exits 3. The drift test skips that locally and fails in CI.
0.2.28 has the catalogue.detect blocks. Regenerating from its wheel changes only the origin line in the two file headers.
catinspace-au
marked this pull request as ready for review
November 11, 2026 06:49
The generator rejects non-https URLs before urlopen. This blocks file:// wheel URLs. The urlopen call has a nosemgrep mark for dynamic-urllib because the scheme check and sha256 pin address the rule.
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.
Replace the hand-run labels.rs snapshot, which had no drift check, and the marker table coded in signatures.rs. One generator reads the dfe-schemas wheel pinned by version and sha256 in scripts/dfe-schemas.toml.