Skip to content

Commit

Permalink
[SIEM][Detection Engine] Fixes a bug with signalsIndex key for config…
Browse files Browse the repository at this point in the history
…uration

## 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)
  • Loading branch information
FrankHassanabad committed Dec 10, 2019
1 parent 6ea1b2c commit 5fb59f3
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
5 changes: 4 additions & 1 deletion x-pack/legacy/plugins/siem/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down
5 changes: 5 additions & 0 deletions x-pack/plugins/siem/server/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) =>
Expand Down

0 comments on commit 5fb59f3

Please sign in to comment.