Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix internal build issues, minor cleanup. #1231

Merged
merged 1 commit into from
Nov 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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