領先一步
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 組合專案中存在的安全漏洞,請參閱安全策略