mirror of
https://github.com/BerriAI/litellm.git
synced 2026-09-26 01:12:21 +00:00
* fix(secrets): verify provider API request and payload contracts * wip * fix(secrets): unify backend reads and route secret resolution * feat(secrets): bind built-in managers to retained Rust backends * refactor(secrets): centralize catalog dispatch and native binding * test(secrets): split provider integration tests * refactor(secrets): enforce cache and rotation contracts * test(secrets): stub parent packages in failing resolver fixture Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> * refactor(secrets): pass manager settings through the interop boundary Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> * fix(secrets): align cloud KMS auth and harden provider reads * ci(rust): raise native wheel size gate to 40 MB for secrets backends Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> * fix(proxy): treat unset google kms flag as disabled like the old loader Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> * fix(secrets): preserve certificate credentials and disabled KMS flags * test(secrets): cover certificate validation and bounded auth retries * test(secrets): cover Python dispatch without the native extension * test(proxy): skip legacy secret manager cases when the optional SDK is missing Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> * fix(secrets): port Python parity tests and preserve provider behavior * fix(secrets): store the captured native config without setattr to satisfy the strict lint budget Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> * fix(secrets): preserve missing Azure manager values Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> * test(secrets): pin typed values and recovery failure precedence * refactor(secrets): organize provider internals and behavioral test suites * refactor(secrets): simplify recovery and isolate Python compatibility * fix(secrets): distinguish Azure callback absence from HTTP not found * fix(secrets): preserve Python AWS read results at the bridge * fix(secrets): route public reads through the native catalog bridge * fix(secrets): keep JSON selection outside the bridge Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> * fix(secrets): preserve provider JSON reads at the bridge Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> * fix(secrets): preserve Python primary JSON semantics Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> * fix(secrets): preserve CyberArk mutation behavior through the native bridge * docs(secrets): record public API replacement gaps * refactor(secrets): share Vault write payload preparation * feat(secrets): route Vault mutations through the native bridge * fix(secrets): preserve typed Vault rotation failures * refactor(secrets): move Python dispatch into bridge * refactor(secrets): move CyberArk Python policy into bridge * refactor(secrets): move Vault Python policy into bridge * test(secrets): assert Vault rotation request paths * fix(secrets): keep bridge JSON interop centralized Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> --------- Co-authored-by: Yujong Lee <yujong@berri.ai> Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
62 lines
2.1 KiB
Rust
62 lines
2.1 KiB
Rust
#[cfg(test)]
|
|
mod tests {
|
|
use rstest::rstest;
|
|
|
|
use litellm_secrets::source::{EnvironmentSecrets, SecretSource};
|
|
|
|
#[rstest]
|
|
#[case::lowercase_true("LITELLM_ENVIRONMENT_SECRETS_TRUE", "true", None)]
|
|
#[case::padded_false("LITELLM_ENVIRONMENT_SECRETS_FALSE", " FALSE ", None)]
|
|
#[case::text("LITELLM_ENVIRONMENT_SECRETS_TEXT", "secret", Some("secret"))]
|
|
#[tokio::test]
|
|
async fn python_environment_values_are_absent_like_get_secret_str(
|
|
#[case] name: &'static str,
|
|
#[case] value: &str,
|
|
#[case] expected: Option<&str>,
|
|
) {
|
|
unsafe { std::env::set_var(name, value) };
|
|
let secret = EnvironmentSecrets::python_compatible()
|
|
.resolve(&[name])
|
|
.await
|
|
.unwrap()
|
|
.get(name);
|
|
unsafe { std::env::remove_var(name) };
|
|
assert_eq!(secret.as_deref(), expected);
|
|
}
|
|
}
|
|
|
|
#[tokio::test]
|
|
async fn dynamic_names_use_the_same_resolver_and_snapshots_never_do_fresh_lookups() {
|
|
use litellm_secrets::source::SecretSource;
|
|
use litellm_secrets::{OidcResolver, SecretManagerState, SecretResolver};
|
|
use std::sync::{
|
|
Arc,
|
|
atomic::{AtomicUsize, Ordering},
|
|
};
|
|
|
|
let calls = Arc::new(AtomicUsize::new(0));
|
|
let reads = calls.clone();
|
|
let source = SecretResolver::new(
|
|
Arc::new(SecretManagerState::default()),
|
|
Arc::new(move |name: &str| {
|
|
reads.fetch_add(1, Ordering::SeqCst);
|
|
(name != "missing").then(|| name.to_owned())
|
|
}),
|
|
OidcResolver::default(),
|
|
);
|
|
let snapshot = source.resolve(&["declared", "missing"]).await.unwrap();
|
|
let name = format!("runtime-{}", "key");
|
|
assert_eq!(snapshot.get("declared").as_deref(), Some("declared"));
|
|
assert_eq!(snapshot.get("missing"), None);
|
|
assert_eq!(snapshot.get(&name), None);
|
|
assert_eq!(calls.load(Ordering::SeqCst), 2);
|
|
assert_eq!(
|
|
SecretSource::get_secret_str(&source, &name)
|
|
.await
|
|
.unwrap()
|
|
.unwrap()
|
|
.expose(),
|
|
name
|
|
);
|
|
assert_eq!(calls.load(Ordering::SeqCst), 3);
|
|
}
|