Skip to content
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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SIEM][Detections Engine] Add note markdown field to backend #59796

Merged
merged 7 commits into from
Mar 11, 2020

Conversation

yctercero
Copy link
Contributor

@yctercero yctercero commented Mar 10, 2020

Summary

This is part of #59176 - breaking up into backend and frontend PRs.

Problem to solve/Customer Benefit: Analysts need as much context as possible when investigating signals. If a richer format of information can be provided to them via their UX, then they may become more effective at completing investigations and cases.

This PR adds new note field for markdown and updates unit tests. One of the bigger considerations in implementing this new field was how it should deal with backwards compatibility (migration, schema requirements, etc). Decided to make the new field optional (and no default if not present) on the way in and optional on the way out.

Manual tests done:

  • testing rule without note value
    • ./post_rule.sh
    • ./patch_rule.sh
    • ./update_rule.sh
  • testing rule with note value
    • ./post_rule.sh ./rules/queries/query_with_note.json
    • ./patch_rule.sh ./rules/patches/update_note.json
    • ./update_rule.sh ./rules/updates/update_note.json
    • ./update_rule.sh ./rules/updates/update_note.json removing note value prior to running (resulting in updated note having no note value any longer)

rule_markdown

Checklist

For maintainers

@yctercero yctercero changed the title [SIEM][Detections Engine] - Add note markdown field [SIEM][Detections Engine] - Add note markdown field to backend Mar 10, 2020
@yctercero yctercero self-assigned this Mar 10, 2020
@elasticmachine
Copy link
Contributor

Pinging @elastic/siem (Team:SIEM)

@yctercero yctercero marked this pull request as ready for review March 10, 2020 18:17
@yctercero yctercero linked an issue Mar 10, 2020 that may be closed by this pull request
@FrankHassanabad
Copy link
Contributor

You have one error from the build to fix with e2e tests:

Screen Shot 2020-03-10 at 1 01 45 PM

@yctercero yctercero changed the title [SIEM][Detections Engine] - Add note markdown field to backend [SIEM][Detections Engine] Add note markdown field to backend Mar 11, 2020
@FrankHassanabad
Copy link
Contributor

FrankHassanabad commented Mar 11, 2020

You will want to add a note to this file:
query_with_everything.json

Something like this within that file:

  "timeline_id": "timeline_id",
  "timeline_title": "timeline_title",
  "note": "Some note for you",
  "version": 1

Test it like so:

./post_rule.sh ./rules/queries/query_with_everything.json

That's the file we communicate with people such as documentation and front end tests and we use it to test things manually if the need comes up.

In the queries folder I would add something like this query file and contents:

query_with_note.json

{
  "name": "Query with a note",
  "description": "Query with a note",
  "rule_id": "query-with-note",
  "risk_score": 1,
  "severity": "high",
  "type": "query",
  "query": "user.name: root or user.name: admin",
  "note": "Hello I am a markdown note"
}

And then in the patches and update folder I would add something similar so it's easy for us to run manual tests when we need to and that would pretty much complete the feature.

You can run the update_rule.sh and the patch_rule.sh scripts to ensure it works as expected. Then you can update your comments section at the top of this to let everyone know what scripts they can run to test out the notes section.

@yctercero
Copy link
Contributor Author

@elasticmachine merge upstream

Copy link
Contributor

@FrankHassanabad FrankHassanabad left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for all the updates for this and the tests. I checked it out and tested it and everything looks really good and the code reads really clean. LGTM! 👍

@kibanamachine
Copy link
Contributor

💚 Build Succeeded

History

To update your PR or re-run it, just comment with:
@elasticmachine merge upstream

@yctercero yctercero merged commit f9273cc into elastic:master Mar 11, 2020
yctercero added a commit to yctercero/kibana that referenced this pull request Mar 11, 2020
…#59796)

* add new note markdown field to DE backend

Co-authored-by: Elastic Machine <[email protected]>
yctercero added a commit that referenced this pull request Mar 11, 2020
…#59947)

* add new note markdown field to DE backend

Co-authored-by: Elastic Machine <[email protected]>
@yctercero yctercero deleted the rule_markdown_de_be branch July 20, 2020 01:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[SIEM] Detections Markdown-Capable Field Design Mockups
4 participants