nickwallen opened a new pull request #1311: METRON-685 Scores in Threat Triage 
should be a Stellar Statement
URL: https://github.com/apache/metron/pull/1311
 
 
   Allows a threat triage rule's score to be expressed as either a numeric 
value or a Stellar expression.  The change is backwards compatible.
   
   ## Testing
   
   1. Create a threat triage engine.
   
       ```
       [Stellar]>>> t := THREAT_TRIAGE_INIT()
       [Stellar]>>> t
       ThreatTriage{0 rule(s)}
       ```
   
   1. Add a triage rule that uses a simple numeric score.  This is the existing 
behavior that continues to be supported.
   
       ```
       [Stellar]>>> THREAT_TRIAGE_ADD(t, {"name":"rule1", "rule":"value>10", 
"score":10})
       ```
   
   1. Add another triage rule that uses a score expression.  This will simply 
make the score 10 times the value contained in the message.
       
       ```
       [Stellar]>>> THREAT_TRIAGE_ADD(t, {"name":"rule2", "rule":"value>20", 
"score":"value*10"})
       ```
   
   1. Review the rules that you have created.
       ```
       [Stellar]>>> THREAT_TRIAGE_PRINT(t)
       ╔═══════╤═════════╤═════════════╤══════════╤════════╗
       ║ Name  │ Comment │ Triage Rule │ Score    │ Reason ║
       ╠═══════╪═════════╪═════════════╪══════════╪════════╣
       ║ rule1 │         │ value>10    │ 10       │        ║
       ╟───────┼─────────┼─────────────┼──────────┼────────╢
       ║ rule2 │         │ value>20    │ value*10 │        ║
       ╚═══════╧═════════╧═════════════╧══════════╧════════╝
       ```
   
   1. Create a few test messages to simulate your telemetry.
       ```
       [Stellar]>>> msg1 := "{ \"value\":22 }"
       [Stellar]>>> msg1
       { "value":22 }
       ```
       ```
       [Stellar]>>> msg2 := "{ \"value\":44 }"
       [Stellar]>>> msg2
       { "value":44 }
       ```
   
   1. Score a message based on the rules that have been defined.  The result 
allows you to see the total score, the aggregator, along with details about 
each rule that fired.
   
       ```
       [Stellar]>>> THREAT_TRIAGE_SCORE( msg1, t)
       {score=220.0, aggregator=MAX, rules=[{score=10, name=rule1, 
rule=value>10}, {score=value*10, name=rule2, rule=value>20}]}
       ```
       ```
       [Stellar]>>> THREAT_TRIAGE_SCORE( msg2, t)
       {score=440.0, aggregator=MAX, rules=[{score=10, name=rule1, 
rule=value>10}, {score=value*10, name=rule2, rule=value>20}]}
       ```
   
   ## Pull Request Checklist
   
   - [ ] Is there a JIRA ticket associated with this PR? If not one needs to be 
created at [Metron 
Jira](https://issues.apache.org/jira/browse/METRON/?selectedTab=com.atlassian.jira.jira-projects-plugin:summary-panel).
   - [ ] Does your PR title start with METRON-XXXX where XXXX is the JIRA 
number you are trying to resolve? Pay particular attention to the hyphen "-" 
character.
   - [ ] Has your PR been rebased against the latest commit within the target 
branch (typically master)?
   - [ ] Have you included steps to reproduce the behavior or problem that is 
being changed or addressed?
   - [ ] Have you included steps or a guide to how the change may be verified 
and tested manually?
   - [ ] Have you ensured that the full suite of tests and checks have been 
executed in the root metron folder via
   - [ ] Have you written or updated unit tests and or integration tests to 
verify your changes?
   - [ ] If adding new dependencies to the code, are these dependencies 
licensed in a way that is compatible for inclusion under [ASF 
2.0](http://www.apache.org/legal/resolved.html#category-a)?
   - [ ] Have you verified the basic functionality of the build by building and 
running locally with Vagrant full-dev environment or the equivalent?
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to