Skip to content

Commit 6dae138

Browse files
authored
fix: signing fixes for TIX / Chimera(jbs.app) (#29)
* fix: ChimeraPatch(jbsapp) & TIX signing improperly * chore: rename this lol * fix(?): unc0ver drm from not triggering * some cleanup * fix(?): disable hidpi awareness on windows issue is that wxdragon (framework im using) doesnt support converting `Size` object to DIP variations, so for now we can just disable this until it is supported.
1 parent 3d6858d commit 6dae138

5 files changed

Lines changed: 54 additions & 10 deletions

File tree

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# PlumeImpactor
22

33
[![GitHub Release](https://img.shields.io/github/v/release/khcrysalis/PlumeImpactor?include_prereleases)](https://github.com/khcrysalis/PlumeImpactor/releases)
4-
[![GitHub Downloads (all assets, all releases)](https://img.shields.io/github/downloads/khcrysalis/PlumeImpactor/total)](https://github.com/khcrysalis/feather/releases)
4+
[![GitHub Downloads (all assets, all releases)](https://img.shields.io/github/downloads/khcrysalis/PlumeImpactor/total)](https://github.com/khcrysalis/PlumeImpactor/releases)
55
[![GitHub License](https://img.shields.io/github/license/khcrysalis/PlumeImpactor?color=%23C96FAD)](https://github.com/khcrysalis/PlumeImpactor/blob/main/LICENSE)
66
[![Sponsor Me](https://img.shields.io/static/v1?label=Sponsor&message=%E2%9D%A4&logo=GitHub&color=%23fe8e86)](https://github.com/sponsors/khcrysalis)
77

apps/plumeimpactor/build.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ fn embed_windows_manifest(name: &str) {
1919
.supported_os(Windows7..=Windows10)
2020
.active_code_page(ActiveCodePage::Utf8)
2121
.heap_type(embed_manifest::manifest::HeapType::SegmentHeap)
22-
.dpi_awareness(embed_manifest::manifest::DpiAwareness::PerMonitorV2)
22+
.dpi_awareness(embed_manifest::manifest::DpiAwareness::Unaware)
2323
.long_path_aware(Setting::Enabled);
2424

2525
embed_manifest(manifest).unwrap();

crates/core/src/utils/provision.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,17 @@ impl MobileProvision {
8383
);
8484
}
8585

86+
// this is granted by default.
87+
if let Some(Value::Array(groups)) = self.entitlements.get_mut("keychain-access-groups") {
88+
groups.retain(|group| {
89+
if let Value::String(s) = group {
90+
!s.starts_with("com.apple.token")
91+
} else {
92+
true
93+
}
94+
});
95+
}
96+
8697
let new_team_id = self
8798
.entitlements
8899
.get("com.apple.developer.team-identifier")

crates/utils/src/bundle.rs

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,12 +177,27 @@ fn collect_embeded_bundles_from_dir(dir: &PathBuf) -> Result<Vec<Bundle>, Error>
177177
false
178178
}
179179
}
180+
181+
fn is_dylib_file(name: &str) -> bool {
182+
name.ends_with(".dylib")
183+
}
180184

181185
for entry in fs::read_dir(dir)? {
182186
let entry = entry.map_err(Error::Io)?;
183187
let path = entry.path();
184188

185189
if let Some(name) = path.file_name().and_then(|n| n.to_str()) {
190+
// Handle dylib files as bundles (even though they don't have Info.plist)
191+
if path.is_file() && is_dylib_file(name) {
192+
// Create a pseudo-bundle for dylib files
193+
bundles.push(Bundle {
194+
dir: path,
195+
_type: BundleType::Dylib,
196+
info_plist_file: PathBuf::new(), // Empty for dylibs
197+
});
198+
continue;
199+
}
200+
186201
if is_bundle_dir(name) {
187202
if let Ok(bundle) = Bundle::new(&path) {
188203
bundles.push(bundle.clone());
@@ -212,6 +227,7 @@ pub enum BundleType {
212227
App,
213228
AppExtension,
214229
Framework,
230+
Dylib,
215231
Unknown
216232
}
217233

@@ -221,7 +237,18 @@ impl BundleType {
221237
"app" => Some(BundleType::App),
222238
"appex" => Some(BundleType::AppExtension),
223239
"framework" => Some(BundleType::Framework),
240+
"dylib" => Some(BundleType::Dylib),
224241
_ => Some(BundleType::Unknown),
225242
}
226243
}
244+
245+
/// Returns true if this bundle type should be signed with entitlements
246+
pub fn should_have_entitlements(&self) -> bool {
247+
matches!(self, BundleType::App | BundleType::AppExtension)
248+
}
249+
250+
/// Returns true if this bundle type should be code signed
251+
pub fn should_be_signed(&self) -> bool {
252+
!matches!(self, BundleType::Unknown)
253+
}
227254
}

crates/utils/src/signer.rs

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,10 @@ impl Signer {
5454
}
5555

5656
pub async fn modify_bundle(&mut self, bundle: &Bundle, team_id: &Option<String>) -> Result<(), Error> {
57-
let bundles = bundle.collect_bundles_sorted()?;
57+
let bundles = bundle.collect_bundles_sorted()?
58+
.into_iter()
59+
.filter(|b| b.bundle_type().should_have_entitlements())
60+
.collect::<Vec<_>>();
5861

5962
if let Some(new_name) = self.options.custom_name.as_ref() {
6063
bundle.set_name(new_name)?;
@@ -141,7 +144,10 @@ impl Signer {
141144
team_id: &String,
142145
) -> Result<(), Error> {
143146

144-
let bundles = bundle.collect_bundles_sorted()?;
147+
let bundles = bundle.collect_bundles_sorted()?
148+
.into_iter()
149+
.filter(|b| b.bundle_type().should_have_entitlements())
150+
.collect::<Vec<_>>();
145151
let signer_settings = &self.options;
146152

147153
let bundle_arc = Arc::new(bundle.clone());
@@ -241,6 +247,9 @@ impl Signer {
241247
certificate: Option<&CertificateIdentity>,
242248
provisioning_files: &[MobileProvision],
243249
) -> Result<(), Error> {
250+
if *bundle.bundle_type() == BundleType::Unknown {
251+
return Ok(());
252+
}
244253

245254
let mut settings = Self::build_base_settings(certificate)?;
246255

@@ -251,11 +260,9 @@ impl Signer {
251260
</plist>
252261
"#.to_string();
253262

254-
if
255-
(*bundle.bundle_type() == BundleType::AppExtension
256-
|| *bundle.bundle_type() == BundleType::App)
257-
&& !provisioning_files.is_empty()
258-
{
263+
// Only Apps and AppExtensions should have entitlements from provisioning profiles
264+
// Dylibs, frameworks, and other components should be signed without entitlements
265+
if bundle.bundle_type().should_have_entitlements() && !provisioning_files.is_empty() {
259266
let mut matched_prov = None;
260267

261268
for prov in provisioning_files {
@@ -291,7 +298,6 @@ impl Signer {
291298
}
292299

293300
settings.set_entitlements_xml(SettingsScope::Main, entitlements_xml)?;
294-
295301
UnifiedSigner::new(settings).sign_path_in_place(bundle.bundle_dir())?;
296302

297303
Ok(())

0 commit comments

Comments
 (0)