【发布时间】:2021-12-07 06:26:41
【问题描述】:
我们有一个公司/私有 maven 注册表(“工件”),我们的项目使用它来解决项目的依赖关系。
这个私有 maven 注册表还代理 Maven Central 以获取公共依赖项,这意味着最初没有由内部注册表解析的依赖项。
我们希望避免供应链攻击,即有人重载我们在私有/企业 maven 注册表中使用的自定义依赖项,并在 Maven Central 中使用相同的标识符。
比如说,在 Maven Central 中发布一个恶意依赖工件,使用与内部相同的 groupId 和 artifactId,但使用更高的 version - 然后那个会优先并在我们的系统中造成严重破坏。
在 npm 中,有一种机制允许将依赖项“标记”到某个私有注册表(通过 scope)。
Maven 中是否有类似的机制允许某些依赖项仅从内部工件解析,而阻止它从 Maven Central 解析?
我正在考虑类似artifactory:
<dependency>
<groupId>org.acme</groupId>
<artifactId>supersecret</artifactId>
<version>3.141</version>
<artifactory>internal_corporate_artifactory_name</artifactory> <!-- as described in settings.xml or Super-Pom -->
</dependency>
【问题讨论】:
标签: maven security dependencies artifactory dependency-management