fix(native): refuse inspect_signature on non-Mach-O targets (#2262)
* fix(native): refuse inspect_signature on non-Mach-O targets This provider's signature inspection covers Mach-O code signatures only. On a xar pkg, codesign's "code object is not signed" verdict cannot see the archive-level signature layer, so a signed or invalidly-signed package was reported as signed:false with "Artifact is not signed." Match the existing inspect_macho/list_architectures gate and report capability_unavailable instead of an unsigned claim for a layer that was never evaluated. Generated with [Devin](https://devin.ai) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com> * test(native): scope the signature-gate comment to this provider Generated with [Devin](https://devin.ai) Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com> * fix(native): align signature capability discovery with Mach-O support Bind inspect_signature availability to Mach-O targets in capability discovery and align the public tool description. Source inspection and git diff --check; tests/builds/typechecks/CI reruns skipped at explicit user request. --------- Co-authored-by: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com> Co-authored-by: morluto <76467478+morluto@users.noreply.github.com>
This commit is contained in:
co-authored by
Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
morluto
parent
cae7620b77
commit
5eb296649d
@@ -1024,6 +1024,38 @@ describe("native macOS provider failures and parsing", () => {
|
||||
});
|
||||
});
|
||||
|
||||
describe("native signature inspection target scope", () => {
|
||||
// This provider's inspect_signature path is scoped to Mach-O targets; on
|
||||
// another container a codesign verdict cannot see a format-level signature
|
||||
// such as a xar pkg signature.
|
||||
it.each([
|
||||
{
|
||||
path: "/fixture.pkg",
|
||||
sha256: "0".repeat(64),
|
||||
kind: "archive" as const,
|
||||
format: "pkg" as const,
|
||||
},
|
||||
{
|
||||
...machoTarget("/fixture.elf"),
|
||||
format: "elf" as const,
|
||||
},
|
||||
])(
|
||||
"refuses inspect_signature on a $format target without running codesign",
|
||||
async (target) => {
|
||||
const runner = new CountingRunner();
|
||||
const result = await new NativeMacOSProvider({}, runner, "darwin")
|
||||
.createClient(target)
|
||||
.execute("inspect_signature", {});
|
||||
if (result.ok) throw new Error("Expected a non-Mach-O refusal");
|
||||
expect(result.error._tag).toBe("AnalysisCapabilityUnavailableError");
|
||||
expect(projectAnalysisError(result.error)).toMatchObject({
|
||||
code: "capability_unavailable",
|
||||
});
|
||||
expect(runner.calls).toBe(0);
|
||||
},
|
||||
);
|
||||
});
|
||||
|
||||
class FailingRunner implements NativeCommandRunner {
|
||||
constructor(private readonly reason: NativeCommandFailure["reason"]) {}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user