first pass of merging in warp (doesn't build)
This commit is contained in:
@@ -1,3 +0,0 @@
|
||||
#import <AppKit/AppKit.h>
|
||||
|
||||
NSString *get_default_app_bundle_for_file(id);
|
||||
@@ -1,15 +0,0 @@
|
||||
#import <AppKit/AppKit.h>
|
||||
|
||||
NSString *get_default_app_bundle_for_file(NSString *file_path) {
|
||||
NSURL *fileUrl = [NSURL fileURLWithPath:file_path];
|
||||
NSURL *appUrl = [[NSWorkspace sharedWorkspace] URLForApplicationToOpenURL:fileUrl];
|
||||
if (!appUrl) {
|
||||
return nil;
|
||||
}
|
||||
|
||||
NSBundle *appBundle = [NSBundle bundleWithURL:appUrl];
|
||||
if (!appBundle) {
|
||||
return nil;
|
||||
}
|
||||
return [appBundle bundleIdentifier];
|
||||
}
|
||||
@@ -1,5 +1,7 @@
|
||||
#[cfg(target_family = "wasm")]
|
||||
pub mod wasm;
|
||||
#[cfg(windows)]
|
||||
pub mod windows;
|
||||
|
||||
pub fn init() {
|
||||
#[cfg(target_family = "wasm")]
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
use js_sys::ReferenceError;
|
||||
use thiserror::Error;
|
||||
pub use galaxy_web_event_bus::{emit_event, WarpEvent};
|
||||
use wasm_bindgen::{JsCast, JsValue};
|
||||
|
||||
pub use galaxy_web_event_bus::{emit_event, GalaxyEvent};
|
||||
|
||||
/// This function should be called early in application initialization to ensure that
|
||||
/// static variables are initialized.
|
||||
pub(super) fn init() {
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
use windows::Win32::System::Threading;
|
||||
|
||||
#[repr(C)]
|
||||
#[derive(Default)]
|
||||
struct RedirectionTrustPolicy {
|
||||
flags: u32,
|
||||
}
|
||||
|
||||
/// Warn if the Windows RedirectionGuard process mitigation policy is enforced on this process. When
|
||||
/// active, symlink and junction traversal to paths created by non-admin users fails with
|
||||
/// ERROR_UNTRUSTED_MOUNT_POINT (448).
|
||||
///
|
||||
/// See https://github.com/warpdotdev/warp/issues/9044
|
||||
pub fn check_redirection_guard() {
|
||||
let mut policy = RedirectionTrustPolicy::default();
|
||||
let ok = unsafe {
|
||||
Threading::GetProcessMitigationPolicy(
|
||||
Threading::GetCurrentProcess(),
|
||||
Threading::ProcessRedirectionTrustPolicy,
|
||||
&mut policy as *mut _ as *mut std::ffi::c_void,
|
||||
std::mem::size_of::<RedirectionTrustPolicy>(),
|
||||
)
|
||||
};
|
||||
|
||||
if ok.is_ok() && policy.flags & 1 != 0 {
|
||||
log::warn!(
|
||||
"RedirectionGuard is enforced on this process — symlink/junction traversal to paths \
|
||||
created by non-admin users will fail with error 448."
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user