[SIEM][Detection Engine] Fixes a bug with signalsIndex key for configuration (#52603)

## Summary

* Simple small bug fix so that the `signalsIndex` works again.

Without this any developer starting up Kibana with their `xpack.siem.signalsIndex` set will get a quick crash.

Test:
Add this key to your `kibana.dev.yml`
```sh
xpack.siem.signalsIndex: .siem-signals-your-name
```

Ensure it starts up without crashing. Take the key out, ensure it starts up without crashing.

In the folder:
```sh
detection_engine/scripts
```

You can run this and get back the index you expect which is whatever you set the key to and the space you're in:

```sh
./get_signal_index.sh 
{
  "name": ".siem-signals-your-name-default"
}
```

### Checklist

Use ~~strikethroughs~~ to remove checklist items you don't feel are applicable to this PR.

~~- [ ] This was checked for cross-browser compatibility, [including a check against IE11](https://github.com/elastic/kibana/blob/master/CONTRIBUTING.md#cross-browser-compatibility)~~

~~- [ ] Any text added follows [EUI's writing guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses sentence case text and includes [i18n support](https://github.com/elastic/kibana/blob/master/packages/kbn-i18n/README.md)~~

~~- [ ] [Documentation](https://github.com/elastic/kibana/blob/master/CONTRIBUTING.md#writing-documentation) was added for features that require explanation or tutorials~~

~~- [ ] [Unit or functional tests](https://github.com/elastic/kibana/blob/master/CONTRIBUTING.md#cross-browser-compatibility) were updated or added to match the most common scenarios~~

~~- [ ] This was checked for [keyboard-only and screenreader accessibility](https://developer.mozilla.org/en-US/docs/Learn/Tools_and_testing/Cross_browser_testing/Accessibility#Accessibility_testing_checklist)~~

### For maintainers

~~- [ ] This was checked for breaking API changes and was [labeled appropriately](https://github.com/elastic/kibana/blob/master/CONTRIBUTING.md#release-notes-process)~~

- [x] This includes a feature addition or change that requires a release note and was [labeled appropriately](https://github.com/elastic/kibana/blob/master/CONTRIBUTING.md#release-notes-process)
This commit is contained in:
Frank Hassanabad 2019-12-09 22:15:22 -07:00 committed by GitHub
parent d7492183dc
commit ca36a986ae
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 1 deletions

View file

@ -150,13 +150,16 @@ export const siem = (kibana: any) => {
},
route: route.bind(server),
};
// @ts-ignore-next-line: setup.plugins is too loosely typed
plugin(initializerContext).setup(setup.core, setup.plugins);
initServerWithKibana(initializerContext, serverFacade);
},
config(Joi: Root) {
// See x-pack/plugins/siem/server/config.ts if you're adding another
// value where the configuration has to be duplicated at the moment.
// When we move over to the new platform completely this will be
// removed and only server/config.ts should be used.
return Joi.object()
.keys({
enabled: Joi.boolean().default(true),

View file

@ -7,9 +7,14 @@
import { Observable } from 'rxjs';
import { schema, TypeOf } from '@kbn/config-schema';
import { PluginInitializerContext } from 'src/core/server';
import {
SIGNALS_INDEX_KEY,
DEFAULT_SIGNALS_INDEX,
} from '../../../legacy/plugins/siem/common/constants';
export const configSchema = schema.object({
enabled: schema.boolean({ defaultValue: true }),
[SIGNALS_INDEX_KEY]: schema.string({ defaultValue: DEFAULT_SIGNALS_INDEX }),
});
export const createConfig$ = (context: PluginInitializerContext) =>