Skip to content

Commit

Permalink
Removing unnecessary macOS version check (#7451)
Browse files Browse the repository at this point in the history
Resolves #7321
  • Loading branch information
n8felton authored Jan 31, 2022
1 parent 852d87b commit d701a22
Showing 1 changed file with 0 additions and 17 deletions.
17 changes: 0 additions & 17 deletions osquery/tables/system/darwin/signature.mm
Original file line number Diff line number Diff line change
Expand Up @@ -34,28 +34,11 @@
std::set<std::string> kCheckedArches{
"", "i386", "ppc", "arm", "x86_64", "arm64"};

int getOSMinorVersion() {
auto qd = SQL::selectAllFrom("os_version");
if (qd.size() != 1) {
return -1;
}

return tryTo<int>(qd.front().at("minor")).takeOr(-1);
}

// Get the flags to pass to SecStaticCodeCheckValidityWithErrors, depending on
// the OS version.
Status getVerifyFlags(SecCSFlags& flags, bool hashResources) {
static const auto minorVersion = getOSMinorVersion();
if (minorVersion == -1) {
return Status(-1, "Couldn't determine OS X version");
}

flags = kSecCSStrictValidate | kSecCSCheckAllArchitectures |
kSecCSCheckNestedCode;
if (minorVersion > 8) {
flags |= kSecCSCheckNestedCode;
}

if (!hashResources) {
flags |= kSecCSDoNotValidateResources;
Expand Down

0 comments on commit d701a22

Please sign in to comment.