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][Bug] Add privilege check in open timeline #147964

Merged

Conversation

christineweng
Copy link
Contributor

@christineweng christineweng commented Dec 21, 2022

Summary

This PR contains fixe for #147544. On Timelines page, a Kibana read-only user was able to see and click on options to create and duplicate timelines. This PR fixes this bug by checking user privilege (have crud access) before showing timeline actions.

After:

User with read only access to kibana security solutions can:

  1. select timelines
  2. export timelines
  3. export timelines in bulk

User with crud access to kibana security solutions can:

  1. select timelines
  2. have the options to modify timelines as before
  3. bulk actions include delete timelines and export timelines
  4. see and click on 'import', ' Create new timeline', 'Create new timeline template' buttons

User with read access but not crud access

  • Have access to export ('Export selected'), cannot see 'Create new timeline' buttons
    image

  • 'Export selected' in bulk actions
    image

image

User with full access

image

  • 'Export selected' and 'Delete selected' available in bulk actions dropdown
    image

Checklist

@christineweng christineweng added release_note:skip Skip the PR/issue when compiling release notes Team:Threat Hunting Security Solution Threat Hunting Team Team: SecuritySolution Security Solutions Team working on SIEM, Endpoint, Timeline, Resolver, etc. Feature:Timeline Security Solution Timeline feature Team:Threat Hunting:Investigations Security Solution Investigations Team v8.6.0 v8.7.0 labels Dec 21, 2022
@christineweng christineweng requested a review from a team as a code owner December 21, 2022 23:26
@christineweng christineweng self-assigned this Dec 21, 2022
@elasticmachine
Copy link
Contributor

Pinging @elastic/security-threat-hunting (Team:Threat Hunting)

@elasticmachine
Copy link
Contributor

Pinging @elastic/security-solution (Team: SecuritySolution)

@christineweng christineweng enabled auto-merge (squash) December 21, 2022 23:27
@michaelolo24
Copy link
Contributor

@christineweng per @kqualters-elastic's comment from the issue I think allowing users to still export a timeline makes sense

@christineweng christineweng marked this pull request as draft December 22, 2022 19:08
auto-merge was automatically disabled December 22, 2022 19:08

Pull request was converted to draft

@christineweng christineweng marked this pull request as ready for review December 22, 2022 22:24
@christineweng
Copy link
Contributor Author

@elasticmachine merge upstream

Copy link
Contributor

@PhilippeOberti PhilippeOberti left a comment

Choose a reason for hiding this comment

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

the code looks good and works, I just left a minor UI comment, doesn't seem like it would prevent merging the PR though... up to you!

@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 12.5MB 12.6MB +1.2KB

History

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

cc @christineweng

@christineweng christineweng merged commit 3abf705 into elastic:main Jan 3, 2023
@kibanamachine
Copy link
Contributor

💔 All backports failed

Status Branch Result
8.6 Backport failed because of merge conflicts

Manual backport

To create the backport manually run:

node scripts/backport --pr 147964

Questions ?

Please refer to the Backport tool documentation

@kibanamachine kibanamachine added the backport missing Added to PRs automatically when the are determined to be missing a backport. label Jan 5, 2023
@kibanamachine
Copy link
Contributor

Friendly reminder: Looks like this PR hasn’t been backported yet.
To create automatically backports add the label auto-backport or prevent reminders by adding the backport:skip label.
You can also create backports manually by running node scripts/backport --pr 147964 locally

1 similar comment
@kibanamachine
Copy link
Contributor

Friendly reminder: Looks like this PR hasn’t been backported yet.
To create automatically backports add the label auto-backport or prevent reminders by adding the backport:skip label.
You can also create backports manually by running node scripts/backport --pr 147964 locally

christineweng added a commit to christineweng/kibana that referenced this pull request Jan 9, 2023
…c#147964)

This PR contains fixe for
elastic#147544. On Timelines page, a
Kibana read-only user was able to see and click on options to create and
duplicate timelines. This PR fixes this bug by checking user privilege
(have crud access) before showing timeline actions.

User with read only access to kibana security solutions can:
1) select timelines
2) export timelines
3) export timelines in bulk

