Skip to content

Commit

Permalink
Fix internal build issues, minor cleanup. (#1231)
Browse files Browse the repository at this point in the history
  • Loading branch information
mlw committed Nov 9, 2023
1 parent ce5e3d0 commit edac42e
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 10 deletions.
8 changes: 6 additions & 2 deletions Source/common/santa.proto
Original file line number Diff line number Diff line change
Expand Up @@ -213,9 +213,13 @@ message CertificateInfo {
optional string common_name = 2;
}

// Information about a single entitlement key/value pair
message Entitlement {
string key = 1;
string value = 2;
// The name of an entitlement
optional string key = 1;

// The value of an entitlement
optional string value = 2;
}

// Information about a process execution event
Expand Down
12 changes: 7 additions & 5 deletions Source/santad/Logs/EndpointSecurity/Serializers/Protobuf.mm
Original file line number Diff line number Diff line change
Expand Up @@ -476,10 +476,10 @@ id StandardizedNestedObjects(id obj, int level) {
} else if ([obj isKindOfClass:[NSDate class]]) {
return [NSISO8601DateFormatter stringFromDate:obj
timeZone:[NSTimeZone timeZoneWithAbbreviation:@"UTC"]
formatOptions:NSISO8601DateFormatWithFractionalSeconds | NSISO8601DateFormatWithInternetDateTime];
formatOptions:NSISO8601DateFormatWithFractionalSeconds |
NSISO8601DateFormatWithInternetDateTime];

} else {
NSLog(@"Got unknown... %d", level);
LOGW(@"Unexpected object encountered: %@", obj);
return [obj description];
}
Expand Down Expand Up @@ -555,9 +555,11 @@ void EncodeEntitlements(::pbv1::Execution *pb_exec, NSDictionary *entitlements)
}

::pbv1::Entitlement *pb_entitlement = pb_exec->add_entitlements();
pb_entitlement->set_key(NSStringToUTF8StringView(key));
pb_entitlement->set_value(NSStringToUTF8StringView(
[[NSString alloc] initWithData:jsonData encoding:NSUTF8StringEncoding]));
EncodeString([pb_entitlement] { return pb_entitlement->mutable_key(); },
NSStringToUTF8StringView(key));
EncodeString([pb_entitlement] { return pb_entitlement->mutable_value(); },
NSStringToUTF8StringView([[NSString alloc] initWithData:jsonData
encoding:NSUTF8StringEncoding]));
}];
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -489,8 +489,8 @@ - (void)testGetFileDescriptorType {
};

for (const auto &kv : fdtypeToEnumType) {
XCTAssertEqual(GetFileDescriptorType(kv.first), kv.second,
@"Bad fd type name for fdtype: %u", kv.first);
XCTAssertEqual(GetFileDescriptorType(kv.first), kv.second, @"Bad fd type name for fdtype: %u",
kv.first);
}
}

Expand Down Expand Up @@ -610,7 +610,7 @@ - (void)testEncodeEntitlements {

EncodeEntitlements(&pbExec, ents);

int kMaxEncodeObjectEntries = 64; // From Protobuf.mm
int kMaxEncodeObjectEntries = 64; // From Protobuf.mm
XCTAssertEqual(kMaxEncodeObjectEntries, pbExec.entitlements_size());
}

Expand Down

0 comments on commit edac42e

Please sign in to comment.