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

[Security Solution] Adds feature flag to enable/disable ESQL in timeline #174029

Merged
merged 8 commits into from
Jan 2, 2024

Conversation

logeekal
Copy link
Contributor

@logeekal logeekal commented Dec 28, 2023

Summary

This PR introduces a feature flag timelineEsqlTabDisabled which is by default false. This gives customer ability to disable the esql tab by enabling this experimental feature flag as below in kibana.yml

xpack.securitySolution.enableExperimental:
  - timelineEsqlTabDisabled

The availability of ESQL Tab in timeline also affects AI Assistant as it facilities re-directing user to timeline with an esql query. That redirect button should not be available for esql query if ESQL Tab is disabled.

Desk Testing

  1. ESQL Tab Presence

    • timelineEsqlTabDisabled : true
      • If Tab is disabled, ESQL Tab should not show when timeline is open. Timeline should also not fire any bsearch requests with esql strategy.
    • ESQL tab is enabled i.e. timelineEsqlTabDisabled : true is present in kibana.dev.yml
      • User should be able to use ESQL queries without any issue. Below should be the default query in both 8.12 and 8.11.4
      from .alerts-security.alerts-default,apm-*-transaction*,auditbeat-*,endgame-*,filebeat-*,logs-*,packetbeat-*,traces-apm*,winlogbeat-*,-*elastic-cloud-logs-* | limit 10 | keep @timestamp, message, event.category, event.action, host.name, source.ip, destination.ip, user.name
      
  2. Open ESQL Tab from URL

    1. Enable ESQL tab and Activate it when in timeline
    2. Now change kibana.dev.yml to add experimental flag timelineEsqlTabDisabled to disable ESQL Tab.
    3. Restart kibana server
    4. Refresh the page in step 1 where ESQL tab was active
    5. User should automatically be redirected to Query tab.
  3. AI Assistant
    Today AI Assistant can help user add an ESQL query to the timeline as shown in below video.
    We need to make sure that Send to timeline button is not available only for esql queries when above experimental flag is enabled.

    Screen.Recording.2023-12-30.at.17.20.19.mov

@logeekal logeekal requested review from a team as code owners December 28, 2023 15:47
@logeekal logeekal added release_note:fix Team:Threat Hunting:Investigations Security Solution Investigations Team labels Dec 28, 2023
@logeekal logeekal self-assigned this Dec 28, 2023
@logeekal logeekal requested a review from spong December 30, 2023 16:09
@kibana-ci
Copy link
Collaborator

💚 Build Succeeded

Metrics [docs]

Async chunks

Total size of all lazy-loaded chunks that will be downloaded as the user navigates the app

id before after diff
securitySolution 11.3MB 11.3MB +1.3KB

Page load bundle

Size of the bundles that are downloaded on every page load. Target size is below 100kb

id before after diff
securitySolution 64.2KB 64.3KB +27.0B

History

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

cc @logeekal

@MadameSheema
Copy link
Member

MadameSheema commented Jan 2, 2024

These are the scenarios that have been checked on the PR:

ESS:

  • Without FF

    • ESQL tab is displayed in timeline
    • No bsearch query is done when opening timeline

  • With FF

    • ESQL tab is not displayed in timeline
    • No bsearch query is done when opening timeline
    • ESQL tab is not displayed after importing an exported timeline with the tab
    • When asked the assistant to create an ES|QL query it does not allow the option to send it to timeline

  • Other scenarios:

    • Without FF create a timeline with a modified ES|QL query AND Export the timeline AND Update the FF to disable the tab AND Import the timeline AND Update FF to enable the tab again AND The tab is present and the ES|QL query displayed was the expected one

    • Without FF create a timeline with a modified ES|QL query AND Update the FF to disable the tab AND Update FF to enable the tab again AND The tab is present and the ES|QL query displayed was the expected one

SERVERLESS:

  • The ESQL tab is not displayed in timeline

All the scenarios behaved as expected :)

@spong spong added the v8.12.0 label Jan 2, 2024
Copy link
Member

@spong spong left a comment

Choose a reason for hiding this comment

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

Assistant changes LGTM 👍

@spong spong added the v8.13.0 label Jan 2, 2024
@spong
Copy link
Member

spong commented Jan 2, 2024

