Skip to content

Commit

Permalink
Fixes for crash on lauch
Browse files Browse the repository at this point in the history
  • Loading branch information
dz0ny committed Jan 10, 2024
1 parent 00197a4 commit f61133c
Show file tree
Hide file tree
Showing 7 changed files with 24 additions and 14 deletions.
13 changes: 9 additions & 4 deletions Pareto Security.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -839,7 +839,7 @@
attributes = {
BuildIndependentTargetsInParallel = YES;
LastSwiftUpdateCheck = 1300;
LastUpgradeCheck = 1420;
LastUpgradeCheck = 1520;
TargetAttributes = {
4F6A92EE26C555C6006C2F2D = {
CreatedOnToolsVersion = 13.0;
Expand Down Expand Up @@ -1463,6 +1463,7 @@
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES;
CLANG_ANALYZER_NONNULL = YES;
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
Expand Down Expand Up @@ -1527,6 +1528,7 @@
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
ASSETCATALOG_COMPILER_GENERATE_SWIFT_ASSET_SYMBOL_EXTENSIONS = YES;
CLANG_ANALYZER_NONNULL = YES;
CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
Expand Down Expand Up @@ -1589,18 +1591,20 @@
CLANG_USE_OPTIMIZATION_PROFILE = NO;
CODE_SIGN_ENTITLEMENTS = Pareto/Pareto.entitlements;
CODE_SIGN_IDENTITY = "Apple Development";
"CODE_SIGN_IDENTITY[sdk=macosx*]" = "Apple Development";
CODE_SIGN_STYLE = Automatic;
COMBINE_HIDPI_IMAGES = YES;
DEAD_CODE_STRIPPING = YES;
DEVELOPMENT_ASSET_PATHS = "\"Pareto/Preview Content\"";
DEVELOPMENT_TEAM = PM784W7B8X;
DEVELOPMENT_TEAM = JND55328G8;
ENABLE_HARDENED_RUNTIME = YES;
ENABLE_PREVIEWS = YES;
GCC_PREPROCESSOR_DEFINITIONS = (
"SETAPP_ENABLED=0",
"DEBUG=1",
);
INFOPLIST_FILE = Pareto/Info.plist;
INFOPLIST_KEY_LSApplicationCategoryType = "public.app-category.developer-tools";
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/../Frameworks",
Expand Down Expand Up @@ -1628,11 +1632,12 @@
COMBINE_HIDPI_IMAGES = YES;
DEAD_CODE_STRIPPING = YES;
DEVELOPMENT_ASSET_PATHS = "\"Pareto/Preview Content\"";
DEVELOPMENT_TEAM = PM784W7B8X;
DEVELOPMENT_TEAM = JND55328G8;
ENABLE_HARDENED_RUNTIME = YES;
ENABLE_PREVIEWS = YES;
GCC_PREPROCESSOR_DEFINITIONS = "SETAPP_ENABLED=0";
INFOPLIST_FILE = Pareto/Info.plist;
INFOPLIST_KEY_LSApplicationCategoryType = "public.app-category.developer-tools";
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/../Frameworks",
Expand All @@ -1642,7 +1647,7 @@
PRODUCT_BUNDLE_IDENTIFIER = niteo.co.Pareto;
PRODUCT_NAME = "$(TARGET_NAME)";
PROVISIONING_PROFILE_SPECIFIER = "";
SWIFT_COMPILATION_MODE = wholemodule;
SWIFT_COMPILATION_MODE = singlefile;
SWIFT_VERSION = 5.0;
};
name = Release;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1420"
LastUpgradeVersion = "1520"
version = "1.7">
<BuildAction
parallelizeBuildables = "YES"
Expand Down
2 changes: 1 addition & 1 deletion Pareto/Checks/Access Security/Autologin.swift
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class AutologinCheck: ParetoCheck {
override func checkPasses() -> Bool {
// possible:{require password to wake:false, class:security preferences object, secure virtual memory:false, require password to unlock:false, automatic login:false, log out when inactive:false, log out when inactive interval:60}
let script = "tell application \"System Events\" to tell security preferences to get automatic login"
let out = runOSA(appleScript: script) ?? "true"
let out = runOSA(appleScript: script) ?? "false"
return out.contains("false")
}
}
6 changes: 3 additions & 3 deletions Pareto/Checks/Access Security/NoAdminUser.swift
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,11 @@ class NoAdminUser: ParetoCheck {
"Current user is admin"
}

var currentCroups: [String] {
return runCMD(app: "/usr/bin/id", args: ["-Gn"]).components(separatedBy: " ")
var isAdmin: Bool {
return runCMD(app: "/usr/bin/id", args: ["-Gn"]).components(separatedBy: " ").contains("admin")
}

override func checkPasses() -> Bool {
return !currentCroups.contains("admin")
return !isAdmin
}
}
7 changes: 7 additions & 0 deletions Pareto/Checks/Access Security/NoUnusedUsers.swift
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@ class NoUnusedUsers: ParetoCheck {
}
return local
}

var isAdmin: Bool {
return runCMD(app: "/usr/bin/id", args: ["-Gn"]).components(separatedBy: " ").contains("admin")
}

func lastLoginRecent(user: String) -> Bool {
let output = runCMD(app: "/usr/bin/last", args: ["-w", "-y", user]).components(separatedBy: "\n")
Expand Down Expand Up @@ -66,6 +70,9 @@ class NoUnusedUsers: ParetoCheck {
}

override func checkPasses() -> Bool {
if !isAdmin{
return true
}
return accounts.allSatisfy { u in
lastLoginRecent(user: u)
}
Expand Down
2 changes: 1 addition & 1 deletion Pareto/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
</dict>
</array>
<key>CFBundleVersion</key>
<string>5315</string>
<string>5326</string>
<key>LSApplicationCategoryType</key>
<string>public.app-category.utilities</string>
<key>LSMinimumSystemVersion</key>
Expand Down
6 changes: 2 additions & 4 deletions Pareto/Utils.swift
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,10 @@ func runShell(args: [String]) -> String {
}

func runOSA(appleScript: String) -> String? {
#if !DEBUG

let out = runCMD(app: "/usr/bin/osascript", args: ["-e", appleScript])
return out
#else
return "debug"
#endif

}

func lsof(withCommand cmd: String, withPort port: Int) -> Bool {
Expand Down

0 comments on commit f61133c

Please sign in to comment.