User with crud access to kibana security solutions can:
1) select timelines
2) have the options to modify timelines as before
3) bulk actions include delete timelines and export timelines
4) see and click on 'import', ' Create new timeline', 'Create new
timeline template' buttons

- Have access to export ('Export selected'), cannot see 'Create new
timeline' buttons

![image](https://user-images.githubusercontent.com/18648970/209210913-0554bc4c-5c8e-45ae-8e27-54a7e33e3f8e.png)

- 'Export selected' in bulk actions

![image](https://user-images.githubusercontent.com/18648970/209210992-f102d8d4-479f-4d0a-84c2-125cc754c5ce.png)

![image](https://user-images.githubusercontent.com/18648970/209021998-fbe0b63d-8dfd-4098-9774-7423899a45e1.png)

![image](https://user-images.githubusercontent.com/18648970/209209755-b5e5ce2b-0af9-42c6-b1cc-64a2675bf19d.png)

- 'Export selected' and 'Delete selected' available in bulk actions
dropdown

![image](https://user-images.githubusercontent.com/18648970/210408773-0fc5b100-0f57-4526-9c8f-0aba1f1d0e76.png)

- [x] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
(cherry picked from commit 3abf705)
christineweng added a commit to christineweng/kibana that referenced this pull request Jan 9, 2023
…c#147964)

## Summary

This PR contains fixe for
elastic#147544. On Timelines page, a
Kibana read-only user was able to see and click on options to create and
duplicate timelines. This PR fixes this bug by checking user privilege
(have crud access) before showing timeline actions.

## After:
User with read only access to kibana security solutions can:
1) select timelines
2) export timelines
3) export timelines in bulk

User with crud access to kibana security solutions can:
1) select timelines
2) have the options to modify timelines as before
3) bulk actions include delete timelines and export timelines
4) see and click on 'import', ' Create new timeline', 'Create new
timeline template' buttons

### User with read access but not crud access
- Have access to export ('Export selected'), cannot see 'Create new
timeline' buttons

