领先一步
VMware 提供培训和认证,助您加速进步。
了解更多当 Spring Cloud Config Server 向 Vault 发出请求时,它可能不会使用客户端通过 X-CONFIG-TOKEN 头部发送的 Vault 令牌。
如果满足以下条件,您的应用程序可能会受到影响:
X-CONFIG-TOKEN 头部向 Spring Cloud Config Server 发送 Vault 令牌,以便 Config Server 在向 Vault 发出请求时使用,并且SessionManager 实现 LifecycleAwareSessionManager 或持久化 Vault 令牌的 SessionManager 实现,例如 SimpleSessionManager。在这种情况下,SessionManager 会持久化它检索到的第一个令牌,并会继续使用该令牌,即使客户端向 Spring Cloud Config Server 发出的请求包含带有不同值的 X-CONFIG-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,并在 @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 组合项目中存在的安全漏洞,请参阅安全策略