Skip to content

Commit

Permalink
sync: Drop rules_* fields in postflight to uint32 (#1415)
Browse files Browse the repository at this point in the history
* sync: Drop rules_* fields in postflight to uint32

This lets the protobuf json serializer to send the values as ints (like NSJSONSerialization did) instead of strings. This will cause problems if someone has 4B rules but that's probably a sign of bigger problems
  • Loading branch information
russellhancox committed Aug 12, 2024
1 parent c7766d5 commit fadc9b5
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions Source/santasyncservice/SNTSyncPostflight.mm
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ - (BOOL)sync {
google::protobuf::Arena arena;
auto req = google::protobuf::Arena::Create<::pbv1::PostflightRequest>(&arena);
req->set_machine_id(NSStringToUTF8String(self.syncState.machineID));
req->set_rules_received(self.syncState.rulesReceived);
req->set_rules_processed(self.syncState.rulesProcessed);
req->set_rules_received(static_cast<uint32_t>(self.syncState.rulesReceived));
req->set_rules_processed(static_cast<uint32_t>(self.syncState.rulesProcessed));

::pbv1::PostflightResponse response;
[self performRequest:[self requestWithMessage:req] intoMessage:&response timeout:30];
Expand Down
4 changes: 2 additions & 2 deletions Source/santasyncservice/syncv1.proto
Original file line number Diff line number Diff line change
Expand Up @@ -305,8 +305,8 @@ message RuleDownloadResponse {
}

message PostflightRequest {
uint64 rules_received = 1 [json_name="rules_received"];
uint64 rules_processed = 2 [json_name="rules_processed"];
uint32 rules_received = 1 [json_name="rules_received"];
uint32 rules_processed = 2 [json_name="rules_processed"];
// The UUID of the machine that is sending this postflight.
string machine_id = 3 [json_name="machine_id"];
}
Expand Down

0 comments on commit fadc9b5

Please sign in to comment.