Package managers such as NPM have become essential for software development. The NPM repository hosts over 2 million packages and serves over 43 billion downloads every week. Unfortunately, the NPM dependency solver has several shortcomings. 1) NPM is greedy and often fails to installs the newest versions of dependencies; 2) NPM's algorithm leads to duplicated dependencies and bloated code, which is particularly bad for web applications that need to minimize code size; 3) NPM's vulnerability fixing algorithm is also greedy, and can even introduce new vulnerabilities; and 4) NPM's ability to duplicate dependencies can break stateful frameworks and requires a lot of care to workaround. Although existing tools try to address these problems they are either brittle, rely on post hoc changes to the dependency tree, do not guarantee optimality, and are not composable. We present PacSolve, a unifying framework and implementation for dependency solving which allows for customizable constraints and optimization goals. We use PacSolve to build MaxNPM, a complete, drop-in replacement for NPM, which empowers developers to combine multiple objectives when installing dependencies. We evaluate MaxNPM with a large sample of packages from the NPM ecosystem and show that it can: 1) reduce more vulnerabilities in dependencies than NPM's auditing tool in 33% cases; 2) chooses newer dependencies than NPM in 14% cases; and 3) chooses fewer dependencies than NPM in 21% cases. All our code and data is open and available.
翻译:国家防范机制的软件包管理者,如国家预防机制等,对软件开发至关重要。国家防范机制储存库拥有超过200万套软件,每周下载量超过430亿次。不幸的是,国家防范机制依赖者有一些缺点。 1)国家防范机制贪婪,往往无法安装最新的依赖性版本;2)国家预防机制的算法导致依赖性和浮肿代码重复,这对网络应用中需要尽量减少代码大小的网络应用尤其不利;3)国家防范机制的脆弱性确定算法也是贪婪的,甚至可能引入新的脆弱性;4)国家防范机制的重复依赖能力可能打破州框架,需要非常谨慎地解决。虽然现有工具试图解决这些问题,但要么是弱小的,依靠依赖依赖树的最新版本;2)我们提出了解决依赖性的统一框架和实施,从而可以定制限制和优化目标;3)我们使用PacSolve系统来构建马克斯NPM系统,一个完整、空置的替代机制,这个机制在安装依赖性框架时能够将多重目标结合起来。我们用到马克斯-马斯-马斯-马斯-马斯-马斯-马斯-马斯-马基-马基-马基-马基-马基-马基-马基-马基-马基-马基-马基-马基-马基-马基-马基-马基-马基-马基-马基-马基-马基-马基-马基-马基-马基-马基-马基-马基-马基-马基-马基-马基-马-马-马基-马-马基-马基-马基-马基-马-马基-马基-马基-马-比-比-马基-比-比-比比比比基-马基-马基-马基-马基-马-马基-马基-马基-马基-马基-马基-马基-马基-马基-马基-马基-马基-马基-马基-马基-马基-马基-马基-马基-马基-马基-马基-马基-马基-马基-马基-马基-马基-马基-马基-马基-马基-马基-马基-马基-马