Skip to content

Commit

Permalink
Fix linting errors.
Browse files Browse the repository at this point in the history
  • Loading branch information
pmarkowsky committed Nov 2, 2023
1 parent 2fd357d commit 09d85a6
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 14 deletions.
3 changes: 2 additions & 1 deletion Source/santad/EventProviders/EndpointSecurity/Enricher.mm
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,8 @@
return std::make_unique<EnrichedMessage>(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<EnrichedMessage>(EnrichedCSInvalidated(std::move(es_msg), Enrich(*es_msg->process)));
return std::make_unique<EnrichedMessage>(
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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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<es_event_type_t, std::string> accessTypeToString = {
{ES_EVENT_TYPE_AUTH_OPEN, "OPEN"}, {ES_EVENT_TYPE_AUTH_LINK, "LINK"},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
3 changes: 1 addition & 2 deletions Source/santad/Logs/EndpointSecurity/Serializers/Protobuf.mm
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -612,7 +612,6 @@ static inline void EncodeCertificateInfo(::pbv1::CertificateInfo *pb_cert_info,
return FinalizeProto(santa_msg);
}


std::vector<uint8_t> Protobuf::SerializeFileAccess(const std::string &policy_version,
const std::string &policy_name,
const Message &msg,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,5 +78,4 @@
return SerializeMessage(msg);
}


}; // namespace santa::santad::logs::endpoint_security::serializers
Original file line number Diff line number Diff line change
Expand Up @@ -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];
Expand Down Expand Up @@ -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:@""]) {
Expand All @@ -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]) {
Expand Down
4 changes: 3 additions & 1 deletion Testing/integration/VM/VMCLI/main.m
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 09d85a6

Please sign in to comment.