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

[Defend Workflows] Fix: proper regexp test for dynamic parameters presence #150696

Merged

Conversation

szwarckonrad
Copy link
Contributor

@szwarckonrad szwarckonrad commented Feb 9, 2023

Bug:
When both Pack and Single Query osQuery response actions were defined within rule's Response Actions, parameter of Single Query wasn't replaced with event data.

Cause:
Due to regexp test inconsistent behaviour (known bug, read more here) dynamic parameter was being found for pack queries but for the following, single query, was being set to false negative.

Fix:
Wrapping regexp string in RegExp constructor fixes the issue.

Before:
Screenshot 2023-02-09 at 15 47 38

After:
Screenshot 2023-02-09 at 15 51 11

@szwarckonrad szwarckonrad added bug Fixes for quality problems that affect the customer experience release_note:skip Skip the PR/issue when compiling release notes Team:Defend Workflows “EDR Workflows” sub-team of Security Solution v8.7.0 v8.6.2 labels Feb 9, 2023
@szwarckonrad szwarckonrad requested a review from a team as a code owner February 9, 2023 13:08
@elasticmachine
Copy link
Contributor

Pinging @elastic/security-defend-workflows (Team:Defend Workflows)

@szwarckonrad szwarckonrad changed the title Fix: proper regexp test for dynamic parameters presence [Defend Workflows] Fix: proper regexp test for dynamic parameters presence Feb 9, 2023
@kibana-ci
Copy link
Collaborator

💚 Build Succeeded

Metrics [docs]

✅ unchanged

History

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

@szwarckonrad szwarckonrad merged commit b5dde1f into elastic:main Feb 9, 2023
kibanamachine pushed a commit to kibanamachine/kibana that referenced this pull request Feb 9, 2023
@kibanamachine
Copy link
Contributor

💔 Some backports could not be created

Status Branch Result
8.6 Backport failed because of merge conflicts
8.7

Note: Successful backport PRs will be merged automatically after passing CI.

Manual backport

To create the backport manually run:

node scripts/backport --pr 150696

Questions ?

Please refer to the Backport tool documentation

kibanamachine added a commit that referenced this pull request Feb 9, 2023
…rs presence (#150696) (#150749)

# Backport

This will backport the following commits from `main` to `8.7`:
- [[Defend Workflows] Fix: proper regexp test for dynamic parameters
presence (#150696)](#150696)

<!--- Backport version: 8.9.7 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sqren/backport)

<!--BACKPORT [{"author":{"name":"Konrad
Szwarc","email":"konrad.szwarc@elastic.co"},"sourceCommit":{"committedDate":"2023-02-09T17:02:53Z","message":"[Defend
Workflows] Fix: proper regexp test for dynamic parameters presence
(#150696)","sha":"b5dde1fcf5f54479906542a178cb87c616c7cb4f","branchLabelMapping":{"^v8.8.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["bug","release_note:skip","Team:Defend
Workflows","v8.7.0","v8.6.2","v8.8.0"],"number":150696,"url":"https://github.com/elastic/kibana/pull/150696","mergeCommit":{"message":"[Defend
Workflows] Fix: proper regexp test for dynamic parameters presence
(#150696)","sha":"b5dde1fcf5f54479906542a178cb87c616c7cb4f"}},"sourceBranch":"main","suggestedTargetBranches":["8.7","8.6"],"targetPullRequestStates":[{"branch":"8.7","label":"v8.7.0","labelRegex":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"8.6","label":"v8.6.2","labelRegex":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"main","label":"v8.8.0","labelRegex":"^v8.8.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/150696","number":150696,"mergeCommit":{"message":"[Defend
Workflows] Fix: proper regexp test for dynamic parameters presence
(#150696)","sha":"b5dde1fcf5f54479906542a178cb87c616c7cb4f"}}]}]
BACKPORT-->

Co-authored-by: Konrad Szwarc <konrad.szwarc@elastic.co>
@tomsonpl
Copy link
Contributor

Dynamic parameters are not part of 8.6, so the backport to 8.6.x is not required.
Great job finding and fixing this 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Fixes for quality problems that affect the customer experience release_note:skip Skip the PR/issue when compiling release notes Team:Defend Workflows “EDR Workflows” sub-team of Security Solution v8.7.0 v8.8.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants