Skip to content

Commit

Permalink
[Security Solution] Ransomware supported migration expanded for upgra…
Browse files Browse the repository at this point in the history
…de corner case (#106280)

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
  • Loading branch information
kevinlog and kibanamachine authored Jul 20, 2021
1 parent bc4928f commit 2a54db7
Show file tree
Hide file tree
Showing 2 changed files with 56 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,57 @@ describe('7.14.0 Endpoint Package Policy migration', () => {
expect(migration(initialDoc, {} as SavedObjectMigrationContext)).toEqual(migratedDoc);
});

it('adds supported option for ransomware on migrations and linux malware option and notification customization when ransomware is malformed', () => {
const initialDoc = policyDoc({
windowsMalware: { malware: { mode: 'on' } },
windowsRansomware: { ransomware: 'off' },
windowsPopup: {
popup: {
malware: {
message: '',
enabled: true,
},
ransomware: {
message: '',
enabled: true,
},
},
},
});

const migratedDoc = policyDoc({
windowsMalware: { malware: { mode: 'on' } },
windowsRansomware: { ransomware: { mode: 'off', supported: true } },
windowsPopup: {
popup: {
malware: {
message: '',
enabled: true,
},
ransomware: {
message: '',
enabled: true,
},
},
},
linuxMalware: {
malware: {
mode: 'on',
},
},
linuxPopup: {
popup: {
malware: {
message: '',
enabled: true,
},
},
},
});

expect(migration(initialDoc, {} as SavedObjectMigrationContext)).toEqual(migratedDoc);
});

it('does not modify non-endpoint package policies', () => {
const doc: SavedObjectUnsanitizedDoc<PackagePolicy> = {
id: 'mock-saved-object-id',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,11 @@ export const migrateEndpointPackagePolicyToV7140: SavedObjectMigrationFn<

// This value is based on license.
// For the migration, we add 'true', our license watcher will correct it, if needed, when the app starts.
policy.windows.ransomware.supported = true;
if (policy?.windows?.ransomware?.mode) {
policy.windows.ransomware.supported = true;
} else {
policy.windows.ransomware = { mode: 'off', supported: true };
}
}
}

Expand Down

0 comments on commit 2a54db7

Please sign in to comment.