Skip to content

Commit 904c40c

Browse files
committed
fix: temporarily disable Azure and GCP secrets managers
1 parent aa1727b commit 904c40c

File tree

1 file changed

+37
-68
lines changed

1 file changed

+37
-68
lines changed

crates/infera-config/src/secrets.rs

Lines changed: 37 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,12 @@ use std::{collections::HashMap, fs, path::Path};
88
use aws_config::BehaviorVersion;
99
#[cfg(feature = "aws-secrets")]
1010
use aws_sdk_secretsmanager::Client as SecretsManagerClient;
11-
#[cfg(feature = "azure-secrets")]
12-
use azure_security_keyvault::SecretClient;
13-
#[cfg(feature = "gcp-secrets")]
14-
use google_secretmanager1::{SecretManager, hyper, hyper_rustls, oauth2};
11+
// Azure Key Vault support is temporarily disabled pending API updates
12+
// #[cfg(feature = "azure-secrets")]
13+
// use azure_security_keyvault::SecretClient;
14+
// GCP Secret Manager support is temporarily disabled pending API updates
15+
// #[cfg(feature = "gcp-secrets")]
16+
// use google_secretmanager1::SecretManager;
1517
use thiserror::Error;
1618

1719
#[derive(Debug, Error)]
@@ -158,7 +160,7 @@ impl SecretProvider for MemorySecretProvider {
158160
#[cfg(feature = "aws-secrets")]
159161
pub struct AwsSecretsProvider {
160162
client: SecretsManagerClient,
161-
region: String,
163+
_region: String,
162164
}
163165

164166
#[cfg(feature = "aws-secrets")]
@@ -173,7 +175,7 @@ impl AwsSecretsProvider {
173175

174176
let client = SecretsManagerClient::new(&config);
175177

176-
Ok(Self { client, region: region_str })
178+
Ok(Self { client, _region: region_str })
177179
}
178180

179181
/// Get a secret from AWS Secrets Manager (async)
@@ -205,59 +207,31 @@ impl SecretProvider for AwsSecretsProvider {
205207
/// GCP Secret Manager provider
206208
///
207209
/// Fetches secrets from Google Cloud Secret Manager
210+
///
211+
/// TODO: Update to use google-secretmanager1 v6+ API (breaking changes in hyper/oauth2)
212+
/// The google-secretmanager1 crate has updated its dependencies and API.
213+
/// This code needs to be updated to match the new API surface.
208214
#[cfg(feature = "gcp-secrets")]
209215
pub struct GcpSecretsProvider {
210-
hub: SecretManager<hyper_rustls::HttpsConnector<hyper::client::HttpConnector>>,
211-
project_id: String,
216+
_project_id: String,
212217
}
213218

214219
#[cfg(feature = "gcp-secrets")]
215220
impl GcpSecretsProvider {
216221
/// Create a new GCP Secret Manager provider
217-
pub async fn new(project_id: impl Into<String>) -> Result<Self, SecretError> {
218-
let secret = oauth2::read_application_secret("credentials.json").await.map_err(|e| {
219-
SecretError::InvalidFormat(format!("Failed to read GCP credentials: {}", e))
220-
})?;
221-
222-
let auth = oauth2::InstalledFlowAuthenticator::builder(
223-
secret,
224-
oauth2::InstalledFlowReturnMethod::HTTPRedirect,
225-
)
226-
.build()
227-
.await
228-
.map_err(|e| SecretError::InvalidFormat(format!("GCP auth error: {}", e)))?;
229-
230-
let hub = SecretManager::new(
231-
hyper::Client::builder().build(
232-
hyper_rustls::HttpsConnectorBuilder::new()
233-
.with_native_roots()
234-
.unwrap()
235-
.https_or_http()
236-
.enable_http1()
237-
.build(),
238-
),
239-
auth,
240-
);
241-
242-
Ok(Self { hub, project_id: project_id.into() })
222+
pub async fn new(_project_id: impl Into<String>) -> Result<Self, SecretError> {
223+
// TODO: Implement using updated google-secretmanager1 v6+ API
224+
// The API has changed significantly with hyper 1.0 and new oauth2 structure
225+
Err(SecretError::InvalidFormat(
226+
"GCP Secret Manager support requires API updates for google-secretmanager1 v6+".to_string()
227+
))
243228
}
244229

245230
/// Get a secret from GCP Secret Manager (async)
246-
pub async fn get_async(&self, key: &str) -> Result<String, SecretError> {
247-
let name = format!("projects/{}/secrets/{}/versions/latest", self.project_id, key);
248-
249-
let (_, secret_version) =
250-
self.hub.projects().secrets_versions_access(&name).doit().await.map_err(|e| {
251-
SecretError::InvalidFormat(format!("GCP Secret Manager error: {}", e))
252-
})?;
253-
254-
let payload = secret_version
255-
.payload
256-
.and_then(|p| p.data)
257-
.ok_or_else(|| SecretError::NotFound(key.to_string()))?;
258-
259-
String::from_utf8(payload)
260-
.map_err(|e| SecretError::InvalidFormat(format!("Invalid UTF-8 in secret: {}", e)))
231+
pub async fn get_async(&self, _key: &str) -> Result<String, SecretError> {
232+
Err(SecretError::InvalidFormat(
233+
"GCP Secret Manager support requires API updates".to_string()
234+
))
261235
}
262236
}
263237

@@ -276,36 +250,31 @@ impl SecretProvider for GcpSecretsProvider {
276250
/// Azure Key Vault provider
277251
///
278252
/// Fetches secrets from Azure Key Vault
253+
///
254+
/// TODO: Update to use azure-identity v0.29+ and azure-security-keyvault v0.21+ APIs
255+
/// The Azure SDK has updated with breaking changes to DefaultAzureCredential and SecretClient.
279256
#[cfg(feature = "azure-secrets")]
280257
pub struct AzureSecretsProvider {
281-
client: SecretClient,
282-
vault_url: String,
258+
_vault_url: String,
283259
}
284260

285261
#[cfg(feature = "azure-secrets")]
286262
impl AzureSecretsProvider {
287263
/// Create a new Azure Key Vault provider
288264
pub async fn new(vault_url: impl Into<String>) -> Result<Self, SecretError> {
289-
use azure_identity::DefaultAzureCredential;
290-
291-
let vault_url_str = vault_url.into();
292-
let credential = DefaultAzureCredential::default();
293-
let client = SecretClient::new(&vault_url_str, credential).map_err(|e| {
294-
SecretError::InvalidFormat(format!("Azure Key Vault client error: {}", e))
295-
})?;
296-
297-
Ok(Self { client, vault_url: vault_url_str })
265+
// TODO: Implement using updated azure-identity v0.29+ API
266+
// DefaultAzureCredential and SecretClient APIs have changed
267+
let _vault_url_str = vault_url.into();
268+
Err(SecretError::InvalidFormat(
269+
"Azure Key Vault support requires API updates for azure-identity v0.29+".to_string()
270+
))
298271
}
299272

300273
/// Get a secret from Azure Key Vault (async)
301-
pub async fn get_async(&self, key: &str) -> Result<String, SecretError> {
302-
let secret = self
303-
.client
304-
.get(key)
305-
.await
306-
.map_err(|e| SecretError::InvalidFormat(format!("Azure Key Vault error: {}", e)))?;
307-
308-
Ok(secret.value().to_string())
274+
pub async fn get_async(&self, _key: &str) -> Result<String, SecretError> {
275+
Err(SecretError::InvalidFormat(
276+
"Azure Key Vault support requires API updates".to_string()
277+
))
309278
}
310279
}
311280

0 commit comments

Comments
 (0)