![image](https://user-images.githubusercontent.com/18648970/209210913-0554bc4c-5c8e-45ae-8e27-54a7e33e3f8e.png)

- 'Export selected' in bulk actions

![image](https://user-images.githubusercontent.com/18648970/209210992-f102d8d4-479f-4d0a-84c2-125cc754c5ce.png)

![image](https://user-images.githubusercontent.com/18648970/209021998-fbe0b63d-8dfd-4098-9774-7423899a45e1.png)

### User with full access

![image](https://user-images.githubusercontent.com/18648970/209209755-b5e5ce2b-0af9-42c6-b1cc-64a2675bf19d.png)

- 'Export selected' and 'Delete selected' available in bulk actions
dropdown

![image](https://user-images.githubusercontent.com/18648970/210408773-0fc5b100-0f57-4526-9c8f-0aba1f1d0e76.png)

### Checklist

- [x] [Unit or functional
tests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)
were updated or added to match the most common scenarios

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
(cherry picked from commit 3abf705)

# Conflicts:
#	x-pack/plugins/security_solution/public/timelines/components/open_timeline/open_timeline.test.tsx
#	x-pack/plugins/security_solution/public/timelines/components/open_timeline/open_timeline.tsx
#	x-pack/plugins/security_solution/public/timelines/components/open_timeline/timelines_table/actions_columns.tsx
@christineweng
Copy link
Contributor Author

💚 All backports created successfully

Status Branch Result
8.6

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

Questions ?

Please refer to the Backport tool documentation

@kibanamachine
Copy link
Contributor

Looks like this PR has a backport PR but it still hasn't been merged. Please merge it ASAP to keep the branches relatively in sync.

christineweng added a commit that referenced this pull request Jan 9, 2023
…147964) (#148587)

# Backport

This will backport the following commits from `main` to `8.6`:
- [[Security Solution][Bug] Add privilege check in open timeline
(#147964)](#147964)

<!--- Backport version: 8.9.4 -->

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

<!--BACKPORT
[{"author":{"name":"christineweng","email":"18648970+christineweng@users.noreply.github.com"},"sourceCommit":{"committedDate":"2023-01-03T19:21:48Z","message":"[Security
Solution][Bug] Add privilege check in open timeline (#147964)\n\n##
Summary\r\n\r\nThis PR contains fixe
for\r\nhttps://github.com//issues/147544. On Timelines
page, a\r\nKibana read-only user was able to see and click on options to
create and\r\nduplicate timelines. This PR fixes this bug by checking
user privilege\r\n(have crud access) before showing timeline
actions.\r\n\r\n## After: \r\nUser with read only access to kibana
security solutions can: \r\n1) select timelines\r\n2) export
timelines\r\n3) export timelines in bulk\r\n\r\nUser with crud access to
kibana security solutions can: \r\n1) select timelines\r\n2) have the
options to modify timelines as before\r\n3) bulk actions include delete
timelines and export timelines\r\n4) see and click on 'import', ' Create
new timeline', 'Create new\r\ntimeline template' buttons\r\n\r\n### User
with read access but not crud access\r\n- Have access to export ('Export
selected'), cannot see 'Create new\r\ntimeline'
buttons\r\n\r\n![image](https://user-images.githubusercontent.com/18648970/209210913-0554bc4c-5c8e-45ae-8e27-54a7e33e3f8e.png)\r\n\r\n-
'Export selected' in bulk
actions\r\n\r\n![image](https://user-images.githubusercontent.com/18648970/209210992-f102d8d4-479f-4d0a-84c2-125cc754c5ce.png)\r\n\r\n\r\n![image](https://user-images.githubusercontent.com/18648970/209021998-fbe0b63d-8dfd-4098-9774-7423899a45e1.png)\r\n\r\n###
User with full
access\r\n\r\n![image](https://user-images.githubusercontent.com/18648970/209209755-b5e5ce2b-0af9-42c6-b1cc-64a2675bf19d.png)\r\n\r\n-
'Export selected' and 'Delete selected' available in bulk
actions\r\ndropdown\r\n\r\n![image](https://user-images.githubusercontent.com/18648970/210408773-0fc5b100-0f57-4526-9c8f-0aba1f1d0e76.png)\r\n\r\n###
Checklist\r\n\r\n- [x] [Unit or
functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere
updated or added to match the most common
scenarios\r\n\r\nCo-authored-by: Kibana Machine
<42973632+kibanamachine@users.noreply.github.com>","sha":"3abf705b10926d3c6221504dd5575b97d15c9a31","branchLabelMapping":{"^v8.7.0$":"main","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","backport
missing","Team:Threat Hunting","Team:
SecuritySolution","Feature:Timeline","Team:Threat
Hunting:Investigations","v8.6.0","v8.7.0"],"number":147964,"url":"#147964
Solution][Bug] Add privilege check in open timeline (#147964)\n\n##
Summary\r\n\r\nThis PR contains fixe
for\r\nhttps://github.com//issues/147544. On Timelines
page, a\r\nKibana read-only user was able to see and click on options to
create and\r\nduplicate timelines. This PR fixes this bug by checking
user privilege\r\n(have crud access) before showing timeline
actions.\r\n\r\n## After: \r\nUser with read only access to kibana
security solutions can: \r\n1) select timelines\r\n2) export
timelines\r\n3) export timelines in bulk\r\n\r\nUser with crud access to
kibana security solutions can: \r\n1) select timelines\r\n2) have the
options to modify timelines as before\r\n3) bulk actions include delete
timelines and export timelines\r\n4) see and click on 'import', ' Create
new timeline', 'Create new\r\ntimeline template' buttons\r\n\r\n### User
with read access but not crud access\r\n- Have access to export ('Export
selected'), cannot see 'Create new\r\ntimeline'
buttons\r\n\r\n![image](https://user-images.githubusercontent.com/18648970/209210913-0554bc4c-5c8e-45ae-8e27-54a7e33e3f8e.png)\r\n\r\n-
'Export selected' in bulk
actions\r\n\r\n![image](https://user-images.githubusercontent.com/18648970/209210992-f102d8d4-479f-4d0a-84c2-125cc754c5ce.png)\r\n\r\n\r\n![image](https://user-images.githubusercontent.com/18648970/209021998-fbe0b63d-8dfd-4098-9774-7423899a45e1.png)\r\n\r\n###
User with full
access\r\n\r\n![image](https://user-images.githubusercontent.com/18648970/209209755-b5e5ce2b-0af9-42c6-b1cc-64a2675bf19d.png)\r\n\r\n-
'Export selected' and 'Delete selected' available in bulk
actions\r\ndropdown\r\n\r\n![image](https://user-images.githubusercontent.com/18648970/210408773-0fc5b100-0f57-4526-9c8f-0aba1f1d0e76.png)\r\n\r\n###
Checklist\r\n\r\n- [x] [Unit or
functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere
updated or added to match the most common
scenarios\r\n\r\nCo-authored-by: Kibana Machine
<42973632+kibanamachine@users.noreply.github.com>","sha":"3abf705b10926d3c6221504dd5575b97d15c9a31"}},"sourceBranch":"main","suggestedTargetBranches":["8.6"],"targetPullRequestStates":[{"branch":"8.6","label":"v8.6.0","labelRegex":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"main","label":"v8.7.0","labelRegex":"^v8.7.0$","isSourceBranch":true,"state":"MERGED","url":"#147964
Solution][Bug] Add privilege check in open timeline (#147964)\n\n##
Summary\r\n\r\nThis PR contains fixe
for\r\nhttps://github.com//issues/147544. On Timelines
page, a\r\nKibana read-only user was able to see and click on options to
create and\r\nduplicate timelines. This PR fixes this bug by checking
user privilege\r\n(have crud access) before showing timeline
actions.\r\n\r\n## After: \r\nUser with read only access to kibana
security solutions can: \r\n1) select timelines\r\n2) export
timelines\r\n3) export timelines in bulk\r\n\r\nUser with crud access to
kibana security solutions can: \r\n1) select timelines\r\n2) have the
options to modify timelines as before\r\n3) bulk actions include delete
timelines and export timelines\r\n4) see and click on 'import', ' Create
new timeline', 'Create new\r\ntimeline template' buttons\r\n\r\n### User
with read access but not crud access\r\n- Have access to export ('Export
selected'), cannot see 'Create new\r\ntimeline'
buttons\r\n\r\n![image](https://user-images.githubusercontent.com/18648970/209210913-0554bc4c-5c8e-45ae-8e27-54a7e33e3f8e.png)\r\n\r\n-
'Export selected' in bulk
actions\r\n\r\n![image](https://user-images.githubusercontent.com/18648970/209210992-f102d8d4-479f-4d0a-84c2-125cc754c5ce.png)\r\n\r\n\r\n![image](https://user-images.githubusercontent.com/18648970/209021998-fbe0b63d-8dfd-4098-9774-7423899a45e1.png)\r\n\r\n###
User with full
access\r\n\r\n![image](https://user-images.githubusercontent.com/18648970/209209755-b5e5ce2b-0af9-42c6-b1cc-64a2675bf19d.png)\r\n\r\n-
'Export selected' and 'Delete selected' available in bulk
actions\r\ndropdown\r\n\r\n![image](https://user-images.githubusercontent.com/18648970/210408773-0fc5b100-0f57-4526-9c8f-0aba1f1d0e76.png)\r\n\r\n###
Checklist\r\n\r\n- [x] [Unit or
functional\r\ntests](https://www.elastic.co/guide/en/kibana/master/development-tests.html)\r\nwere
updated or added to match the most common
scenarios\r\n\r\nCo-authored-by: Kibana Machine
<42973632+kibanamachine@users.noreply.github.com>","sha":"3abf705b10926d3c6221504dd5575b97d15c9a31"}}]}]
BACKPORT-->

Co-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>
@kibanamachine kibanamachine removed the backport missing Added to PRs automatically when the are determined to be missing a backport. label Jan 9, 2023
@mistic mistic added v8.6.1 and removed v8.6.0 labels Jan 10, 2023
@mistic
Copy link
Member

mistic commented Jan 10, 2023

The backport was not included on v8.6.0 at it happened after the build candidate. Changing the label to v8.6.1.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature:Timeline Security Solution Timeline feature release_note:skip Skip the PR/issue when compiling release notes Team: SecuritySolution Security Solutions Team working on SIEM, Endpoint, Timeline, Resolver, etc. Team:Threat Hunting:Investigations Security Solution Investigations Team Team:Threat Hunting Security Solution Threat Hunting Team v8.6.1 v8.7.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants