Skip to content

Commit

Permalink
Merge branch '7.x' of github.com:elastic/kibana into security/ml-priv…
Browse files Browse the repository at this point in the history
…ileges-deprecation
  • Loading branch information
legrego committed Oct 19, 2021
2 parents a6a41a9 + ea296ce commit 08a450a
Show file tree
Hide file tree
Showing 291 changed files with 3,915 additions and 10,769 deletions.
2 changes: 1 addition & 1 deletion docs/getting-started/quick-start-guide.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ image::images/dashboard_sampleDataAddFilter_7.15.0.png[The [eCommerce] Revenue D
[[quick-start-whats-next]]
== What's next?

*Add your own data.* Ready to add your own data? Go to {fleet-guide}/fleet-quick-start.html[Quick start: Get logs and metrics into the Elastic Stack] to learn how to ingest your data, or go to <<connect-to-elasticsearch,Add data to {kib}>> and learn about all the other ways you can add data.
*Add your own data.* Ready to add your own data? Go to {observability-guide}/ingest-logs-metrics-uptime.html[Ingest logs, metrics, and uptime data with {agent}], or go to <<connect-to-elasticsearch,Add data to {kib}>> and learn about all the other ways you can add data.

*Explore your own data in Discover.* Ready to learn more about exploring your data in *Discover*? Go to <<discover, Discover>>.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,13 +72,11 @@ image::management/connectors/images/servicenow-sir-params-test.png[ServiceNow Se
ServiceNow SecOps actions have the following configuration properties.

Short description:: A short description for the incident, used for searching the contents of the knowledge base.
Source Ips:: A list of source IPs related to the incident. The IPs will be added as observables to the security incident.
Destination Ips:: A list of destination IPs related to the incident. The IPs will be added as observables to the security incident.
Malware URLs:: A list of malware URLs related to the incident. The URLs will be added as observables to the security incident.
Malware Hashes:: A list of malware hashes related to the incident. The hashes will be added as observables to the security incident.
Priority:: The priority of the incident.
Category:: The category of the incident.
Subcategory:: The subcategory of the incident.
Correlation ID:: All actions sharing this ID will be associated with the same ServiceNow security incident. If an incident exists in ServiceNow with the same correlation ID the security incident will be updated. Default value: `<rule ID>:<alert instance ID>`.
Correlation Display:: A descriptive label of the alert for correlation purposes in ServiceNow.
Description:: The details about the incident.
Additional comments:: Additional information for the client, such as how to troubleshoot the issue.

Expand Down
2 changes: 2 additions & 0 deletions docs/management/connectors/action-types/servicenow.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,8 @@ Severity:: The severity of the incident.
Impact:: The effect an incident has on business. Can be measured by the number of affected users or by how critical it is to the business in question.
Category:: The category of the incident.
Subcategory:: The category of the incident.
Correlation ID:: All actions sharing this ID will be associated with the same ServiceNow incident. If an incident exists in ServiceNow with the same correlation ID the incident will be updated. Default value: `<rule ID>:<alert instance ID>`.
Correlation Display:: A descriptive label of the alert for correlation purposes in ServiceNow.
Short description:: A short description for the incident, used for searching the contents of the knowledge base.
Description:: The details about the incident.
Additional comments:: Additional information for the client, such as how to troubleshoot the issue.
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion docs/osquery/osquery.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,7 @@ The following is an example of an **error response** for an undefined action que
== System requirements

* {fleet-guide}/fleet-overview.html[Fleet] is enabled on your cluster, and
one or more {fleet-guide}/elastic-agent-installation-configuration.html[Elastic Agents] is enrolled.
one or more {fleet-guide}/elastic-agent-installation.html[Elastic Agents] is enrolled.
* The https://docs.elastic.co/en/integrations/osquery_manager[*Osquery Manager*] integration
has been added and configured
for an agent policy through Fleet.
Expand Down
2 changes: 1 addition & 1 deletion docs/setup/connect-to-elasticsearch.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ so you can quickly get insights into your data, and {fleet} mode offers several
image::images/addData_fleet_7.15.0.png[Add data using Fleet]

To get started, refer to
{fleet-guide}/fleet-quick-start.html[Quick start: Get logs and metrics into the Elastic Stack].
{observability-guide}/ingest-logs-metrics-uptime.html[Ingest logs, metrics, and uptime data with {agent}].

[discrete]
[[upload-data-kibana]]
Expand Down
2 changes: 1 addition & 1 deletion docs/setup/settings.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -291,7 +291,7 @@ that the {kib} server uses to perform maintenance on the {kib} index at startup.
is an alternative to `elasticsearch.username` and `elasticsearch.password`.

| `enterpriseSearch.host`
| The URL of your Enterprise Search instance
| The http(s) URL of your Enterprise Search instance. For example, in a local self-managed setup, set this to `http://localhost:3002`. Authentication between Kibana and the Enterprise Search host URL, such as via OAuth, is not supported. You can also {enterprise-search-ref}/configure-ssl-tls.html#configure-ssl-tls-in-kibana[configure Kibana to trust your Enterprise Search TLS certificate authority].

| `interpreter.enableInVisualize`
| Enables use of interpreter in Visualize. *Default: `true`*
Expand Down
1 change: 1 addition & 0 deletions src/core/public/doc_links/doc_links_service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -333,6 +333,7 @@ export class DocLinksService {
preconfiguredConnectors: `${KIBANA_DOCS}pre-configured-connectors.html`,
preconfiguredAlertHistoryConnector: `${KIBANA_DOCS}index-action-type.html#preconfigured-connector-alert-history`,
serviceNowAction: `${KIBANA_DOCS}servicenow-action-type.html#configuring-servicenow`,
serviceNowSIRAction: `${KIBANA_DOCS}servicenow-sir-action-type.html`,
setupPrerequisites: `${KIBANA_DOCS}alerting-setup.html#alerting-prerequisites`,
slackAction: `${KIBANA_DOCS}slack-action-type.html#configuring-slack`,
teamsAction: `${KIBANA_DOCS}teams-action-type.html#configuring-teams`,
Expand Down
8 changes: 7 additions & 1 deletion src/plugins/dashboard/kibana.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,13 @@
"presentationUtil",
"visualizations"
],
"optionalPlugins": ["home", "spaces", "savedObjectsTaggingOss", "usageCollection"],
"optionalPlugins": [
"home",
"spaces",
"savedObjectsTaggingOss",
"screenshotMode",
"usageCollection"
],
"server": true,
"ui": true,
"requiredBundles": ["home", "kibanaReact", "kibanaUtils", "presentationUtil"]
Expand Down
15 changes: 14 additions & 1 deletion src/plugins/dashboard/public/application/dashboard_app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import { EmbeddableRenderer } from '../services/embeddable';
import { DashboardTopNav, isCompleteDashboardAppState } from './top_nav/dashboard_top_nav';
import { DashboardAppServices, DashboardEmbedSettings, DashboardRedirect } from '../types';
import { createKbnUrlStateStorage, withNotifyOnErrors } from '../services/kibana_utils';
import { createDashboardEditUrl } from '../dashboard_constants';
export interface DashboardAppProps {
history: History;
savedDashboardId?: string;
Expand All @@ -34,7 +35,7 @@ export function DashboardApp({
redirectTo,
history,
}: DashboardAppProps) {
const { core, chrome, embeddable, onAppLeave, uiSettings, data } =
const { core, chrome, embeddable, onAppLeave, uiSettings, data, spacesService } =
useKibana<DashboardAppServices>().services;

const kbnUrlStateStorage = useMemo(
Expand Down Expand Up @@ -109,6 +110,18 @@ export function DashboardApp({
embedSettings={embedSettings}
dashboardAppState={dashboardAppState}
/>

{dashboardAppState.savedDashboard.outcome === 'conflict' &&
dashboardAppState.savedDashboard.id &&
dashboardAppState.savedDashboard.aliasId
? spacesService?.ui.components.getLegacyUrlConflict({
currentObjectId: dashboardAppState.savedDashboard.id,
otherObjectId: dashboardAppState.savedDashboard.aliasId,
otherObjectPath: `#${createDashboardEditUrl(
dashboardAppState.savedDashboard.aliasId
)}${history.location.search}`,
})
: null}
<div className="dashboardViewport">
<EmbeddableRenderer embeddable={dashboardAppState.dashboardContainer} />
</div>
Expand Down
3 changes: 3 additions & 0 deletions src/plugins/dashboard/public/application/dashboard_router.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ export async function mountApp({
savedObjectsTaggingOss,
visualizations,
presentationUtil,
screenshotMode,
} = pluginsStart;

const activeSpaceId =
Expand Down Expand Up @@ -130,6 +131,8 @@ export async function mountApp({
core.notifications.toasts,
activeSpaceId || 'default'
),
spacesService: spacesApi,
screenshotModeService: screenshotMode,
};

const getUrlStateStorage = (history: RouteComponentProps['history']) =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,8 @@ export const useDashboardAppState = ({
dashboardCapabilities,
dashboardSessionStorage,
scopedHistory,
spacesService,
screenshotModeService,
} = services;
const { docTitle } = chrome;
const { notifications } = core;
Expand Down Expand Up @@ -149,6 +151,25 @@ export const useDashboardAppState = ({
if (canceled || !loadSavedDashboardResult) return;
const { savedDashboard, savedDashboardState } = loadSavedDashboardResult;

// If the saved dashboard is an alias match, then we will redirect
if (savedDashboard.outcome === 'aliasMatch' && savedDashboard.id && savedDashboard.aliasId) {
// We want to keep the "query" params on our redirect.
// But, these aren't true query params, they are technically part of the hash
// So, to get the new path, we will just replace the current id in the hash
// with the alias id
const path = scopedHistory().location.hash.replace(
savedDashboard.id,
savedDashboard.aliasId
);
if (screenshotModeService?.isScreenshotMode()) {
scopedHistory().replace(path);
} else {
await spacesService?.ui.redirectLegacyUrl(path);
}
// Return so we don't run any more of the hook and let it rerun after the redirect that just happened
return;
}

/**
* Combine initial state from the saved object, session storage, and URL, then dispatch it to Redux.
*/
Expand Down Expand Up @@ -340,6 +361,8 @@ export const useDashboardAppState = ({
search,
query,
data,
spacesService?.ui,
screenshotModeService,
]);

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,10 @@ export const loadSavedDashboardState = async ({
await indexPatterns.ensureDefaultDataView();
let savedDashboard: DashboardSavedObject | undefined;
try {
savedDashboard = (await savedDashboards.get(savedDashboardId)) as DashboardSavedObject;
savedDashboard = (await savedDashboards.get({
id: savedDashboardId,
useResolve: true,
})) as DashboardSavedObject;
} catch (error) {
// E.g. a corrupt or deleted dashboard
notifications.toasts.addDanger(error.message);
Expand Down
2 changes: 2 additions & 0 deletions src/plugins/dashboard/public/plugin.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import { filter, map } from 'rxjs/operators';

import { Start as InspectorStartContract } from 'src/plugins/inspector/public';
import { UrlForwardingSetup, UrlForwardingStart } from 'src/plugins/url_forwarding/public';
import { ScreenshotModePluginStart } from 'src/plugins/screenshot_mode/public';
import { APP_WRAPPER_CLASS } from '../../../core/public';
import {
App,
Expand Down Expand Up @@ -118,6 +119,7 @@ export interface DashboardStartDependencies {
savedObjects: SavedObjectsStart;
presentationUtil: PresentationUtilPluginStart;
savedObjectsTaggingOss?: SavedObjectTaggingOssPluginStart;
screenshotMode?: ScreenshotModePluginStart;
spaces?: SpacesPluginStart;
visualizations: VisualizationsStart;
}
Expand Down
93 changes: 72 additions & 21 deletions src/plugins/dashboard/public/saved_dashboards/saved_dashboard.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
* Side Public License, v 1.
*/

import { assign, cloneDeep } from 'lodash';
import { SavedObjectsClientContract } from 'kibana/public';
import { EmbeddableStart } from '../services/embeddable';
import { SavedObject, SavedObjectsStart } from '../services/saved_objects';
import { Filter, ISearchSource, Query, RefreshInterval } from '../services/data';
Expand All @@ -32,12 +34,33 @@ export interface DashboardSavedObject extends SavedObject {
getQuery(): Query;
getFilters(): Filter[];
getFullEditPath: (editMode?: boolean) => string;
outcome?: string;
aliasId?: string;
}

const defaults = {
title: '',
hits: 0,
description: '',
panelsJSON: '[]',
optionsJSON: JSON.stringify({
// for BWC reasons we can't default dashboards that already exist without this setting to true.
useMargins: true,
syncColors: false,
hidePanelTitles: false,
} as DashboardOptions),
version: 1,
timeRestore: false,
timeTo: undefined,
timeFrom: undefined,
refreshInterval: undefined,
};

// Used only by the savedDashboards service, usually no reason to change this
export function createSavedDashboardClass(
savedObjectStart: SavedObjectsStart,
embeddableStart: EmbeddableStart
embeddableStart: EmbeddableStart,
savedObjectsClient: SavedObjectsClientContract
): new (id: string) => DashboardSavedObject {
class SavedDashboard extends savedObjectStart.SavedObjectClass {
// save these objects with the 'dashboard' type
Expand Down Expand Up @@ -68,7 +91,10 @@ export function createSavedDashboardClass(
public static searchSource = true;
public showInRecentlyAccessed = true;

constructor(id: string) {
public outcome?: string;
public aliasId?: string;

constructor(arg: { id: string; useResolve: boolean } | string) {
super({
type: SavedDashboard.type,
mapping: SavedDashboard.mapping,
Expand All @@ -88,28 +114,53 @@ export function createSavedDashboardClass(
},

// if this is null/undefined then the SavedObject will be assigned the defaults
id,
id: typeof arg === 'string' || arg === undefined ? arg : arg.id,

// default values that will get assigned if the doc is new
defaults: {
title: '',
hits: 0,
description: '',
panelsJSON: '[]',
optionsJSON: JSON.stringify({
// for BWC reasons we can't default dashboards that already exist without this setting to true.
useMargins: true,
syncColors: false,
hidePanelTitles: false,
} as DashboardOptions),
version: 1,
timeRestore: false,
timeTo: undefined,
timeFrom: undefined,
refreshInterval: undefined,
},
defaults,
});
this.getFullPath = () => `/app/dashboards#${createDashboardEditUrl(this.id)}`;

const id: string = typeof arg === 'string' || arg === undefined ? arg : arg.id;
const useResolve = typeof arg === 'string' || arg === undefined ? false : arg.useResolve;

this.getFullPath = () => `/app/dashboards#${createDashboardEditUrl(this.aliasId || this.id)}`;

// Overwrite init if we want to use resolve
if (useResolve || true) {
this.init = async () => {
const esType = SavedDashboard.type;
// ensure that the esType is defined
if (!esType) throw new Error('You must define a type name to use SavedObject objects.');

if (!id) {
// just assign the defaults and be done
assign(this, defaults);
await this.hydrateIndexPattern!();

return this;
}

const {
outcome,
alias_target_id: aliasId,
saved_object: resp,
} = await savedObjectsClient.resolve(esType, id);

const respMapped = {
_id: resp.id,
_type: resp.type,
_source: cloneDeep(resp.attributes),
references: resp.references,
found: !!resp._version,
};

this.outcome = outcome;
this.aliasId = aliasId;
await this.applyESResp(respMapped);

return this;
};
}
}

getQuery() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ export function createSavedDashboardLoader({
savedObjectsClient,
embeddableStart,
}: Services) {
const SavedDashboard = createSavedDashboardClass(savedObjects, embeddableStart);
const SavedDashboard = createSavedDashboardClass(
savedObjects,
embeddableStart,
savedObjectsClient
);
return new SavedObjectLoader(SavedDashboard, savedObjectsClient);
}
4 changes: 4 additions & 0 deletions src/plugins/dashboard/public/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import type {
import { History } from 'history';
import { AnyAction, Dispatch } from 'redux';
import { BehaviorSubject, Subject } from 'rxjs';
import { ScreenshotModePluginStart } from 'src/plugins/screenshot_mode/public';
import { Query, Filter, IndexPattern, RefreshInterval, TimeRange } from './services/data';
import { ContainerInput, EmbeddableInput, ViewMode } from './services/embeddable';
import { SharePluginStart } from './services/share';
Expand All @@ -35,6 +36,7 @@ import { IKbnUrlStateStorage } from './services/kibana_utils';
import { DashboardContainer, DashboardSavedObject } from '.';
import { VisualizationsStart } from '../../visualizations/public';
import { DashboardAppLocatorParams } from './locator';
import { SpacesPluginStart } from './services/spaces';

export { SavedDashboardPanel };

Expand Down Expand Up @@ -203,4 +205,6 @@ export interface DashboardAppServices {
dashboardSessionStorage: DashboardSessionStorage;
setHeaderActionMenu: AppMountParameters['setHeaderActionMenu'];
savedQueryService: DataPublicPluginStart['query']['savedQueries'];
spacesService?: SpacesPluginStart;
screenshotModeService?: ScreenshotModePluginStart;
}
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,8 @@ const indexPattern = {
getFieldByName: (name: string) => fields.getByName(name),
timeFieldName: 'timestamp',
getFormatterForField: () => ({ convert: () => 'formatted' }),
isTimeNanosBased: () => false,
popularizeField: () => {},
} as unknown as IndexPattern;

indexPattern.isTimeBased = () => !!indexPattern.timeFieldName;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ const mockNavigationPlugin = { ui: { TopNavMenu: mockTopNavMenu } };
describe('ContextApp test', () => {
const defaultProps = {
indexPattern: indexPatternMock,
indexPatternId: 'the-index-pattern-id',
anchorId: 'mocked_anchor_id',
};

Expand Down
Loading

0 comments on commit 08a450a

Please sign in to comment.