Skip to content

Commit

Permalink
koekeishiya#148 only allow window_animation_duration to be set if SIP…
Browse files Browse the repository at this point in the history
… is partially disabled
  • Loading branch information
koekeishiya committed Sep 25, 2022
1 parent 719af3b commit 40f900a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
6 changes: 5 additions & 1 deletion src/message.c
Original file line number Diff line number Diff line change
Expand Up @@ -1146,7 +1146,11 @@ static void handle_domain_config(FILE *rsp, struct token domain, char *message)
fprintf(rsp, "%f\n", g_window_manager.window_animation_duration);
} else if (value.type == TOKEN_TYPE_FLOAT) {
if (CGPreflightScreenCaptureAccess()) {
g_window_manager.window_animation_duration = value.float_value;
if (scripting_addition_is_sip_friendly()) {
g_window_manager.window_animation_duration = value.float_value;
} else {
daemon_fail(rsp, "command '%.*s' for domain '%.*s' requires System Integrity Protection to be partially disabled! ignoring request..\n", command.length, command.text, domain.length, domain.text);
}
} else {
daemon_fail(rsp, "command '%.*s' for domain '%.*s' requires Screen Recording permissions! ignoring request..\n", command.length, command.text, domain.length, domain.text);
CGRequestScreenCaptureAccess();
Expand Down
8 changes: 4 additions & 4 deletions src/sa.m
Original file line number Diff line number Diff line change
Expand Up @@ -307,14 +307,10 @@ static bool scripting_addition_is_sip_friendly(void)
csr_get_active_config(&config);

if (!(config & CSR_ALLOW_UNRESTRICTED_FS)) {
warn("yabai: System Integrity Protection: Filesystem Protections must be disabled!\n");
notify("scripting-addition", "System Integrity Protection: Filesystem Protections must be disabled!");
return false;
}

if (!(config & CSR_ALLOW_TASK_FOR_PID)) {
warn("yabai: System Integrity Protection: Debugging Restrictions must be disabled!\n");
notify("scripting-addition", "System Integrity Protection: Debugging Restrictions must be disabled!");
return false;
}

Expand All @@ -341,6 +337,8 @@ static bool mach_loader_inject_payload(void)
int scripting_addition_uninstall(void)
{
if (!scripting_addition_is_sip_friendly()) {
warn("yabai: System Integrity Protection: Filesystem Protections and Debugging Restrictions must be disabled!\n");
notify("scripting-addition", "System Integrity Protection: Filesystem Protections and Debugging Restrictions must be disabled!");
return 1;
}

Expand Down Expand Up @@ -368,6 +366,8 @@ int scripting_addition_load(void)
}

if (!scripting_addition_is_sip_friendly()) {
warn("yabai: System Integrity Protection: Filesystem Protections and Debugging Restrictions must be disabled!\n");
notify("scripting-addition", "System Integrity Protection: Filesystem Protections and Debugging Restrictions must be disabled!");
result = 1;
goto out;
}
Expand Down

0 comments on commit 40f900a

Please sign in to comment.