Skip to content

Commit 3e07d25

Browse files
authored
Merge branch '7.17' into backport/7.17/pr-127343
2 parents 6f03f6f + 9fc1c27 commit 3e07d25

1 file changed

Lines changed: 10 additions & 273 deletions

File tree

x-pack/test/security_solution_endpoint/apps/endpoint/policy_details.ts

Lines changed: 10 additions & 273 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,9 @@
66
*/
77

88
import expect from '@kbn/expect';
9-
import { DeepPartial } from 'utility-types';
10-
import { merge } from 'lodash';
119
import { FtrProviderContext } from '../../ftr_provider_context';
1210
import { PolicyTestResourceInfo } from '../../services/endpoint_policy';
1311
import { IndexedHostsAndAlertsResponse } from '../../../../plugins/security_solution/common/endpoint/index_data';
14-
import { FullAgentPolicyInput } from '../../../../plugins/fleet/common';
15-
import { PolicyConfig } from '../../../../plugins/security_solution/common/endpoint/types';
16-
import { ManifestSchema } from '../../../../plugins/security_solution/common/endpoint/schema/manifest';
17-
import { policyFactory } from '../../../../plugins/security_solution/common/endpoint/models/policy_config';
1812

1913
export default function ({ getPageObjects, getService }: FtrProviderContext) {
2014
const browser = getService('browser');
@@ -31,210 +25,6 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) {
3125
const policyTestResources = getService('policyTestResources');
3226
const endpointTestResources = getService('endpointTestResources');
3327

34-
type FullAgentPolicyEndpointInput = Omit<FullAgentPolicyInput, 'streams'> & {
35-
policy: PolicyConfig;
36-
artifact_manifest: ManifestSchema;
37-
};
38-
39-
/**
40-
* Returns the Fleet Agent Policy Input that represents an Endpoint Policy. Use it to
41-
* validate expecte output when looking at the Fleet Agent policy to validate that updates
42-
* to the Endpoint Policy are making it through to the overall Fleet Agent Policy
43-
*
44-
* @param overrides
45-
*/
46-
const getExpectedAgentPolicyEndpointInput = (
47-
overrides: DeepPartial<FullAgentPolicyEndpointInput> = {}
48-
): FullAgentPolicyInput => {
49-
return merge(
50-
{
51-
id: '123',
52-
revision: 2,
53-
data_stream: { namespace: 'default' },
54-
name: 'Protect East Coast',
55-
meta: {
56-
package: {
57-
name: 'endpoint',
58-
version: '1.0',
59-
},
60-
},
61-
artifact_manifest: {
62-
artifacts: {
63-
'endpoint-exceptionlist-linux-v1': {
64-
compression_algorithm: 'zlib',
65-
decoded_sha256: 'd801aa1fb7ddcc330a5e3173372ea6af4a3d08ec58074478e85aa5603e926658',
66-
decoded_size: 14,
67-
encoded_sha256: 'f8e6afa1d5662f5b37f83337af774b5785b5b7f1daee08b7b00c2d6813874cda',
68-
encoded_size: 22,
69-
encryption_algorithm: 'none',
70-
relative_url:
71-
'/api/fleet/artifacts/endpoint-exceptionlist-linux-v1/d801aa1fb7ddcc330a5e3173372ea6af4a3d08ec58074478e85aa5603e926658',
72-
},
73-
'endpoint-exceptionlist-macos-v1': {
74-
compression_algorithm: 'zlib',
75-
decoded_sha256: 'd801aa1fb7ddcc330a5e3173372ea6af4a3d08ec58074478e85aa5603e926658',
76-
decoded_size: 14,
77-
encoded_sha256: 'f8e6afa1d5662f5b37f83337af774b5785b5b7f1daee08b7b00c2d6813874cda',
78-
encoded_size: 22,
79-
encryption_algorithm: 'none',
80-
relative_url:
81-
'/api/fleet/artifacts/endpoint-exceptionlist-macos-v1/d801aa1fb7ddcc330a5e3173372ea6af4a3d08ec58074478e85aa5603e926658',
82-
},
83-
'endpoint-exceptionlist-windows-v1': {
84-
compression_algorithm: 'zlib',
85-
decoded_sha256: 'd801aa1fb7ddcc330a5e3173372ea6af4a3d08ec58074478e85aa5603e926658',
86-
decoded_size: 14,
87-
encoded_sha256: 'f8e6afa1d5662f5b37f83337af774b5785b5b7f1daee08b7b00c2d6813874cda',
88-
encoded_size: 22,
89-
encryption_algorithm: 'none',
90-
relative_url:
91-
'/api/fleet/artifacts/endpoint-exceptionlist-windows-v1/d801aa1fb7ddcc330a5e3173372ea6af4a3d08ec58074478e85aa5603e926658',
92-
},
93-
'endpoint-hostisolationexceptionlist-linux-v1': {
94-
compression_algorithm: 'zlib',
95-
decoded_sha256: 'd801aa1fb7ddcc330a5e3173372ea6af4a3d08ec58074478e85aa5603e926658',
96-
decoded_size: 14,
97-
encoded_sha256: 'f8e6afa1d5662f5b37f83337af774b5785b5b7f1daee08b7b00c2d6813874cda',
98-
encoded_size: 22,
99-
encryption_algorithm: 'none',
100-
relative_url:
101-
'/api/fleet/artifacts/endpoint-hostisolationexceptionlist-linux-v1/d801aa1fb7ddcc330a5e3173372ea6af4a3d08ec58074478e85aa5603e926658',
102-
},
103-
'endpoint-hostisolationexceptionlist-macos-v1': {
104-
compression_algorithm: 'zlib',
105-
decoded_sha256: 'd801aa1fb7ddcc330a5e3173372ea6af4a3d08ec58074478e85aa5603e926658',
106-
decoded_size: 14,
107-
encoded_sha256: 'f8e6afa1d5662f5b37f83337af774b5785b5b7f1daee08b7b00c2d6813874cda',
108-
encoded_size: 22,
109-
encryption_algorithm: 'none',
110-
relative_url:
111-
'/api/fleet/artifacts/endpoint-hostisolationexceptionlist-macos-v1/d801aa1fb7ddcc330a5e3173372ea6af4a3d08ec58074478e85aa5603e926658',
112-
},
113-
'endpoint-hostisolationexceptionlist-windows-v1': {
114-
compression_algorithm: 'zlib',
115-
decoded_sha256: 'd801aa1fb7ddcc330a5e3173372ea6af4a3d08ec58074478e85aa5603e926658',
116-
decoded_size: 14,
117-
encoded_sha256: 'f8e6afa1d5662f5b37f83337af774b5785b5b7f1daee08b7b00c2d6813874cda',
118-
encoded_size: 22,
119-
encryption_algorithm: 'none',
120-
relative_url:
121-
'/api/fleet/artifacts/endpoint-hostisolationexceptionlist-windows-v1/d801aa1fb7ddcc330a5e3173372ea6af4a3d08ec58074478e85aa5603e926658',
122-
},
123-
'endpoint-trustlist-linux-v1': {
124-
compression_algorithm: 'zlib',
125-
decoded_sha256: 'd801aa1fb7ddcc330a5e3173372ea6af4a3d08ec58074478e85aa5603e926658',
126-
decoded_size: 14,
127-
encoded_sha256: 'f8e6afa1d5662f5b37f83337af774b5785b5b7f1daee08b7b00c2d6813874cda',
128-
encoded_size: 22,
129-
encryption_algorithm: 'none',
130-
relative_url:
131-
'/api/fleet/artifacts/endpoint-trustlist-linux-v1/d801aa1fb7ddcc330a5e3173372ea6af4a3d08ec58074478e85aa5603e926658',
132-
},
133-
'endpoint-trustlist-macos-v1': {
134-
compression_algorithm: 'zlib',
135-
decoded_sha256: 'd801aa1fb7ddcc330a5e3173372ea6af4a3d08ec58074478e85aa5603e926658',
136-
decoded_size: 14,
137-
encoded_sha256: 'f8e6afa1d5662f5b37f83337af774b5785b5b7f1daee08b7b00c2d6813874cda',
138-
encoded_size: 22,
139-
encryption_algorithm: 'none',
140-
relative_url:
141-
'/api/fleet/artifacts/endpoint-trustlist-macos-v1/d801aa1fb7ddcc330a5e3173372ea6af4a3d08ec58074478e85aa5603e926658',
142-
},
143-
'endpoint-trustlist-windows-v1': {
144-
compression_algorithm: 'zlib',
145-
decoded_sha256: 'd801aa1fb7ddcc330a5e3173372ea6af4a3d08ec58074478e85aa5603e926658',
146-
decoded_size: 14,
147-
encoded_sha256: 'f8e6afa1d5662f5b37f83337af774b5785b5b7f1daee08b7b00c2d6813874cda',
148-
encoded_size: 22,
149-
encryption_algorithm: 'none',
150-
relative_url:
151-
'/api/fleet/artifacts/endpoint-trustlist-windows-v1/d801aa1fb7ddcc330a5e3173372ea6af4a3d08ec58074478e85aa5603e926658',
152-
},
153-
'endpoint-eventfilterlist-linux-v1': {
154-
compression_algorithm: 'zlib',
155-
decoded_sha256: 'd801aa1fb7ddcc330a5e3173372ea6af4a3d08ec58074478e85aa5603e926658',
156-
decoded_size: 14,
157-
encoded_sha256: 'f8e6afa1d5662f5b37f83337af774b5785b5b7f1daee08b7b00c2d6813874cda',
158-
encoded_size: 22,
159-
encryption_algorithm: 'none',
160-
relative_url:
161-
'/api/fleet/artifacts/endpoint-eventfilterlist-linux-v1/d801aa1fb7ddcc330a5e3173372ea6af4a3d08ec58074478e85aa5603e926658',
162-
},
163-
'endpoint-eventfilterlist-macos-v1': {
164-
compression_algorithm: 'zlib',
165-
decoded_sha256: 'd801aa1fb7ddcc330a5e3173372ea6af4a3d08ec58074478e85aa5603e926658',
166-
decoded_size: 14,
167-
encoded_sha256: 'f8e6afa1d5662f5b37f83337af774b5785b5b7f1daee08b7b00c2d6813874cda',
168-
encoded_size: 22,
169-
encryption_algorithm: 'none',
170-
relative_url:
171-
'/api/fleet/artifacts/endpoint-eventfilterlist-macos-v1/d801aa1fb7ddcc330a5e3173372ea6af4a3d08ec58074478e85aa5603e926658',
172-
},
173-
'endpoint-eventfilterlist-windows-v1': {
174-
compression_algorithm: 'zlib',
175-
decoded_sha256: 'd801aa1fb7ddcc330a5e3173372ea6af4a3d08ec58074478e85aa5603e926658',
176-
decoded_size: 14,
177-
encoded_sha256: 'f8e6afa1d5662f5b37f83337af774b5785b5b7f1daee08b7b00c2d6813874cda',
178-
encoded_size: 22,
179-
encryption_algorithm: 'none',
180-
relative_url:
181-
'/api/fleet/artifacts/endpoint-eventfilterlist-windows-v1/d801aa1fb7ddcc330a5e3173372ea6af4a3d08ec58074478e85aa5603e926658',
182-
},
183-
},
184-
manifest_version: '1',
185-
schema_version: 'v1',
186-
},
187-
policy: merge(policyFactory(), {
188-
windows: {
189-
popup: {
190-
malware: {
191-
message: 'Elastic Security {action} {filename}',
192-
},
193-
ransomware: {
194-
message: 'Elastic Security {action} {filename}',
195-
},
196-
memory_protection: {
197-
message: 'Elastic Security {action} {rule}',
198-
},
199-
behavior_protection: {
200-
message: 'Elastic Security {action} {rule}',
201-
},
202-
},
203-
},
204-
mac: {
205-
popup: {
206-
malware: {
207-
message: 'Elastic Security {action} {filename}',
208-
},
209-
behavior_protection: {
210-
message: 'Elastic Security {action} {rule}',
211-
},
212-
memory_protection: {
213-
message: 'Elastic Security {action} {rule}',
214-
},
215-
},
216-
},
217-
linux: {
218-
popup: {
219-
malware: {
220-
message: 'Elastic Security {action} {filename}',
221-
},
222-
behavior_protection: {
223-
message: 'Elastic Security {action} {rule}',
224-
},
225-
memory_protection: {
226-
message: 'Elastic Security {action} {rule}',
227-
},
228-
},
229-
},
230-
}),
231-
type: 'endpoint',
232-
use_output: 'default',
233-
},
234-
overrides
235-
);
236-
};
237-
23828
describe('When on the Endpoint Policy Details Page', function () {
23929
let indexedData: IndexedHostsAndAlertsResponse;
24030

@@ -393,34 +183,12 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) {
393183
policyInfo.agentPolicy.id
394184
);
395185

396-
expect(agentFullPolicy.inputs).to.eql([
397-
getExpectedAgentPolicyEndpointInput({
398-
id: policyInfo.packagePolicy.id,
399-
name: policyInfo.packagePolicy.name,
400-
meta: {
401-
package: {
402-
version: policyInfo.packageInfo.version,
403-
},
404-
},
405-
artifact_manifest: agentFullPolicy.inputs[0].artifact_manifest,
406-
policy: {
407-
linux: {
408-
events: {
409-
file: false,
410-
},
411-
advanced: {
412-
agent: {
413-
connection_delay: 'true',
414-
},
415-
},
416-
},
417-
mac: {
418-
events: { file: false },
419-
},
420-
windows: { events: { file: false } },
421-
},
422-
}),
423-
]);
186+
expect(agentFullPolicy.inputs[0].policy.linux.advanced.agent.connection_delay).to.eql(
187+
'true'
188+
);
189+
expect(agentFullPolicy.inputs[0].policy.linux.events.file).to.eql(false);
190+
expect(agentFullPolicy.inputs[0].policy.mac.events.file).to.eql(false);
191+
expect(agentFullPolicy.inputs[0].policy.windows.events.file).to.eql(false);
424192
});
425193

426194
it('should have cleared the advanced section when the user deletes the value', async () => {
@@ -439,28 +207,9 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) {
439207
policyInfo.agentPolicy.id
440208
);
441209

442-
expect(agentFullPolicy.inputs).to.eql([
443-
getExpectedAgentPolicyEndpointInput({
444-
id: policyInfo.packagePolicy.id,
445-
name: policyInfo.packagePolicy.name,
446-
revision: agentFullPolicy.inputs[0].revision,
447-
meta: {
448-
package: {
449-
version: policyInfo.packageInfo.version,
450-
},
451-
},
452-
artifact_manifest: agentFullPolicy.inputs[0].artifact_manifest,
453-
policy: {
454-
linux: {
455-
advanced: {
456-
agent: {
457-
connection_delay: 'true',
458-
},
459-
},
460-
},
461-
},
462-
}),
463-
]);
210+
expect(agentFullPolicy.inputs[0].policy.linux.advanced.agent.connection_delay).to.eql(
211+
'true'
212+
);
464213

465214
// Clear the value
466215
await advancedPolicyField.click();
@@ -476,19 +225,7 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) {
476225
policyInfo.agentPolicy.id
477226
);
478227

479-
expect(agentFullPolicyUpdated.inputs).to.eql([
480-
getExpectedAgentPolicyEndpointInput({
481-
id: policyInfo.packagePolicy.id,
482-
name: policyInfo.packagePolicy.name,
483-
revision: agentFullPolicyUpdated.inputs[0].revision,
484-
meta: {
485-
package: {
486-
version: policyInfo.packageInfo.version,
487-
},
488-
},
489-
artifact_manifest: agentFullPolicy.inputs[0].artifact_manifest,
490-
}),
491-
]);
228+
expect(agentFullPolicyUpdated.inputs[0].policy.linux.advanced).to.eql(undefined);
492229
});
493230
});
494231

0 commit comments

Comments
 (0)