Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions apple-codesign/src/bundle_signing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -469,6 +469,14 @@ impl<'a, 'key> BundleSigningContext<'a, 'key> {
) -> Result<(PathBuf, SignedMachOInfo), AppleCodesignError> {
warn!("signing Mach-O file {}", bundle_rel_path.display());

#[cfg(unix)]
{
use std::os::unix::fs::PermissionsExt;
let mut perms = std::fs::metadata(source_path)?.permissions();
perms.set_mode(0o755);
std::fs::set_permissions(source_path, perms)?;
}

let macho_data = std::fs::read(source_path)?;
let signer = MachOSigner::new(&macho_data)?;

Expand Down Expand Up @@ -723,6 +731,14 @@ impl SingleBundleSigner {
if let Some(exe) = main_exe {
warn!("signing main executable {}", exe.relative_path().display());

#[cfg(unix)]
{
use std::os::unix::fs::PermissionsExt;
let mut perms = std::fs::metadata(exe.absolute_path())?.permissions();
perms.set_mode(0o755);
std::fs::set_permissions(exe.absolute_path(), perms)?;
}

let macho_data = std::fs::read(exe.absolute_path())?;
let signer = MachOSigner::new(&macho_data)?;

Expand Down
9 changes: 9 additions & 0 deletions apple-codesign/src/signing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,15 @@ impl<'key> UnifiedSigner<'key> {
let output_path = output_path.as_ref();

warn!("signing {} as a Mach-O binary", input_path.display());

#[cfg(unix)]
{
use std::os::unix::fs::PermissionsExt;
let mut perms = std::fs::metadata(input_path)?.permissions();
perms.set_mode(0o755);
std::fs::set_permissions(input_path, perms)?;
}

let macho_data = std::fs::read(input_path)?;

let mut settings = self.settings.clone();
Expand Down