-
Notifications
You must be signed in to change notification settings - Fork 109
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added experimental.trust_any_certificate (#2589)
* Added experimental.trust_any_certificate to enable making app trust any certificate on macOS. Closes #2576 * missing file * docs * .. * lint * bl
- Loading branch information
Showing
6 changed files
with
59 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Added experimental.trust_any_certificate to enable making app trust any certificate on macOS |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
use libc::c_void; | ||
use mirrord_layer_macro::hook_guard_fn; | ||
|
||
use crate::{hooks::HookManager, replace}; | ||
|
||
// https://developer.apple.com/documentation/security/2980705-sectrustevaluatewitherror | ||
#[hook_guard_fn] | ||
pub(crate) unsafe extern "C" fn sec_trust_evaluate_with_error_detour( | ||
trust: *const c_void, | ||
error: *const c_void, | ||
) -> bool { | ||
tracing::trace!("sec_trust_evaluate_with_error_detour called"); | ||
true | ||
} | ||
|
||
pub(crate) unsafe fn enable_tls_hooks(hook_manager: &mut HookManager) { | ||
replace!( | ||
hook_manager, | ||
"SecTrustEvaluateWithError", | ||
sec_trust_evaluate_with_error_detour, | ||
FnSec_trust_evaluate_with_error, | ||
FN_SEC_TRUST_EVALUATE_WITH_ERROR | ||
); | ||
} |