From 09d85a6b577bb520358c8951babe108317af0ad1 Mon Sep 17 00:00:00 2001 From: Pete Markowsky Date: Wed, 1 Nov 2023 21:46:09 -0400 Subject: [PATCH] Fix linting errors. --- Source/santad/EventProviders/EndpointSecurity/Enricher.mm | 3 ++- .../Logs/EndpointSecurity/Serializers/BasicStringTest.mm | 8 ++++---- .../santad/Logs/EndpointSecurity/Serializers/EmptyTest.mm | 1 - .../santad/Logs/EndpointSecurity/Serializers/Protobuf.mm | 3 +-- .../Logs/EndpointSecurity/Serializers/Serializer.mm | 1 - .../VM/Common/MacOSVirtualMachineConfigurationHelper.m | 8 ++++---- Testing/integration/VM/VMCLI/main.m | 4 +++- 7 files changed, 14 insertions(+), 14 deletions(-) diff --git a/Source/santad/EventProviders/EndpointSecurity/Enricher.mm b/Source/santad/EventProviders/EndpointSecurity/Enricher.mm index b95b2e4f8..33f3a4f5c 100644 --- a/Source/santad/EventProviders/EndpointSecurity/Enricher.mm +++ b/Source/santad/EventProviders/EndpointSecurity/Enricher.mm @@ -75,7 +75,8 @@ return std::make_unique(EnrichedUnlink( std::move(es_msg), Enrich(*es_msg->process), Enrich(*es_msg->event.unlink.target))); case ES_EVENT_TYPE_NOTIFY_CS_INVALIDATED: - return std::make_unique(EnrichedCSInvalidated(std::move(es_msg), Enrich(*es_msg->process))); + return std::make_unique( + EnrichedCSInvalidated(std::move(es_msg), Enrich(*es_msg->process))); default: // This is a programming error LOGE(@"Attempting to enrich an unhandled event type: %d", es_msg->event_type); diff --git a/Source/santad/Logs/EndpointSecurity/Serializers/BasicStringTest.mm b/Source/santad/Logs/EndpointSecurity/Serializers/BasicStringTest.mm index 12e278926..4f59b81c0 100644 --- a/Source/santad/Logs/EndpointSecurity/Serializers/BasicStringTest.mm +++ b/Source/santad/Logs/EndpointSecurity/Serializers/BasicStringTest.mm @@ -257,14 +257,14 @@ - (void)testSerializeMessageCSInvalidated { es_message_t esMsg = MakeESMessage(ES_EVENT_TYPE_NOTIFY_CS_INVALIDATED, &proc); std::string got = BasicStringSerializeMessage(&esMsg); - std::string want = "action=CODESIGNING_INVALIDATED" - "|pid=12|ppid=56|process=foo|processpath=foo" - "|uid=-2|user=nobody|gid=-1|group=nogroup|codesigning_flags=0x00000000|machineid=my_id\n"; + std::string want = + "action=CODESIGNING_INVALIDATED" + "|pid=12|ppid=56|process=foo|processpath=foo" + "|uid=-2|user=nobody|gid=-1|group=nogroup|codesigning_flags=0x00000000|machineid=my_id\n"; XCTAssertCppStringEqual(got, want); } - - (void)testGetAccessTypeString { std::map accessTypeToString = { {ES_EVENT_TYPE_AUTH_OPEN, "OPEN"}, {ES_EVENT_TYPE_AUTH_LINK, "LINK"}, diff --git a/Source/santad/Logs/EndpointSecurity/Serializers/EmptyTest.mm b/Source/santad/Logs/EndpointSecurity/Serializers/EmptyTest.mm index cba4aa1b8..c1f2a9e7a 100644 --- a/Source/santad/Logs/EndpointSecurity/Serializers/EmptyTest.mm +++ b/Source/santad/Logs/EndpointSecurity/Serializers/EmptyTest.mm @@ -45,7 +45,6 @@ - (void)testAllSerializersReturnEmptyVector { XCTAssertEqual(e->SerializeMessage(*(es::EnrichedUnlink *)&fake).size(), 0); XCTAssertEqual(e->SerializeMessage(*(es::EnrichedCSInvalidated *)&fake).size(), 0); - XCTAssertEqual(e->SerializeAllowlist(*(es::Message *)&fake, "").size(), 0); XCTAssertEqual(e->SerializeBundleHashingEvent(nil).size(), 0); XCTAssertEqual(e->SerializeDiskAppeared(nil).size(), 0); diff --git a/Source/santad/Logs/EndpointSecurity/Serializers/Protobuf.mm b/Source/santad/Logs/EndpointSecurity/Serializers/Protobuf.mm index 46f46fa76..7c48029d7 100644 --- a/Source/santad/Logs/EndpointSecurity/Serializers/Protobuf.mm +++ b/Source/santad/Logs/EndpointSecurity/Serializers/Protobuf.mm @@ -46,6 +46,7 @@ using santa::common::NSStringToUTF8StringView; using santa::santad::event_providers::endpoint_security::EndpointSecurityAPI; using santa::santad::event_providers::endpoint_security::EnrichedClose; +using santa::santad::event_providers::endpoint_security::EnrichedCSInvalidated; using santa::santad::event_providers::endpoint_security::EnrichedEventType; using santa::santad::event_providers::endpoint_security::EnrichedExchange; using santa::santad::event_providers::endpoint_security::EnrichedExec; @@ -56,7 +57,6 @@ using santa::santad::event_providers::endpoint_security::EnrichedProcess; using santa::santad::event_providers::endpoint_security::EnrichedRename; using santa::santad::event_providers::endpoint_security::EnrichedUnlink; -using santa::santad::event_providers::endpoint_security::EnrichedCSInvalidated; using santa::santad::event_providers::endpoint_security::Message; using santa::santad::logs::endpoint_security::serializers::Utilities::EffectiveGroup; using santa::santad::logs::endpoint_security::serializers::Utilities::EffectiveUser; @@ -612,7 +612,6 @@ static inline void EncodeCertificateInfo(::pbv1::CertificateInfo *pb_cert_info, return FinalizeProto(santa_msg); } - std::vector Protobuf::SerializeFileAccess(const std::string &policy_version, const std::string &policy_name, const Message &msg, diff --git a/Source/santad/Logs/EndpointSecurity/Serializers/Serializer.mm b/Source/santad/Logs/EndpointSecurity/Serializers/Serializer.mm index 0925884a3..612806127 100644 --- a/Source/santad/Logs/EndpointSecurity/Serializers/Serializer.mm +++ b/Source/santad/Logs/EndpointSecurity/Serializers/Serializer.mm @@ -78,5 +78,4 @@ return SerializeMessage(msg); } - }; // namespace santa::santad::logs::endpoint_security::serializers diff --git a/Testing/integration/VM/Common/MacOSVirtualMachineConfigurationHelper.m b/Testing/integration/VM/Common/MacOSVirtualMachineConfigurationHelper.m index 158ae4d6b..f35622226 100644 --- a/Testing/integration/VM/Common/MacOSVirtualMachineConfigurationHelper.m +++ b/Testing/integration/VM/Common/MacOSVirtualMachineConfigurationHelper.m @@ -76,7 +76,7 @@ + (VZVirtioBlockDeviceConfiguration *)createBlockDeviceConfigurationForDisk:(NSU } + (VZUSBMassStorageDeviceConfiguration *)createUSBDeviceConfigurationForDisk:(NSURL *)diskURL - readOnly:(BOOL)ro { + readOnly:(BOOL)ro { NSError *error; VZDiskImageStorageDeviceAttachment *diskAttachment = [[VZDiskImageStorageDeviceAttachment alloc] initWithURL:diskURL readOnly:ro error:&error]; @@ -205,7 +205,7 @@ + (VZVirtualMachineConfiguration *)createBaseVirtualMachineConfigurationWithBund + (VZVirtualMachine *)createVirtualMachineWithBundleDir:(NSString *)bundleDir roDisk:(NSString *)roDisk - usbDisk:(NSString*)usbDisk { + usbDisk:(NSString *)usbDisk { VZVirtualMachineConfiguration *configuration = [self createBaseVirtualMachineConfigurationWithBundleDir:bundleDir]; if (roDisk && ![roDisk isEqualToString:@""]) { @@ -217,8 +217,8 @@ + (VZVirtualMachine *)createVirtualMachineWithBundleDir:(NSString *)bundleDir if (usbDisk && ![usbDisk isEqualToString:@""]) { configuration.storageDevices = [configuration.storageDevices arrayByAddingObject:[self createUSBDeviceConfigurationForDisk:[[NSURL alloc] - initFileURLWithPath:usbDisk] - readOnly:NO]]; + initFileURLWithPath:usbDisk] + readOnly:NO]]; } NSError *error; if (![configuration validateWithError:&error]) { diff --git a/Testing/integration/VM/VMCLI/main.m b/Testing/integration/VM/VMCLI/main.m index dafd0d971..2127e70ef 100644 --- a/Testing/integration/VM/VMCLI/main.m +++ b/Testing/integration/VM/VMCLI/main.m @@ -56,7 +56,9 @@ int main(int argc, const char *argv[]) { } VZVirtualMachine *vm = - [MacOSVirtualMachineConfigurationHelper createVirtualMachineWithBundleDir:bundleDir roDisk:nil usbDisk:usbDisk]; + [MacOSVirtualMachineConfigurationHelper createVirtualMachineWithBundleDir:bundleDir + roDisk:nil + usbDisk:usbDisk]; MacOSVirtualMachineDelegate *delegate = [MacOSVirtualMachineDelegate new]; vm.delegate = delegate;