fix: integrate 24 reviewed browser/native/semantics corrections (#815)
* fix(reference): resolve emitted extensions to TypeScript source Signed-off-by: Rudy Celekli <rudy@gradiahq.com> * test(reference): retain legitimate declaration import counterparts Signed-off-by: Rudy Celekli <rudy@gradiahq.com> * fix(mcp): recognize implicit form elicitation capability Signed-off-by: RudyCelekli <47457359+rudycelekli@users.noreply.github.com> * fix(ghidra): reject contradictory NativeAOT reports * fix(native): preserve thin architectures across echoed filename lines Signed-off-by: Rudy Celekli <47457359+rudycelekli@users.noreply.github.com> * fix(native): preserve app bundle executable filename whitespace Signed-off-by: Rudy Celekli <47457359+rudycelekli@users.noreply.github.com> * fix(doctor): validate Node-wrapped client policy Signed-off-by: RudyCelekli <47457359+rudycelekli@users.noreply.github.com> * fix(reference): preserve observed entry failure reasons Signed-off-by: Rudy Celekli <rudy@gradiahq.com> * fix(artifacts): verify opaque bytes before reusing inventory identities Signed-off-by: Rudy Celekli <rudy@gradiahq.com> * fix(browser): resolve DOM destinations against document base URL Signed-off-by: Rudy Celekli <rudy@gradiahq.com> * fix: recover serialized native NIB view hierarchy Signed-off-by: RudyCelekli <47457359+rudycelekli@users.noreply.github.com> * ci: exercise native compiled NIB hierarchy regressions Signed-off-by: RudyCelekli <47457359+rudycelekli@users.noreply.github.com> * fix(deps): remediate reachable archive-parsing advisories Two high-severity advisories are reachable from untrusted target content: - @xmldom/xmldom 0.9.10 (via plist) parses XML plist bytes from analyzed app bundles in the keyed-archive reader. Refreshed to 0.9.12. - brace-expansion 5.0.7 (via @electron/asar -> minimatch) is reached while analyzing untrusted ASAR archives. Refreshed to 5.0.12. Both are in-range patch updates (plist declares ^0.9.10, minimatch declares ^5.0.5), so no source or API change is required and no direct dependency declaration moves. Lockfile-only change. The remaining smol-toml advisory is not included: it parses operator-owned client configuration rather than untrusted target content, and its fix moves outside the declared range and changes leading-BOM handling. * fix(semantics): link wrapped arrow Promise returns * fix(reconstruction): preserve unknown graph limitations * fix(native): preserve exact code signing identifiers Signed-off-by: Rudy Celekli <47457359+rudycelekli@users.noreply.github.com> * fix(native): recognize only whole otool command headers Signed-off-by: Rudy Celekli <47457359+rudycelekli@users.noreply.github.com> * fix(native): retain nm-proven literal export names Signed-off-by: Rudy Celekli <47457359+rudycelekli@users.noreply.github.com> * fix(javascript): project decoded file URL paths Signed-off-by: Rudy Celekli <47457359+rudycelekli@users.noreply.github.com> * fix: preserve explicit source-relative URL observation spelling Signed-off-by: Rudy Celekli <47457359+rudycelekli@users.noreply.github.com> * fix(native): project Mach-O evidence into container file offsets Signed-off-by: Rudy Celekli <47457359+rudycelekli@users.noreply.github.com> * fix(browser): normalize referrer policy fallback lists Signed-off-by: Rudy Celekli <47457359+rudycelekli@users.noreply.github.com> --------- Signed-off-by: Rudy Celekli <rudy@gradiahq.com> Signed-off-by: RudyCelekli <47457359+rudycelekli@users.noreply.github.com> Signed-off-by: Rudy Celekli <47457359+rudycelekli@users.noreply.github.com> Co-authored-by: Rudy Celekli <rudy@gradiahq.com> Co-authored-by: RudyCelekli <47457359+rudycelekli@users.noreply.github.com> Co-authored-by: Kaoru0822 <aisakamimaki@gmail.com> Co-authored-by: DeryFerd <deryferdikao125@gmail.com>
This commit is contained in:
co-authored by
Rudy Celekli
RudyCelekli
Kaoru0822
DeryFerd
parent
2572e1eb2f
commit
3af3811ab0
@@ -59,3 +59,91 @@ it.each([
|
||||
if (ownership === "unknown")
|
||||
expect(promise).toMatchObject({ ownerBindingId: null, returnSiteId: null });
|
||||
});
|
||||
|
||||
it.each([
|
||||
["Promise.resolve(1)", "resolve"],
|
||||
["((Promise.resolve(1)))", "resolve"],
|
||||
["(Promise.resolve(1) as Promise<number>)", "resolve"],
|
||||
["(Promise.resolve(1) satisfies Promise<number>)", "resolve"],
|
||||
["Promise.resolve(1)!", "resolve"],
|
||||
["((Promise.resolve(1) as Promise<number>)!)", "resolve"],
|
||||
["(new Promise(resolve => resolve(1)) as Promise<number>)", "new"],
|
||||
["(Promise.all([Promise.resolve(1)]) as Promise<number[]>)", "all"],
|
||||
["(Promise.resolve(1).then(value => value) as Promise<number>)", "then"],
|
||||
])("links the exact arrow return site for %s", (expression, method) => {
|
||||
const ir = analyzeJavaScriptSemantics(`const run = () => ${expression};`);
|
||||
const callable = ir.callables.find(({ name }) => name === "run");
|
||||
expect(callable?.returnSites).toHaveLength(1);
|
||||
const site = callable?.returnSites[0];
|
||||
if (site === undefined) throw new Error("Expected the arrow return site");
|
||||
const promise = ir.promiseOperations.find(
|
||||
(operation) => operation.method === method,
|
||||
);
|
||||
expect(promise).toMatchObject({
|
||||
ownership: "returned",
|
||||
ownerCallableId: callable?.callableId,
|
||||
returnSiteId: site.returnSiteId,
|
||||
});
|
||||
});
|
||||
|
||||
it.each([
|
||||
"const outer = () => () => (Promise.resolve(1) as Promise<number>);",
|
||||
"const outer = () => { const inner = () => Promise.resolve(1)!; return inner; };",
|
||||
])("keeps a wrapped return owned by its nested arrow: %s", (source) => {
|
||||
const ir = analyzeJavaScriptSemantics(source);
|
||||
const promise = ir.promiseOperations.find(
|
||||
({ method }) => method === "resolve",
|
||||
);
|
||||
const owner = ir.callables.find(
|
||||
({ callableId }) => callableId === promise?.ownerCallableId,
|
||||
);
|
||||
const outer = ir.callables.find(({ name }) => name === "outer");
|
||||
const site = owner?.returnSites[0];
|
||||
if (site === undefined)
|
||||
throw new Error("Expected the nested arrow return site");
|
||||
expect(owner?.callableId).not.toBe(outer?.callableId);
|
||||
expect(promise).toMatchObject({
|
||||
ownership: "returned",
|
||||
returnSiteId: site.returnSiteId,
|
||||
});
|
||||
expect(
|
||||
outer?.returnSites.map(({ returnSiteId }) => returnSiteId),
|
||||
).not.toContain(promise?.returnSiteId);
|
||||
});
|
||||
|
||||
it.each([
|
||||
["consume((Promise.resolve(1) as Promise<number>))", "unknown"],
|
||||
["[(Promise.resolve(1) as Promise<number>)]", "unknown"],
|
||||
["({ task: Promise.resolve(1)! })", "unknown"],
|
||||
["(condition ? Promise.resolve(1)! : other)", "unknown"],
|
||||
["((0, Promise.resolve(1)) as Promise<number>)", "unknown"],
|
||||
["await (Promise.resolve(1) as Promise<number>)", "awaited"],
|
||||
])("does not invent a return link through %s", (expression, ownership) => {
|
||||
const ir = analyzeJavaScriptSemantics(
|
||||
`const run = async () => ${expression};`,
|
||||
);
|
||||
expect(
|
||||
ir.promiseOperations.find(({ method }) => method === "resolve"),
|
||||
).toMatchObject({
|
||||
ownership,
|
||||
returnSiteId: null,
|
||||
});
|
||||
});
|
||||
|
||||
it("keeps an explicit return statement's full range and the producer's location", () => {
|
||||
const source =
|
||||
"const run = () => { return (Promise.resolve(1) as Promise<number>); };";
|
||||
const ir = analyzeJavaScriptSemantics(source);
|
||||
const site = ir.callables.find(({ name }) => name === "run")?.returnSites[0];
|
||||
if (site === undefined) throw new Error("Expected a return statement");
|
||||
const start = source.indexOf("Promise.resolve(1)");
|
||||
expect(ir.promiseOperations[0]).toMatchObject({
|
||||
ownership: "returned",
|
||||
returnSiteId: site.returnSiteId,
|
||||
location: {
|
||||
start: { line: 1, column: start },
|
||||
end: { line: 1, column: start + "Promise.resolve(1)".length },
|
||||
},
|
||||
});
|
||||
expect(site.location.start.column).toBe(source.indexOf("return"));
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user