After discussing w/ @MadameSheema, since I was the last remaining reviewer and with @logeekal on holiday, going to merge this now so it's available in upcoming releases. Also added v8.12.0 label so it would be backported there matching these other two PR's: #173484 & #171789

@spong spong merged commit da0370e into elastic:main Jan 2, 2024
41 checks passed
kibanamachine pushed a commit to kibanamachine/kibana that referenced this pull request Jan 2, 2024
…ine (elastic#174029)

## Summary

This PR introduces a feature flag `timelineEsqlTabDisabled` which is by
default `false`. This gives customer ability to disable the esql tab by
enabling this experimental feature flag as below in `kibana.yml`

```yaml
xpack.securitySolution.enableExperimental:
  - timelineEsqlTabDisabled

```

The availability of ESQL Tab in timeline also affects `AI Assistant` as
it facilities re-directing user to timeline with an esql query. That
`redirect` button should not be available for `esql` query if ESQL Tab
is disabled.

## Desk Testing

1. ESQL Tab Presence
    -  timelineEsqlTabDisabled :  true
- If Tab is disabled, `ESQL` Tab should not show when timeline is open.
Timeline should also not fire any `bsearch` requests with `esql`
strategy.
- ESQL tab is enabled i.e. `timelineEsqlTabDisabled : true` is present
in kibana.dev.yml
- User should be able to use ESQL queries without any issue. Below
should be the default query in both `8.12` and `8.11.4`
       ```esql
from
.alerts-security.alerts-default,apm-*-transaction*,auditbeat-*,endgame-*,filebeat-*,logs-*,packetbeat-*,traces-apm*,winlogbeat-*,-*elastic-cloud-logs-*
| limit 10 | keep @timestamp, message, event.category, event.action,
host.name, source.ip, destination.ip, user.name
       ```
2. Open ESQL Tab from URL
    1. Enable ESQL tab and Activate it when in timeline
2. Now change `kibana.dev.yml` to add experimental flag
`timelineEsqlTabDisabled` to disable ESQL Tab.
    3. Restart kibana server
    4. Refresh the page in step 1 where `ESQL` tab was active
    5. User should automatically be redirected to `Query` tab.

3. AI Assistant
Today AI Assistant can help user add an ESQL query to the timeline as
shown in below video.
We need to make sure that `Send to timeline` button is not available
only for `esql` queries when above experimental flag is enabled.

https://github.com/elastic/kibana/assets/7485038/e452a6c6-cf97-462e-a5dc-bd8c0fd38d58

---------

Co-authored-by: Gloria Hornero <[email protected]>
Co-authored-by: kibanamachine <[email protected]>
(cherry picked from commit da0370e)
@kibanamachine
Copy link
Contributor

💔 Some backports could not be created

Status Branch Result
8.11 Backport failed because of merge conflicts
8.12

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

Manual backport

To create the backport manually run:

node scripts/backport --pr 174029

Questions ?

Please refer to the Backport tool documentation

@logeekal
Copy link
Contributor Author

logeekal commented Jan 2, 2024

Thank you @MadameSheema and @spong . Sorry I missed communicating the same.

@spong
Copy link
Member

spong commented Jan 2, 2024

Of course! Looking into the 8.11 backport now @logeekal. Should be fine with the work we did over in #170542, but will verify and get a manual backport created.

@spong
Copy link
Member

spong commented Jan 2, 2024

💚 All backports created successfully

Status Branch Result
8.11

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

Questions ?

Please refer to the Backport tool documentation

spong pushed a commit to spong/kibana that referenced this pull request Jan 2, 2024
…ine (elastic#174029)

## Summary

This PR introduces a feature flag `timelineEsqlTabDisabled` which is by
default `false`. This gives customer ability to disable the esql tab by
enabling this experimental feature flag as below in `kibana.yml`

```yaml
xpack.securitySolution.enableExperimental:
  - timelineEsqlTabDisabled

```

The availability of ESQL Tab in timeline also affects `AI Assistant` as
it facilities re-directing user to timeline with an esql query. That
`redirect` button should not be available for `esql` query if ESQL Tab
is disabled.

## Desk Testing

1. ESQL Tab Presence
    -  timelineEsqlTabDisabled :  true
- If Tab is disabled, `ESQL` Tab should not show when timeline is open.
Timeline should also not fire any `bsearch` requests with `esql`
strategy.
- ESQL tab is enabled i.e. `timelineEsqlTabDisabled : true` is present
in kibana.dev.yml
- User should be able to use ESQL queries without any issue. Below
should be the default query in both `8.12` and `8.11.4`
       ```esql
from
.alerts-security.alerts-default,apm-*-transaction*,auditbeat-*,endgame-*,filebeat-*,logs-*,packetbeat-*,traces-apm*,winlogbeat-*,-*elastic-cloud-logs-*
| limit 10 | keep @timestamp, message, event.category, event.action,
host.name, source.ip, destination.ip, user.name
       ```
2. Open ESQL Tab from URL
    1. Enable ESQL tab and Activate it when in timeline
2. Now change `kibana.dev.yml` to add experimental flag
`timelineEsqlTabDisabled` to disable ESQL Tab.
    3. Restart kibana server
    4. Refresh the page in step 1 where `ESQL` tab was active
    5. User should automatically be redirected to `Query` tab.

3. AI Assistant
Today AI Assistant can help user add an ESQL query to the timeline as
shown in below video.
We need to make sure that `Send to timeline` button is not available
only for `esql` queries when above experimental flag is enabled.

https://github.com/elastic/kibana/assets/7485038/e452a6c6-cf97-462e-a5dc-bd8c0fd38d58

---------

Co-authored-by: Gloria Hornero <[email protected]>
Co-authored-by: kibanamachine <[email protected]>
(cherry picked from commit da0370e)

# Conflicts:
#	x-pack/plugins/security_solution/common/experimental_features.ts
#	x-pack/plugins/security_solution/public/timelines/components/timeline/tabs_content/index.tsx
@spong
Copy link
Member

spong commented Jan 2, 2024

Conflicts in:

Conflicting files:
 - /Users/garrettspong/.backport/repositories/elastic/kibana/x-pack/plugins/security_solution/common/experimental_features.ts
 - /Users/garrettspong/.backport/repositories/elastic/kibana/x-pack/plugins/security_solution/public/timelines/components/timeline/tabs_content/index.tsx

For experimental_features.ts I just grabbed the one added here and kept everything as it was in 8.11.

And for tabs_content/index.tsx, I tried to pull only changes from this PR, but it looked like isEsqlSettingEnabled need to come along with. @michaelolo24 or @logeekal, could you please confirm and approve the backport if this is correct?

Note: because this PR was additive to #173640, we shouldn't need that backport anymore. cc @michaelolo24 @semd

edit: I had missed the NOTE over in #173640, so looks like isEsqlSettingEnabled indeed needs to be removed from the backport.

@logeekal
Copy link
Contributor Author

logeekal commented Jan 2, 2024

Thanks @spong , I am checking..

kibanamachine added a commit that referenced this pull request Jan 2, 2024
…n timeline (#174029) (#174110)

# Backport

This will backport the following commits from `main` to `8.12`:
- [[Security Solution] Adds feature flag to enable/disable ESQL in
timeline (#174029)](#174029)

<!--- Backport version: 9.4.3 -->

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

<!--BACKPORT [{"author":{"name":"Jatin
Kathuria","email":"[email protected]"},"sourceCommit":{"committedDate":"2024-01-02T16:53:12Z","message":"[Security
Solution] Adds feature flag to enable/disable ESQL in timeline
(#174029)\n\n## Summary\r\n\r\nThis PR introduces a feature flag
`timelineEsqlTabDisabled` which is by\r\ndefault `false`. This gives
customer ability to disable the esql tab by\r\nenabling this
experimental feature flag as below in
`kibana.yml`\r\n\r\n```yaml\r\nxpack.securitySolution.enableExperimental:\r\n
- timelineEsqlTabDisabled\r\n\r\n```\r\n\r\nThe availability of ESQL Tab
in timeline also affects `AI Assistant` as\r\nit facilities re-directing
user to timeline with an esql query. That\r\n`redirect` button should
not be available for `esql` query if ESQL Tab\r\nis disabled.\r\n\r\n##
Desk Testing\r\n\r\n1. ESQL Tab Presence\r\n - timelineEsqlTabDisabled :
true\r\n- If Tab is disabled, `ESQL` Tab should not show when timeline
is open.\r\nTimeline should also not fire any `bsearch` requests with
`esql`\r\nstrategy.\r\n- ESQL tab is enabled i.e.
`timelineEsqlTabDisabled : true` is present\r\nin kibana.dev.yml\r\n-
User should be able to use ESQL queries without any issue.
Below\r\nshould be the default query in both `8.12` and `8.11.4`\r\n
```esql\r\nfrom\r\n.alerts-security.alerts-default,apm-*-transaction*,auditbeat-*,endgame-*,filebeat-*,logs-*,packetbeat-*,traces-apm*,winlogbeat-*,-*elastic-cloud-logs-*\r\n|
limit 10 | keep @timestamp, message, event.category,
event.action,\r\nhost.name, source.ip, destination.ip, user.name\r\n
```\r\n2. Open ESQL Tab from URL\r\n 1. Enable ESQL tab and Activate it
when in timeline\r\n2. Now change `kibana.dev.yml` to add experimental
flag\r\n`timelineEsqlTabDisabled` to disable ESQL Tab.\r\n 3. Restart
kibana server\r\n 4. Refresh the page in step 1 where `ESQL` tab was
active\r\n 5. User should automatically be redirected to `Query`
tab.\r\n \r\n3. AI Assistant\r\nToday AI Assistant can help user add an
ESQL query to the timeline as\r\nshown in below video.\r\nWe need to
make sure that `Send to timeline` button is not available\r\nonly for
`esql` queries when above experimental flag is enabled.\r\n
\r\n\r\nhttps://github.com/elastic/kibana/assets/7485038/e452a6c6-cf97-462e-a5dc-bd8c0fd38d58\r\n\r\n---------\r\n\r\nCo-authored-by:
Gloria Hornero <[email protected]>\r\nCo-authored-by:
kibanamachine
<[email protected]>","sha":"da0370eafb49f15fe655d0e2b8d254e09c9f814a","branchLabelMapping":{"^v8.13.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:fix","Team:Threat
Hunting:Investigations","v8.11.0","v8.12.0","v8.13.0"],"title":"[Security
Solution] Adds feature flag to enable/disable ESQL in
timeline","number":174029,"url":"https://github.com/elastic/kibana/pull/174029","mergeCommit":{"message":"[Security
Solution] Adds feature flag to enable/disable ESQL in timeline
(#174029)\n\n## Summary\r\n\r\nThis PR introduces a feature flag
`timelineEsqlTabDisabled` which is by\r\ndefault `false`. This gives
customer ability to disable the esql tab by\r\nenabling this
experimental feature flag as below in
`kibana.yml`\r\n\r\n```yaml\r\nxpack.securitySolution.enableExperimental:\r\n
- timelineEsqlTabDisabled\r\n\r\n```\r\n\r\nThe availability of ESQL Tab
in timeline also affects `AI Assistant` as\r\nit facilities re-directing
user to timeline with an esql query. That\r\n`redirect` button should
not be available for `esql` query if ESQL Tab\r\nis disabled.\r\n\r\n##
Desk Testing\r\n\r\n1. ESQL Tab Presence\r\n - timelineEsqlTabDisabled :
true\r\n- If Tab is disabled, `ESQL` Tab should not show when timeline
is open.\r\nTimeline should also not fire any `bsearch` requests with
`esql`\r\nstrategy.\r\n- ESQL tab is enabled i.e.
`timelineEsqlTabDisabled : true` is present\r\nin kibana.dev.yml\r\n-
User should be able to use ESQL queries without any issue.
Below\r\nshould be the default query in both `8.12` and `8.11.4`\r\n
```esql\r\nfrom\r\n.alerts-security.alerts-default,apm-*-transaction*,auditbeat-*,endgame-*,filebeat-*,logs-*,packetbeat-*,traces-apm*,winlogbeat-*,-*elastic-cloud-logs-*\r\n|
limit 10 | keep @timestamp, message, event.category,
event.action,\r\nhost.name, source.ip, destination.ip, user.name\r\n
```\r\n2. Open ESQL Tab from URL\r\n 1. Enable ESQL tab and Activate it
when in timeline\r\n2. Now change `kibana.dev.yml` to add experimental
flag\r\n`timelineEsqlTabDisabled` to disable ESQL Tab.\r\n 3. Restart
kibana server\r\n 4. Refresh the page in step 1 where `ESQL` tab was
active\r\n 5. User should automatically be redirected to `Query`
tab.\r\n \r\n3. AI Assistant\r\nToday AI Assistant can help user add an
ESQL query to the timeline as\r\nshown in below video.\r\nWe need to
make sure that `Send to timeline` button is not available\r\nonly for
`esql` queries when above experimental flag is enabled.\r\n
\r\n\r\nhttps://github.com/elastic/kibana/assets/7485038/e452a6c6-cf97-462e-a5dc-bd8c0fd38d58\r\n\r\n---------\r\n\r\nCo-authored-by:
Gloria Hornero <[email protected]>\r\nCo-authored-by:
kibanamachine
<[email protected]>","sha":"da0370eafb49f15fe655d0e2b8d254e09c9f814a"}},"sourceBranch":"main","suggestedTargetBranches":["8.11","8.12"],"targetPullRequestStates":[{"branch":"8.11","label":"v8.11.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"8.12","label":"v8.12.0","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"main","label":"v8.13.0","branchLabelMappingKey":"^v8.13.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/174029","number":174029,"mergeCommit":{"message":"[Security
Solution] Adds feature flag to enable/disable ESQL in timeline
(#174029)\n\n## Summary\r\n\r\nThis PR introduces a feature flag
`timelineEsqlTabDisabled` which is by\r\ndefault `false`. This gives
customer ability to disable the esql tab by\r\nenabling this
experimental feature flag as below in
`kibana.yml`\r\n\r\n```yaml\r\nxpack.securitySolution.enableExperimental:\r\n
- timelineEsqlTabDisabled\r\n\r\n```\r\n\r\nThe availability of ESQL Tab
in timeline also affects `AI Assistant` as\r\nit facilities re-directing
user to timeline with an esql query. That\r\n`redirect` button should
not be available for `esql` query if ESQL Tab\r\nis disabled.\r\n\r\n##
Desk Testing\r\n\r\n1. ESQL Tab Presence\r\n - timelineEsqlTabDisabled :
true\r\n- If Tab is disabled, `ESQL` Tab should not show when timeline
is open.\r\nTimeline should also not fire any `bsearch` requests with
`esql`\r\nstrategy.\r\n- ESQL tab is enabled i.e.
`timelineEsqlTabDisabled : true` is present\r\nin kibana.dev.yml\r\n-
User should be able to use ESQL queries without any issue.
Below\r\nshould be the default query in both `8.12` and `8.11.4`\r\n
```esql\r\nfrom\r\n.alerts-security.alerts-default,apm-*-transaction*,auditbeat-*,endgame-*,filebeat-*,logs-*,packetbeat-*,traces-apm*,winlogbeat-*,-*elastic-cloud-logs-*\r\n|
limit 10 | keep @timestamp, message, event.category,
event.action,\r\nhost.name, source.ip, destination.ip, user.name\r\n
```\r\n2. Open ESQL Tab from URL\r\n 1. Enable ESQL tab and Activate it
when in timeline\r\n2. Now change `kibana.dev.yml` to add experimental
flag\r\n`timelineEsqlTabDisabled` to disable ESQL Tab.\r\n 3. Restart
kibana server\r\n 4. Refresh the page in step 1 where `ESQL` tab was
active\r\n 5. User should automatically be redirected to `Query`
tab.\r\n \r\n3. AI Assistant\r\nToday AI Assistant can help user add an
ESQL query to the timeline as\r\nshown in below video.\r\nWe need to
make sure that `Send to timeline` button is not available\r\nonly for
`esql` queries when above experimental flag is enabled.\r\n
\r\n\r\nhttps://github.com/elastic/kibana/assets/7485038/e452a6c6-cf97-462e-a5dc-bd8c0fd38d58\r\n\r\n---------\r\n\r\nCo-authored-by:
Gloria Hornero <[email protected]>\r\nCo-authored-by:
kibanamachine
<[email protected]>","sha":"da0370eafb49f15fe655d0e2b8d254e09c9f814a"}}]}]
BACKPORT-->

Co-authored-by: Jatin Kathuria <[email protected]>
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.

7 participants