feat(native): open extension, framework, XPC and plug-in bundle directories (#8117)

* feat(native): open extension, framework, XPC and plug-in bundle directories

open_binary and the CLI inspection commands admitted only .app
directories and pointed every other Apple bundle at the JavaScript
analyzer. Resolve .appex, .framework, .xpc, .systemextension, .bundle
and .plugin directories through their Info.plist CFBundleExecutable, in
the Contents or flat root layout, plus the versioned framework layout
under Versions/Current. Exactly one layout may declare the bundle and
every resolved path must stay inside it.

Unresolvable bundles fail closed with typed constraints, probed paths
and the Info.plist that was read. Other Apple bundle types are refused as
unsupported instead of being offered the JavaScript route. Resource-root
discovery shares the same layout rule, so inspect_plist reads a
versioned framework's Info.plist. The recognized bundle vocabulary now
has one owner in the domain.

Refs #4310

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* fix(native): refuse kernel extensions and state bundle error fields

Name the Apple bundle types binary routes recognize but do not open
(.dext, .kext, .qlgenerator, .mdimporter) explicitly, so a kernel
extension is refused as unsupported instead of receiving the JavaScript
route. Document which bundle refusals carry probed_paths and info_plist,
and make success tests throw the typed admission error before asserting.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* feat(native): open flattened frameworks through Resources/Info.plist

Electron and Gecko apps ship frameworks without Versions/: the program
file sits at the framework root beside Resources/Info.plist, the layout
#8101 taught bundle anatomy. Read that layout for a framework without
Versions/, and keep the versioned layout for one with it, so a versioned
framework's root Resources link is never read as a second declaration.
The resource root reports it as flattened-framework.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Kaoru0822andClaude Opus 5.5 authored and GitHub committed 2026-10-30 02:27:52 -07:00
1 parent a47dcca010
commit 37342ecde0
12 files changed
+742 -42

No files matched your search

+22 -7
View File
@@ -47,9 +47,14 @@ import { err, ok, type Result } from "../domain/result.js";
import { readMipsElfMetadata } from "./MipsElfMetadata.js";
import { validateElfDeclaredRanges } from "../domain/elfDeclaredRanges.js";
import {
resolveAppBundleExecutable,
resolveAppleBundleExecutable,
type ResolvedAppBundle,
} from "./AppBundleExecutable.js";
import {
OPENABLE_APPLE_BUNDLE_TYPES_TEXT,
isUnopenedAppleBundleExtension,
openableAppleBundleExtension,
} from "../domain/apple/appleBundleTypes.js";
import {
validateDosComLength,
type ExecutableFormatHint,
@@ -853,17 +858,27 @@ const resolveAppBundle = async (
): Promise<Result<ResolvedAppBundle, BinaryTargetError>> => {
const metadata = await stat(path);
if (!metadata.isDirectory()) return ok({ executable: path });
if (extname(path).toLowerCase() !== ".app")
if (openableAppleBundleExtension(extname(path)) !== undefined)
return resolveAppleBundleExecutable(path);
// Another Apple bundle type, such as a driver or kernel extension, is not
// an application directory and has no JavaScript route.
if (isUnopenedAppleBundleExtension(extname(path)))
return err(
new BinaryTargetError(
path,
"this opening route requires a file or app bundle",
{
constraint: "directory_requires_file",
},
`${extname(path)} bundle directories are not opened by this route; it opens ${OPENABLE_APPLE_BUNDLE_TYPES_TEXT} bundle directories`,
{ constraint: "bundle_type_unsupported" },
),
);
return resolveAppBundleExecutable(path);
return err(
new BinaryTargetError(
path,
"this opening route requires a file or a supported Apple bundle directory",
{
constraint: "directory_requires_file",
},
),
);
};
const readExecutableMetadata = async (