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] Bug nav link not hidden #70607

Merged
merged 3 commits into from
Jul 6, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions x-pack/plugins/security_solution/common/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,16 @@ export const DEFAULT_TIMEPICKER_QUICK_RANGES = 'timepicker:quickRanges';
export const NO_ALERT_INDEX = 'no-alert-index-049FC71A-4C2C-446F-9901-37XMC5024C51';
export const ENDPOINT_METADATA_INDEX = 'metrics-endpoint.metadata-*';

export enum SecurityPageName {
alerts = 'alerts',
overview = 'overview',
hosts = 'hosts',
network = 'network',
timelines = 'timelines',
case = 'case',
management = 'management',
}

export const APP_OVERVIEW_PATH = `${APP_PATH}/overview`;
export const APP_ALERTS_PATH = `${APP_PATH}/alerts`;
export const APP_HOSTS_PATH = `${APP_PATH}/hosts`;
Expand Down
10 changes: 1 addition & 9 deletions x-pack/plugins/security_solution/public/app/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,8 @@ import { State, SubPluginsInitReducer } from '../common/store';
import { Immutable } from '../../common/endpoint/types';
import { AppAction } from '../common/store/actions';
import { TimelineState } from '../timelines/store/timeline/types';
export { SecurityPageName } from '../../common/constants';

export enum SecurityPageName {
alerts = 'alerts',
overview = 'overview',
hosts = 'hosts',
network = 'network',
timelines = 'timelines',
case = 'case',
management = 'management',
}
export interface SecuritySubPluginStore<K extends SecuritySubPluginKeyStore, T> {
initialState: Record<K, T | undefined>;
reducer: Record<K, Reducer<T, AnyAction>>;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export const createTimelinesRoute = (
body: buildRouteValidation(createTimelineSchema),
},
options: {
tags: ['access:siem'],
tags: ['access:securitySolution'],
},
},
async (context, request, response) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export const updateTimelinesRoute = (
body: buildRouteValidation(updateTimelineSchema),
},
options: {
tags: ['access:siem'],
tags: ['access:securitySolution'],
},
},
// eslint-disable-next-line complexity
Expand Down
21 changes: 16 additions & 5 deletions x-pack/plugins/security_solution/server/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ import { initSavedObjects, savedObjectTypes } from './saved_objects';
import { AppClientFactory } from './client';
import { createConfig$, ConfigType } from './config';
import { initUiSettings } from './ui_settings';
import { APP_ID, APP_ICON, SERVER_APP_ID } from '../common/constants';
import { APP_ID, APP_ICON, SERVER_APP_ID, SecurityPageName } from '../common/constants';
import { registerEndpointRoutes } from './endpoint/routes/metadata';
import { registerResolverRoutes } from './endpoint/routes/resolver';
import { registerPolicyRoutes } from './endpoint/routes/policy';
Expand Down Expand Up @@ -70,6 +70,17 @@ export interface PluginSetup {}
// eslint-disable-next-line @typescript-eslint/no-empty-interface
export interface PluginStart {}

const securitySubPlugins = [
APP_ID,
`${APP_ID}:${SecurityPageName.overview}`,
`${APP_ID}:${SecurityPageName.alerts}`,
`${APP_ID}:${SecurityPageName.hosts}`,
`${APP_ID}:${SecurityPageName.network}`,
`${APP_ID}:${SecurityPageName.timelines}`,
`${APP_ID}:${SecurityPageName.case}`,
`${APP_ID}:${SecurityPageName.management}`,
];

export class Plugin implements IPlugin<PluginSetup, PluginStart, SetupPlugins, StartPlugins> {
private readonly logger: Logger;
private readonly config$: Observable<ConfigType>;
Expand Down Expand Up @@ -144,12 +155,12 @@ export class Plugin implements IPlugin<PluginSetup, PluginStart, SetupPlugins, S
}),
order: 1100,
icon: APP_ICON,
navLinkId: 'securitySolution',
app: ['securitySolution', 'kibana'],
navLinkId: APP_ID,
app: [...securitySubPlugins, 'kibana'],
catalogue: ['securitySolution'],
privileges: {
all: {
app: ['securitySolution', 'kibana'],
app: [...securitySubPlugins, 'kibana'],
catalogue: ['securitySolution'],
api: ['securitySolution', 'actions-read', 'actions-all', 'alerting-read', 'alerting-all'],
savedObject: {
Expand Down Expand Up @@ -177,7 +188,7 @@ export class Plugin implements IPlugin<PluginSetup, PluginStart, SetupPlugins, S
],
},
read: {
app: ['securitySolution', 'kibana'],
app: [...securitySubPlugins, 'kibana'],
catalogue: ['securitySolution'],
api: ['securitySolution', 'actions-read', 'actions-all', 'alerting-read', 'alerting-all'],
savedObject: {
Expand Down