Skip to content

Commit ec73aec

Browse files
committed
Merge remote-tracking branch 'origin/url_decode' into url_decode
2 parents f4fa3f5 + bdec175 commit ec73aec

20 files changed

Lines changed: 184 additions & 344 deletions

File tree

x-pack/plugins/actions/server/builtin_action_types/webhook.test.ts

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -90,9 +90,8 @@ describe('config validation', () => {
9090
};
9191

9292
test('config validation passes when only required fields are provided', () => {
93-
const config: Record<string, string | boolean> = {
93+
const config: Record<string, string> = {
9494
url: 'http://mylisteningserver:9200/endpoint',
95-
hasAuth: true,
9695
};
9796
expect(validateConfig(actionType, config)).toEqual({
9897
...defaultValues,
@@ -102,10 +101,9 @@ describe('config validation', () => {
102101

103102
test('config validation passes when valid methods are provided', () => {
104103
['post', 'put'].forEach((method) => {
105-
const config: Record<string, string | boolean> = {
104+
const config: Record<string, string> = {
106105
url: 'http://mylisteningserver:9200/endpoint',
107106
method,
108-
hasAuth: true,
109107
};
110108
expect(validateConfig(actionType, config)).toEqual({
111109
...defaultValues,
@@ -129,9 +127,8 @@ describe('config validation', () => {
129127
});
130128

131129
test('config validation passes when a url is specified', () => {
132-
const config: Record<string, string | boolean> = {
130+
const config: Record<string, string> = {
133131
url: 'http://mylisteningserver:9200/endpoint',
134-
hasAuth: true,
135132
};
136133
expect(validateConfig(actionType, config)).toEqual({
137134
...defaultValues,
@@ -158,7 +155,6 @@ describe('config validation', () => {
158155
headers: {
159156
'Content-Type': 'application/json',
160157
},
161-
hasAuth: true,
162158
};
163159
expect(validateConfig(actionType, config)).toEqual({
164160
...defaultValues,
@@ -188,7 +184,6 @@ describe('config validation', () => {
188184
headers: {
189185
'Content-Type': 'application/json',
190186
},
191-
hasAuth: true,
192187
};
193188

194189
expect(validateConfig(actionType, config)).toEqual({
@@ -268,7 +263,6 @@ describe('execute()', () => {
268263
headers: {
269264
aheader: 'a value',
270265
},
271-
hasAuth: true,
272266
};
273267
await actionType.executor({
274268
actionId: 'some-id',
@@ -326,7 +320,6 @@ describe('execute()', () => {
326320
headers: {
327321
aheader: 'a value',
328322
},
329-
hasAuth: false,
330323
};
331324
const secrets: ActionTypeSecretsType = { user: null, password: null };
332325
await actionType.executor({

x-pack/plugins/actions/server/builtin_action_types/webhook.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@ const configSchemaProps = {
4242
defaultValue: WebhookMethods.POST,
4343
}),
4444
headers: nullableType(HeadersSchema),
45-
hasAuth: schema.boolean({ defaultValue: true }),
4645
};
4746
const ConfigSchema = schema.object(configSchemaProps);
4847
export type ActionTypeConfigType = TypeOf<typeof ConfigSchema>;
@@ -129,12 +128,12 @@ export async function executor(
129128
execOptions: WebhookActionTypeExecutorOptions
130129
): Promise<ActionTypeExecutorResult<unknown>> {
131130
const actionId = execOptions.actionId;
132-
const { method, url, headers = {}, hasAuth } = execOptions.config;
131+
const { method, url, headers = {} } = execOptions.config;
133132
const { body: data } = execOptions.params;
134133

135134
const secrets: ActionTypeSecretsType = execOptions.secrets;
136135
const basicAuth =
137-
hasAuth && isString(secrets.user) && isString(secrets.password)
136+
isString(secrets.user) && isString(secrets.password)
138137
? { auth: { username: secrets.user, password: secrets.password } }
139138
: {};
140139

x-pack/plugins/actions/server/saved_objects/migrations.test.ts

Lines changed: 0 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -58,63 +58,6 @@ describe('7.10.0', () => {
5858
});
5959
});
6060

61-
describe('7.11.0', () => {
62-
beforeEach(() => {
63-
jest.resetAllMocks();
64-
encryptedSavedObjectsSetup.createMigration.mockImplementation(
65-
(shouldMigrateWhenPredicate, migration) => migration
66-
);
67-
});
68-
69-
test('add hasAuth = true for .webhook actions with user and password', () => {
70-
const migration711 = getMigrations(encryptedSavedObjectsSetup)['7.11.0'];
71-
const action = getMockDataForWebhook({}, true);
72-
expect(migration711(action, context)).toMatchObject({
73-
...action,
74-
attributes: {
75-
...action.attributes,
76-
config: {
77-
hasAuth: true,
78-
},
79-
},
80-
});
81-
});
82-
83-
test('add hasAuth = false for .webhook actions without user and password', () => {
84-
const migration711 = getMigrations(encryptedSavedObjectsSetup)['7.11.0'];
85-
const action = getMockDataForWebhook({}, false);
86-
expect(migration711(action, context)).toMatchObject({
87-
...action,
88-
attributes: {
89-
...action.attributes,
90-
config: {
91-
hasAuth: false,
92-
},
93-
},
94-
});
95-
});
96-
});
97-
98-
function getMockDataForWebhook(
99-
overwrites: Record<string, unknown> = {},
100-
hasUserAndPassword: boolean
101-
): SavedObjectUnsanitizedDoc<RawAction> {
102-
const secrets = hasUserAndPassword
103-
? { user: 'test', password: '123' }
104-
: { user: '', password: '' };
105-
return {
106-
attributes: {
107-
name: 'abc',
108-
actionTypeId: '.webhook',
109-
config: {},
110-
secrets,
111-
...overwrites,
112-
},
113-
id: uuid.v4(),
114-
type: 'action',
115-
};
116-
}
117-
11861
function getMockDataForEmail(
11962
overwrites: Record<string, unknown> = {}
12063
): SavedObjectUnsanitizedDoc<RawAction> {

x-pack/plugins/actions/server/saved_objects/migrations.ts

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -25,18 +25,8 @@ export function getMigrations(
2525
pipeMigrations(renameCasesConfigurationObject, addHasAuthConfigurationObject)
2626
);
2727

28-
const migrationWebhookConnectorHasAuth = encryptedSavedObjects.createMigration<
29-
RawAction,
30-
RawAction
31-
>(
32-
(doc): doc is SavedObjectUnsanitizedDoc<RawAction> =>
33-
doc.attributes.actionTypeId === '.webhook',
34-
pipeMigrations(addHasAuthConfigurationObject)
35-
);
36-
3728
return {
3829
'7.10.0': executeMigrationWithErrorHandling(migrationActions, '7.10.0'),
39-
'7.11.0': executeMigrationWithErrorHandling(migrationWebhookConnectorHasAuth, '7.11.0'),
4030
};
4131
}
4232

x-pack/plugins/maps/server/routes.js

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -189,18 +189,28 @@ export function initRoutes(router, licenseUid, mapConfig, kbnVersion, logger) {
189189
return badRequest('map.proxyElasticMapsServiceInMaps disabled');
190190
}
191191

192-
const file = await emsClient.getDefaultFileManifest();
193-
const layers = file.layers.map((layer) => {
194-
const newLayer = { ...layer };
195-
const id = encodeURIComponent(layer.layer_id);
192+
const file = await emsClient.getDefaultFileManifest(); //need raw manifest
193+
const fileLayers = await emsClient.getFileLayers();
194+
195+
const layers = file.layers.map((layerJson) => {
196+
const newLayerJson = { ...layerJson };
197+
const id = encodeURIComponent(layerJson.layer_id);
198+
199+
const fileLayer = fileLayers.find((fileLayer) => fileLayer.getId() === layerJson.layer_id);
200+
const defaultFormat = layerJson.formats.find(
201+
(format) => format.type === fileLayer.getDefaultFormatType()
202+
);
203+
196204
const newUrl = `${EMS_FILES_DEFAULT_JSON_PATH}?id=${id}`;
197-
newLayer.formats = [
205+
206+
//Only proxy default-format. Others are unused in Maps-app
207+
newLayerJson.formats = [
198208
{
199-
...layer.formats[0],
209+
...defaultFormat,
200210
url: newUrl,
201211
},
202212
];
203-
return newLayer;
213+
return newLayerJson;
204214
});
205215
//rewrite
206216
return ok({

x-pack/plugins/security_solution/public/management/pages/policy/view/policy_forms/protections/malware.tsx

Lines changed: 26 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import {
1111
EuiRadio,
1212
EuiSwitch,
1313
EuiTitle,
14+
EuiText,
1415
EuiSpacer,
1516
htmlIdGenerator,
1617
EuiCallOut,
@@ -28,6 +29,7 @@ import { policyConfig } from '../../../store/policy_details/selectors';
2829
import { usePolicyDetailsSelector } from '../../policy_hooks';
2930
import { clone } from '../../../models/policy_details_config';
3031
import { LinkToApp } from '../../../../../../common/components/endpoint/link_to_app';
32+
import { popupVersionsMap } from './popup_options_to_versions';
3133

3234
const ProtectionRadioGroup = styled.div`
3335
display: flex;
@@ -83,6 +85,25 @@ const ProtectionRadio = React.memo(({ id, label }: { id: ProtectionModes; label:
8385

8486
ProtectionRadio.displayName = 'ProtectionRadio';
8587

88+
const SupportedVersionNotice = ({ optionName }: { optionName: string }) => {
89+
const version = popupVersionsMap.get(optionName);
90+
if (!version) {
91+
return null;
92+
}
93+
94+
return (
95+
<EuiText color="subdued" size="xs">
96+
<i>
97+
<FormattedMessage
98+
id="xpack.securitySolution.endpoint.policyDetails.supportedVersion"
99+
defaultMessage="Agent version {version}"
100+
values={{ version }}
101+
/>
102+
</i>
103+
</EuiText>
104+
);
105+
};
106+
86107
/** The Malware Protections form for policy details
87108
* which will configure for all relevant OSes.
88109
*/
@@ -189,14 +210,15 @@ export const MalwareProtections = React.memo(() => {
189210
/>
190211
</h6>
191212
</EuiTitle>
213+
<SupportedVersionNotice optionName="malware" />
214+
<EuiSpacer size="s" />
192215
<EuiCheckbox
193216
id="xpack.securitySolution.endpoint.policyDetail.malware.userNotification"
194217
onChange={handleUserNotificationCheckbox}
195218
checked={userNotificationSelected}
196-
label={i18n.translate(
197-
'xpack.securitySolution.endpoint.policyDetail.malware.userNotification',
198-
{ defaultMessage: 'User Notification' }
199-
)}
219+
label={i18n.translate('xpack.securitySolution.endpoint.policyDetail.malware.notifyUser', {
220+
defaultMessage: 'Notify User',
221+
})}
200222
/>
201223
</>
202224
);
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
/*
2+
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
3+
* or more contributor license agreements. Licensed under the Elastic License;
4+
* you may not use this file except in compliance with the Elastic License.
5+
*/
6+
7+
const popupVersions: Array<[string, string]> = [['malware', '7.11+']];
8+
9+
export const popupVersionsMap: ReadonlyMap<string, string> = new Map<string, string>(popupVersions);

x-pack/plugins/translations/translations/ja-JP.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20244,6 +20244,7 @@
2024420244
"xpack.triggersActionsUI.sections.actionsConnectorsList.unableToLoadActionTypesMessage": "アクションタイプを読み込めません",
2024520245
"xpack.triggersActionsUI.sections.addAction.webhookAction.error.requiredHeaderKeyText": "キーが必要です。",
2024620246
"xpack.triggersActionsUI.sections.addAction.webhookAction.error.requiredHeaderValueText": "値が必要です。",
20247+
"xpack.triggersActionsUI.sections.addAction.webhookAction.error.requiredHostText": "ユーザー名が必要です。",
2024720248
"xpack.triggersActionsUI.sections.addAction.webhookAction.error.requiredMethodText": "メソッドが必要です",
2024820249
"xpack.triggersActionsUI.sections.addAction.webhookAction.error.requiredPasswordText": "パスワードが必要です。",
2024920250
"xpack.triggersActionsUI.sections.addAlert.error.greaterThenThreshold0Text": "しきい値 1 はしきい値 0 よりも大きい値にしてください。",

x-pack/plugins/translations/translations/zh-CN.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20264,6 +20264,7 @@
2026420264
"xpack.triggersActionsUI.sections.actionsConnectorsList.unableToLoadActionTypesMessage": "无法加载操作类型",
2026520265
"xpack.triggersActionsUI.sections.addAction.webhookAction.error.requiredHeaderKeyText": "“键”必填。",
2026620266
"xpack.triggersActionsUI.sections.addAction.webhookAction.error.requiredHeaderValueText": "“值”必填。",
20267+
"xpack.triggersActionsUI.sections.addAction.webhookAction.error.requiredHostText": "“用户名”必填。",
2026720268
"xpack.triggersActionsUI.sections.addAction.webhookAction.error.requiredMethodText": "“方法”必填",
2026820269
"xpack.triggersActionsUI.sections.addAction.webhookAction.error.requiredPasswordText": "“密码”必填。",
2026920270
"xpack.triggersActionsUI.sections.addAlert.error.greaterThenThreshold0Text": "阈值 1 应 > 阈值 0。",

x-pack/plugins/triggers_actions_ui/public/application/components/builtin_action_types/types.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,6 @@ export interface WebhookConfig {
110110
method: string;
111111
url: string;
112112
headers: Record<string, string>;
113-
hasAuth: boolean;
114113
}
115114

116115
export interface WebhookSecrets {

0 commit comments

Comments
 (0)