feat: implement context-aware suspicious pattern detection with MIME-specific scoring#2
Merged
vientorepublic merged 2 commits intomainfrom Mar 13, 2026
Merged
feat: implement context-aware suspicious pattern detection with MIME-specific scoring#2vientorepublic merged 2 commits intomainfrom
vientorepublic merged 2 commits intomainfrom
Conversation
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.
This pull request introduces advanced, context-aware suspicious pattern detection to the buffer analysis engine. The changes add MIME type–specific pattern matching, weighted scoring of suspicious patterns, configurable thresholds, and per-MIME-type configuration overrides. The documentation and tests are updated to reflect these new features.
Suspicious Pattern Detection Improvements:
applicableMimeTypesandweightfields, allowing patterns to be matched only for relevant MIME types and to contribute different risk scores. Patterns can also use regex for advanced matching. (src/suspicious-patterns.ts,src/types.ts) [1] [2]mimeType,maxAnalysisDepth, andthresholdparameters, and returns a totalscore. Patterns are only flagged as suspicious if the total score meets or exceeds the configurable threshold. (src/suspicious-patterns.ts,src/engine.ts) [1] [2]Configuration Enhancements:
suspiciousThresholdandmimeTypeSpecificConfigin its configuration, enabling global and per-MIME-type overrides for thresholds and analysis depth. Configuration validation is updated accordingly. (src/types.ts,src/engine.ts) [1] [2] [3] [4]MIME Type Detection Improvements:
src/engine.ts)Documentation Updates:
README.mdis updated to explain the new context-aware analysis, scoring, thresholds, per-MIME-type configuration, and stream analysis behavior. Usage examples reflect the new API. [1] [2] [3] [4]Test Updates:
Other:
renovate.jsonconfiguration file for dependency management.