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] [Detections] Remove allow_no_indices to prevent error being thrown in response of field capabilities #89927

Merged
merged 5 commits into from
Feb 2, 2021

Conversation

dhurley14
Copy link
Contributor

@dhurley14 dhurley14 commented Feb 1, 2021

Summary

Removes allow_no_indices param. Specifying this option meant that our field_capabilities check was throwing an error if the rule included an index pattern that did not exist. This would be most typical in e.g. a prepackaged rule using the default index patterns.

If we pass the field capabilities api an index pattern that does not match any indices in Elasticsearch, that index pattern is not returned as a part of the response with indices that have that field "unmapped". This adds a check if the response from field capabilities api has empty indices property then write error status with index patterns provided to rule. This essentially tells the user there are no concrete indices matching any of the provided index patterns.

Checklist

Delete any items that are not applicable to this PR.

For maintainers

@dhurley14 dhurley14 requested review from a team as code owners February 1, 2021 20:33
@dhurley14 dhurley14 self-assigned this Feb 1, 2021
@dhurley14 dhurley14 added bug Fixes for quality problems that affect the customer experience release_note:skip Skip the PR/issue when compiling release notes review Team: SecuritySolution Security Solutions Team working on SIEM, Endpoint, Timeline, Resolver, etc. Team:Detections and Resp Security Detection Response Team v7.11.0 v7.12.0 v8.0.0 labels Feb 1, 2021
@elasticmachine
Copy link
Contributor

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

@elasticmachine
Copy link
Contributor

Pinging @elastic/security-detections-response (Team:Detections and Resp)

@dhurley14 dhurley14 added the Feature:Detection Rules Anything related to Security Solution's Detection Rules label Feb 1, 2021
@dhurley14 dhurley14 changed the title [Security Solution] [Detections] [Security Solution] [Detections] Remove allow_no_indices to prevent error being thrown in response of field capabilities Feb 1, 2021
Copy link
Contributor

@rylnd rylnd left a comment

Choose a reason for hiding this comment

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

It looks like there are still some failing integration tests that were relying on the previous rule behavior. Related to this, it would be nice to have an integration test that explicitly captures this new behavior: the rule will fail with an error if no source indices exist.

LGTM once CI is happy 👍

@dhurley14
Copy link
Contributor Author

@elasticmachine merge upstream

…ices property then write error status with index patterns provided to rule
…e should fail and when one index pattern does exist but another does not, the rule should succeed
@kibanamachine
Copy link
Contributor

💚 Build Succeeded

Metrics [docs]

✅ unchanged

History

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

@dhurley14 dhurley14 merged commit 198c6fb into elastic:master Feb 2, 2021
@dhurley14 dhurley14 deleted the fix-privileges-indices-error branch February 2, 2021 19:07
dhurley14 added a commit to dhurley14/kibana that referenced this pull request Feb 2, 2021
…rror being thrown in response of field capabilities (elastic#89927)

* remove allow_no_indices param, adds a check if response has empty indices property then write error status with index patterns provided to rule

* fix tests

* fix tests and update with comments

* update integration tests

* adds integration test for when an index pattern doesn't exist the rule should fail and when one index pattern does exist but another does not, the rule should succeed
dhurley14 added a commit to dhurley14/kibana that referenced this pull request Feb 2, 2021
…rror being thrown in response of field capabilities (elastic#89927)

* remove allow_no_indices param, adds a check if response has empty indices property then write error status with index patterns provided to rule

* fix tests

* fix tests and update with comments

* update integration tests

* adds integration test for when an index pattern doesn't exist the rule should fail and when one index pattern does exist but another does not, the rule should succeed
phillipb added a commit to phillipb/kibana that referenced this pull request Feb 2, 2021
…-ml-jobs

* 'master' of github.com:elastic/kibana: (254 commits)
  [Security Solution] [Detections] Remove allow_no_indices to prevent error being thrown in response of field capabilities (elastic#89927)
  Skip test for cloud (elastic#89450)
  [Fleet] Fix duplicate data streams being shown in UI (elastic#89812)
  Bump package dependencies (elastic#90034)
  [App Search] DRY helper for encoding/decoding routes that can have special characters in params (elastic#89811)
  TypeScript project references for Observability plugin (elastic#89320)
  [SearchSource] Combine sort and parent fields when serializing (elastic#89808)
  Made imports static (elastic#89935)
  [ml] migrate file_data_visualizer/import route to file_upload plugin (elastic#89640)
  [Discover] Adapt default column behavior (elastic#89826)
  Round start and end values (elastic#89030)
  Rename getProxyAgents to getCustomAgents (elastic#89813)
  [Form lib] UseField `onError` listener (elastic#89895)
  [APM] use latency sum instead of avg for impact (elastic#89990)
  migrate more core-owned plugins to tsproject ref (elastic#89975)
  [Logs UI] Load <LogStream> entries via async searches (elastic#86899)
  [APM] Abort browser requests when appropriate (elastic#89557)
  [Alerting] Allow user to select existing connector of same type when fixing broken connector (elastic#89062)
  [Data Table] Use shared CSV export mechanism (elastic#89702)
  chore(NA): improve logic check when installing Bazel tools (elastic#89634)
  ...
dhurley14 added a commit that referenced this pull request Feb 2, 2021
…vent error being thrown in response of field capabilities (#89927) (#90072)

* remove allow_no_indices param, adds a check if response has empty indices property then write error status with index patterns provided to rule

* fix tests

* fix tests and update with comments

* update integration tests

* adds integration test for when an index pattern doesn't exist the rule should fail and when one index pattern does exist but another does not, the rule should succeed
dhurley14 added a commit that referenced this pull request Feb 2, 2021
…event error being thrown in response of field capabilities (#89927) (#90073)

* remove allow_no_indices param, adds a check if response has empty indices property then write error status with index patterns provided to rule

* fix tests

* fix tests and update with comments

* update integration tests

* adds integration test for when an index pattern doesn't exist the rule should fail and when one index pattern does exist but another does not, the rule should succeed
@@ -46,11 +47,13 @@ export default ({ getService }: FtrProviderContext) => {
describe('creating rules', () => {
beforeEach(async () => {
await createSignalsIndex(supertest);
await esArchiver.load('auditbeat/hosts');
Copy link
Contributor

Choose a reason for hiding this comment

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

For posterity: these indices were added so that the rule would not fail on the initial permissions check due to a lack of indices.

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 Feature:Detection Rules Anything related to Security Solution's Detection Rules release_note:skip Skip the PR/issue when compiling release notes review Team:Detections and Resp Security Detection Response Team Team: SecuritySolution Security Solutions Team working on SIEM, Endpoint, Timeline, Resolver, etc. v7.11.0 v7.12.0 v8.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants