@@ -7,18 +7,64 @@ import { describe, expect, it } from "vitest";
77const require = createRequire ( import . meta. url ) ;
88
99describe ( "background-removal native dependency compatibility" , ( ) => {
10- it ( "pins onnxruntime-node to the last release with an Intel macOS binary " , ( ) => {
10+ it ( "keeps CLI native dependencies above their patched security floors " , ( ) => {
1111 const packagePath = fileURLToPath ( new URL ( "../../package.json" , import . meta. url ) ) ;
1212 const packageJson = JSON . parse ( readFileSync ( packagePath , "utf8" ) ) as {
1313 dependencies ?: Record < string , string > ;
1414 } ;
1515
16- expect ( packageJson . dependencies ?. [ "onnxruntime-node" ] ) . toBe ( "1.23.2" ) ;
16+ expect ( packageJson . dependencies ) . toMatchObject ( {
17+ "adm-zip" : "^0.6.0" ,
18+ sharp : "^0.35.0" ,
19+ } ) ;
20+ } ) ;
21+
22+ it ( "keeps every Node server consumer above the patched security floor" , ( ) => {
23+ for ( const manifest of [
24+ "../../package.json" ,
25+ "../../../engine/package.json" ,
26+ "../../../producer/package.json" ,
27+ "../../../gcp-cloud-run/package.json" ,
28+ ] ) {
29+ const packageJson = JSON . parse (
30+ readFileSync ( fileURLToPath ( new URL ( manifest , import . meta. url ) ) , "utf8" ) ,
31+ ) as {
32+ dependencies ?: Record < string , string > ;
33+ } ;
34+ expect ( packageJson . dependencies ?. [ "@hono/node-server" ] , manifest ) . toBe ( "^2.0.5" ) ;
35+ }
36+ } ) ;
37+
38+ it ( "pins the newest clean-audit ONNX release that retains Intel macOS" , ( ) => {
39+ const packagePath = fileURLToPath ( new URL ( "../../package.json" , import . meta. url ) ) ;
40+ const packageJson = JSON . parse ( readFileSync ( packagePath , "utf8" ) ) as {
41+ dependencies ?: Record < string , string > ;
42+ } ;
43+
44+ // 1.22+ pulls vulnerable adm-zip <0.6.0, while later releases also drop
45+ // the Intel macOS binary. Return to a newer ONNX release once it satisfies
46+ // both the clean dependency graph and the six-platform binary contract.
47+ expect ( packageJson . dependencies ?. [ "onnxruntime-node" ] ) . toBe ( "1.21.1" ) ;
1748
1849 const bindingEntry = require . resolve ( "onnxruntime-node" ) ;
1950 const packageRoot = join ( dirname ( bindingEntry ) , ".." ) ;
20- expect ( existsSync ( join ( packageRoot , "bin/napi-v6/darwin/x64/onnxruntime_binding.node" ) ) ) . toBe (
21- true ,
22- ) ;
51+ const onnxPackageJson = JSON . parse ( readFileSync ( join ( packageRoot , "package.json" ) , "utf8" ) ) as {
52+ dependencies ?: Record < string , string > ;
53+ } ;
54+ expect ( onnxPackageJson . dependencies ) . not . toHaveProperty ( "adm-zip" ) ;
55+
56+ for ( const [ platform , arch ] of [
57+ [ "darwin" , "arm64" ] ,
58+ [ "darwin" , "x64" ] ,
59+ [ "linux" , "arm64" ] ,
60+ [ "linux" , "x64" ] ,
61+ [ "win32" , "arm64" ] ,
62+ [ "win32" , "x64" ] ,
63+ ] as const ) {
64+ expect (
65+ existsSync ( join ( packageRoot , "bin/napi-v3" , platform , arch , "onnxruntime_binding.node" ) ) ,
66+ `${ platform } /${ arch } binding should be published` ,
67+ ) . toBe ( true ) ;
68+ }
2369 } ) ;
2470} ) ;
0 commit comments