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

Add CMake support, implement fuzzers #284

Merged

Conversation

@alessandrogario
Copy link
Contributor

@alessandrogario alessandrogario commented Jun 20, 2018

The new CMake project allows the user to select which SDK version to use. The Xcode path is also configurable to support non-standard installation paths and/or systems with multiple versions installed.

Code signing can now be configured via command line, using the CODESIGN_IDENTITY environment variable.

New fuzzing targets (libFuzzer)

  • SantaCache
  • santactl
  • santad

New make targets:

  • tests: Runs the tests
  • fuzz: Runs the fuzzer
  • redist: Regenerates the redistributable folder
  • install: Installs Santa

A small issue has been found in santactl when the the sync-server returns a valid JSON that does not get deserialized to a dictionary object (not yet fixed inside this PR).

The new CMake project allows the user to select which SDK version
to use. The Xcode path is also configurable to support non-standard
installation paths and/or systems with multiple versions installed.

Code signing can now be configured via command line, using the
CODESIGN_IDENTITY environment variable.

New fuzzing targets (libFuzzer)
 - SantaCache
 - santactl
 - santad

New make targets:
 - tests: Runs the tests
 - fuzz: Runs the fuzzer
 - redist: Regenerates the redistributable folder
 - install: Installs Santa
@googlebot
Copy link
Collaborator

@googlebot googlebot commented Jun 20, 2018

Thanks for your pull request. It looks like this may be your first contribution to a Google open source project (if not, look below for help). Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

📝 Please visit https://cla.developers.google.com/ to sign.

Once you've signed (or fixed any issues), please reply here (e.g. I signed it!) and we'll verify it.


What to do if you already signed the CLA

Individual signers
Corporate signers
@alessandrogario
Copy link
Contributor Author

@alessandrogario alessandrogario commented Jun 20, 2018

I have signed the CLA! 👍

@googlebot
Copy link
Collaborator

@googlebot googlebot commented Jun 20, 2018

CLAs look good, thanks!

Copy link
Collaborator

@russellhancox russellhancox left a comment

Thank you for the PR, sorry it took so long to review. I had a few comments but they're mostly minor things.

endif()

if(NOT MACOSX_VERSION_MIN)
set(MACOSX_VERSION_MIN 10.13)

This comment has been minimized.

@russellhancox

russellhancox Jun 26, 2018
Collaborator

Thus far we've been targeting 10.9 as the minimum version, that seems like a reasonable default here.

endif()

if(NOT XCODE_ROOT_FOLDER)
set(XCODE_ROOT_FOLDER "/Applications/Xcode.app")

This comment has been minimized.

@russellhancox

russellhancox Jun 26, 2018
Collaborator

Could this instead be determined using xcode-select -p?

@@ -47,6 +53,9 @@ mkdir -p /usr/local/bin
# Reload syslogd to pick up ASL configuration change.
/usr/bin/killall -HUP syslogd

# Install the configuration file
/usr/bin/profiles install -path=${SOURCE}/conf/com.google.santa.example.mobileconfig

This comment has been minimized.

@russellhancox

russellhancox Jun 26, 2018
Collaborator

I think I'd prefer to leave this line out, the example mobileconfig file isn't all that useful on its own and I generally wouldn't expect a sysadmin to package the mobileconfig up with the Santa package - it should either be distributed as its own package or installed using a config management tool (an MDM, Puppet, etc.)

@@ -21,6 +30,10 @@ user=$(/usr/bin/stat -f '%u' /dev/console)
/bin/rm -f /private/etc/asl/com.google.santa.asl.conf
/bin/rm -f /private/etc/newsyslog.d/com.google.santa.newsyslog.conf
/bin/rm -f /usr/local/bin/santactl # just a symlink

# Uninstall the configuration file
/usr/bin/profiles remove -path=${SOURCE}/conf/com.google.santa.example.mobileconfig

This comment has been minimized.

@russellhancox

russellhancox Jun 26, 2018
Collaborator

Same here

return 0;
}

SNTCommandSyncRuleDownload *obj = [[SNTCommandSyncRuleDownload alloc] initWithState:state];

This comment has been minimized.

@russellhancox

russellhancox Jun 26, 2018
Collaborator

nit: indented too far

)

target_compile_definitions("${PROJECT_NAME}" PRIVATE
SNT_OS_LOG_CATEGORY=\"${PROJECT_NAME}\"

This comment has been minimized.

@russellhancox

russellhancox Jun 26, 2018
Collaborator

What's this define for?

#include <SNTRule.h>

extern "C" int LLVMFuzzerTestOneInput(const std::uint8_t *data, std::size_t size) {
NSData* buffer = [NSData dataWithBytes:static_cast<const void *>(data) length:size];

This comment has been minimized.

@russellhancox

russellhancox Jun 26, 2018
Collaborator

To be consistent with the rest of the source, the * should be with the variable name:

NSData *buffer


extern "C" int LLVMFuzzerTestOneInput(const std::uint8_t *data, std::size_t size) {
NSData* buffer = [NSData dataWithBytes:static_cast<const void *>(data) length:size];
if (buffer == nil) {

This comment has been minimized.

@russellhancox

russellhancox Jun 26, 2018
Collaborator

Also consistency: we generally use the form if (buffer) { here.


#pragma pack(push, 1)

#pragma pack(pop)

This comment has been minimized.

@russellhancox

russellhancox Jun 26, 2018
Collaborator

Are these 2 pragma's leftovers from something?

@@ -0,0 +1,51 @@
#import "SNTDriverManager.h"

This comment has been minimized.

@russellhancox

russellhancox Jun 26, 2018
Collaborator

Can you add a comment at the top of this file describing what it's testing. I'm guessing it's a test that attempts to connect to the driver from multiple threads simultaneously doesn't cause crashes.

This comment has been minimized.

@alessandrogario

alessandrogario Jun 28, 2018
Author Contributor

You are right! I have added a comment at the top of the file

@alessandrogario
Copy link
Contributor Author

@alessandrogario alessandrogario commented Jun 28, 2018

@russellhancox Thanks so much for the review! I've updated the branch with the changes you have requested

@russellhancox russellhancox merged commit 629e702 into google:master Jun 29, 2018
2 checks passed
2 checks passed
cla/google All necessary CLAs are signed
continuous-integration/travis-ci/pr The Travis CI build passed
Details
@russellhancox
Copy link
Collaborator

@russellhancox russellhancox commented Jun 29, 2018

Thanks again for the submission!

dskfh added a commit to dskfh/santa that referenced this pull request Jul 17, 2020
The new CMake project allows the user to select which SDK version
to use. The Xcode path is also configurable to support non-standard
installation paths and/or systems with multiple versions installed.

Code signing can now be configured via command line, using the
CODESIGN_IDENTITY environment variable.

New fuzzing targets (libFuzzer)
 - SantaCache
 - santactl
 - santad

New make targets:
 - tests: Runs the tests
 - fuzz: Runs the fuzzer
 - redist: Regenerates the redistributable folder
 - install: Installs Santa
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

3 participants
You can’t perform that action at this time.