Skip to content

Commit

Permalink
Remove joi leakage to the browser in synthetics (#187308)
Browse files Browse the repository at this point in the history
Co-authored-by: jennypavlova <jennypavlova94@gmail.com>
  • Loading branch information
2 people authored and pull[bot] committed Aug 12, 2024
1 parent f5dbd0b commit 1868507
Show file tree
Hide file tree
Showing 10 changed files with 30 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
*/

import * as t from 'io-ts';
import { schema } from '@kbn/config-schema';

export const AlertConfigCodec = t.intersection([
t.interface({
Expand All @@ -22,17 +21,6 @@ export const AlertConfigsCodec = t.partial({
status: AlertConfigCodec,
});

export const AlertConfigSchema = schema.object({
tls: schema.maybe(
schema.object({
enabled: schema.boolean(),
})
),
status: schema.object({
enabled: schema.boolean(),
}),
});

export type AlertConfig = t.TypeOf<typeof AlertConfigCodec>;
export type AlertConfigs = t.TypeOf<typeof AlertConfigsCodec>;

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/

import { schema } from '@kbn/config-schema';

export const AlertConfigSchema = schema.object({
tls: schema.maybe(
schema.object({
enabled: schema.boolean(),
})
),
status: schema.object({
enabled: schema.boolean(),
}),
});
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import {
useIsWithinMinBreakpoint,
} from '@elastic/eui';
import { i18n } from '@kbn/i18n';
import { MonitorListSortField } from '../../../../../../../common/runtime_types/monitor_management/sort_field';
import type { MonitorListSortField } from '../../../../../../../common/runtime_types/monitor_management/sort_field';
import { DeleteMonitor } from './delete_monitor';
import { IHttpSerializedFetchError } from '../../../../state/utils/http_error';
import { MonitorListPageState } from '../../../../state';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import type { PayloadAction } from '@reduxjs/toolkit';
import { useDispatch, useSelector } from 'react-redux';
import { i18n } from '@kbn/i18n';
import { EuiFlexGroup, EuiFlexItem, EuiTitle } from '@elastic/eui';
import { MonitorListSortField } from '../../../../../../../common/runtime_types/monitor_management/sort_field';
import type { MonitorListSortField } from '../../../../../../../common/runtime_types/monitor_management/sort_field';
import { ConfigKey } from '../../../../../../../common/runtime_types';

import { selectOverviewState, setOverviewPageStateAction } from '../../../../state/overview';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import useThrottle from 'react-use/lib/useThrottle';
import { useEffect, useState, MutableRefObject } from 'react';
import useIntersection from 'react-use/lib/useIntersection';
import { useSelector } from 'react-redux';
import { MonitorListSortField } from '../../../../../../../common/runtime_types/monitor_management/sort_field';
import type { MonitorListSortField } from '../../../../../../../common/runtime_types/monitor_management/sort_field';
import { useGetUrlParams } from '../../../../hooks';
import { selectOverviewState } from '../../../../state';
import { MonitorOverviewItem } from '../../../../../../../common/runtime_types';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import { FormattedMessage } from '@kbn/i18n-react';
import { kibanaService } from '../../../../../utils/kibana_service';
import { ClientPluginsStart } from '../../../../../plugin';
import { store } from '../../../state';
import { StatusRuleParams } from '../../../../../../common/rules/status_rule';
import type { StatusRuleParams } from '../../../../../../common/rules/status_rule';

interface Props {
core: CoreStart;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@ import React from 'react';

import { ALERT_REASON } from '@kbn/rule-data-utils';

import { ObservabilityRuleTypeModel } from '@kbn/observability-plugin/public';
import { RuleTypeParamsExpressionProps } from '@kbn/triggers-actions-ui-plugin/public';
import type { ObservabilityRuleTypeModel } from '@kbn/observability-plugin/public';
import type { RuleTypeParamsExpressionProps } from '@kbn/triggers-actions-ui-plugin/public';
import { getSyntheticsErrorRouteFromMonitorId } from '../../../../../common/utils/get_synthetics_monitor_url';
import { STATE_ID } from '../../../../../common/field_names';
import { SyntheticsMonitorStatusTranslations } from '../../../../../common/rules/synthetics/translations';
import { StatusRuleParams } from '../../../../../common/rules/status_rule';
import type { StatusRuleParams } from '../../../../../common/rules/status_rule';
import { SYNTHETICS_ALERT_RULE_TYPES } from '../../../../../common/constants/synthetics_alerts';
import { AlertTypeInitializer } from '.';
import type { AlertTypeInitializer } from '.';
const { defaultActionMessage, defaultRecoveryMessage, description } =
SyntheticsMonitorStatusTranslations;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

import { ErrorToastOptions } from '@kbn/core-notifications-browser';

import { MonitorListSortField } from '../../../../../common/runtime_types/monitor_management/sort_field';
import type { MonitorListSortField } from '../../../../../common/runtime_types/monitor_management/sort_field';
import {
EncryptedSyntheticsMonitor,
FetchMonitorManagementListQueryArgs,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/
import { MonitorListSortField } from '../../../../../common/runtime_types/monitor_management/sort_field';
import type { MonitorListSortField } from '../../../../../common/runtime_types/monitor_management/sort_field';
import { ConfigKey, MonitorOverviewResult } from '../../../../../common/runtime_types';

import { IHttpSerializedFetchError } from '../utils/http_error';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { formatErrors } from '@kbn/securitysolution-io-ts-utils';

import { omit } from 'lodash';
import { schema } from '@kbn/config-schema';
import { AlertConfigSchema } from '../../../common/runtime_types/monitor_management/alert_config';
import { AlertConfigSchema } from '../../../common/runtime_types/monitor_management/alert_config_schema';
import { CreateMonitorPayLoad } from './add_monitor/add_monitor_api';
import { flattenAndFormatObject } from '../../synthetics_service/project_monitor/normalizers/common_fields';
import { PrivateLocationAttributes } from '../../runtime_types/private_locations';
Expand Down

0 comments on commit 1868507

Please sign in to comment.