-
Notifications
You must be signed in to change notification settings - Fork 4
feat: add plugin.yaml descriptor #13
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鈥檒l occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
fzipi
wants to merge
2
commits into
main
Choose a base branch
from
add-plugin-yaml
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,76 @@ | ||
| schema_version: 1 | ||
|
|
||
| plugin: | ||
| name: "machine-learning-integration-plugin" | ||
| description: "Scores requests with a pluggable machine learning model and blocks or reduces false positives based on the resulting anomaly score." | ||
| long_description: | | ||
| Integrates a machine learning anomaly model into the CRS request evaluation | ||
| pipeline. A ModSecurity rule calls a Lua script, which forwards request | ||
| metadata (method, path, arguments, file names/sizes, hour, day) to an | ||
| external Flask server over HTTP. The server scores the request with a | ||
| pluggable ML model and returns a pass/deny status that the plugin rules | ||
| act on. | ||
|
|
||
| The plugin supports two modes: false positive detection mode, where only | ||
| requests whose CRS inbound anomaly score already exceeds a threshold are | ||
| re-checked by the ML model, and general detection mode, where every | ||
| request is scored by the ML model. The shipped ML server stubs the model | ||
| with a random score generator; operators supply their own trained model. | ||
| type: "official" | ||
| category: "detection" | ||
| status: "draft" | ||
| license: "Apache-2.0" | ||
| authors: | ||
| - name: "OWASP CRS Team" | ||
| url: "https://coreruleset.org" | ||
| repository: "https://github.com/coreruleset/machine-learning-integration-plugin" | ||
| keywords: | ||
| - "machine-learning" | ||
| - "anomaly-detection" | ||
| - "false-positive-reduction" | ||
|
|
||
| rule_id_range: | ||
| start: 9516000 | ||
| end: 9516999 | ||
|
|
||
| compatibility: | ||
| crs_version: ">=4.0.0" | ||
|
|
||
| configuration: | ||
| # NOTE: this repo keeps its conf file under `plugin/` (singular), not the | ||
| # `plugins/` directory convention `plugin-schema.json` expects, so this path | ||
| # does not satisfy the schema's `configuration.file` pattern. Flagged for a | ||
| # maintainer decision (rename the directory vs. relax the schema pattern) | ||
| # rather than papering over it with a path that doesn't exist in this repo. | ||
| file: "plugin/machine-learning-config.conf" | ||
| variables: | ||
| - name: "tx.machine-learning-plugin_enabled" | ||
| type: "boolean" | ||
| default: 1 | ||
| description: "Enable or disable the plugin (0 to disable)" | ||
| required: false | ||
|
|
||
| - name: "tx.machine-learning-plugin_mode" | ||
| type: "integer" | ||
| default: 2 | ||
| min: 1 | ||
| max: 2 | ||
| description: >- | ||
| Operating mode: 1 = false positive detection mode (only requests | ||
| whose CRS inbound anomaly score already exceeds the threshold are | ||
| scored by the ML model), 2 = general detection mode (every request | ||
| is scored by the ML model) | ||
|
|
||
| - name: "tx.machine-learning-plugin_ml_server_url" | ||
| type: "string" | ||
| default: "http://127.0.0.1:5000/" | ||
| description: "URL of the Flask ml_model_server that scores requests and returns an anomaly status" | ||
| example: "http://127.0.0.1:5000/" | ||
|
|
||
| - name: "tx.machine-learning-plugin_inbound_ml_threshold" | ||
| type: "integer" | ||
| default: 0 | ||
| description: >- | ||
| Threshold compared against the CRS inbound anomaly score to decide | ||
| when the ML model should evaluate a request in false positive | ||
| detection mode (mode 1) | ||
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A couple of config options are missing: