apple_codesign/
entitlements.rs1use {crate::code_directory::ExecutableSegmentFlags, plist::Value};
8
9pub fn plist_to_executable_segment_flags(value: &Value) -> ExecutableSegmentFlags {
14 let mut flags = ExecutableSegmentFlags::empty();
15
16 if let Value::Dictionary(d) = value {
17 if matches!(d.get("get-task-allow"), Some(Value::Boolean(true))) {
18 flags |= ExecutableSegmentFlags::ALLOW_UNSIGNED;
19 }
20 if matches!(d.get("run-unsigned-code"), Some(Value::Boolean(true))) {
21 flags |= ExecutableSegmentFlags::ALLOW_UNSIGNED;
22 }
23 if matches!(
24 d.get("com.apple.private.cs.debugger"),
25 Some(Value::Boolean(true))
26 ) {
27 flags |= ExecutableSegmentFlags::DEBUGGER;
28 }
29 if matches!(d.get("dynamic-codesigning"), Some(Value::Boolean(true))) {
30 flags |= ExecutableSegmentFlags::JIT;
31 }
32 if matches!(
33 d.get("com.apple.private.skip-library-validation"),
34 Some(Value::Boolean(true))
35 ) {
36 flags |= ExecutableSegmentFlags::SKIP_LIBRARY_VALIDATION;
37 }
38 if matches!(
39 d.get("com.apple.private.amfi.can-load-cdhash"),
40 Some(Value::Boolean(true))
41 ) {
42 flags |= ExecutableSegmentFlags::CAN_LOAD_CD_HASH;
43 }
44 if matches!(
45 d.get("com.apple.private.amfi.can-execute-cdhash"),
46 Some(Value::Boolean(true))
47 ) {
48 flags |= ExecutableSegmentFlags::CAN_EXEC_CD_HASH;
49 }
50 }
51
52 flags
53}