更进一步
VMware 提供培训和认证,以加速您的进步。
了解更多Spring Cloud Config Server 在向 Vault 发出请求时,可能不使用客户端使用 X-CONFIG-TOKEN
标头发送的 Vault token。
如果满足以下条件,您的应用程序可能会受到影响
X-CONFIG-TOKEN
标头将 Vault token 发送到 Spring Cloud Config Server,以便 Config Server 在向 Vault 发出请求时使用,并且SessionManager
实现 LifecycleAwareSessionManager
或一个持久化 Vault token 的 SessionManager
实现,例如 SimpleSessionManager
。在这种情况下,SessionManager
会持久化它检索到的第一个 token,并且即使客户端向 Spring Cloud Config Server 发出的请求包含具有不同值的 X-CONFIG-TOKEN
标头,它也会继续使用该 token。
Spring Cloud Config
受影响版本的用户应升级到相应的修复版本。
受影响的版本 | 修复版本 | 可用性 |
---|---|---|
4.2.x | 4.2.2 | OSS |
4.1.x | 4.1.6 | OSS |
4.0.x | 4.0.10 | 商业 |
3.1.x | 3.1.10 | 商业 |
3.0.x | 4.1.6 | OSS |
2.2.x | 4.1.6 | OSS |
注意:Spring Cloud Config 3.0.x 和 2.2.x 不再提供开源或商业支持。 建议这些版本的用户升级到受支持的版本。
不需要其他缓解措施。
如果您无法升级,那么您可以
SessionManager
,该 SessionManager
不会持久化 Vault token,并在 @Configuration
类中使用该实现提供一个 bean。 例如
public class StatelessSessionManager implements SessionManager {
private final ClientAuthentication clientAuthentication;
private final ReentrantLock lock = new ReentrantLock();
public StatelessSessionManager(ClientAuthentication clientAuthentication) {
Assert.notNull(clientAuthentication, "ClientAuthentication must not be null");
this.clientAuthentication = clientAuthentication;
}
public VaultToken getSessionToken() {
this.lock.lock();
try {
return this.clientAuthentication.login();
}
finally {
this.lock.unlock();
}
}
}
@Configuration
public class MySessionManagerConfiguration extends SpringVaultClientConfiguration {
private final VaultEnvironmentProperties vaultProperties;
public MySessionManagerConfiguration(VaultEnvironmentProperties vaultProperties, ConfigTokenProvider configTokenProvider, List authProviders) {
super(vaultProperties, configTokenProvider, authProviders);
this.vaultProperties = vaultProperties;
}
@Bean
@Primary
public SessionManager sessionManager() {
if (vaultProperties.getAuthentication() == null && !StringUtils.hasText(vaultProperties.getToken())) {
return new StatelessSessionManager(clientAuthentication());
}
return super.sessionManager();
}
}
此漏洞由 Max Brauer 和 Mohammad Shamsi 发现并负责任地报告。
要报告 Spring 产品组合中的项目的安全漏洞,请参阅 安全策略