The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.
Rust agent-orchestrationai-agentsai-assistantdesktopllmlocal-firstmcppersonal-aiprivacyrustsecond-braintauri
fix(credentials): restructure OAuth credential operations
Steven Enamakel91c093cf4b17
diff --git a/crates/openhuman-core/src/security/credentials/ops.rs b/crates/openhuman-core/src/security/credentials/ops.rsindex 12ea55f33c..3a26d7eda3 100644--- a/crates/openhuman-core/src/security/credentials/ops.rs+++ b/crates/openhuman-core/src/security/credentials/ops.rs@@ -4,7 +4,6 @@ mod boot_env;mod composio;mod credential;mod gated_services;-mod oauth;mod provider_credentials;mod secrets;mod session_query;@@ -25,7 +24,6 @@ pub use gated_services::{start_credential_gated_services, start_login_gated_services, stop_credential_gated_services,stop_login_gated_services,};-pub use oauth::oauth_fetch_client_key;pub use provider_credentials::{list_provider_credentials, list_provider_credentials_by_prefix, remove_provider_credentials,store_provider_credentials,diff --git a/crates/openhuman-core/src/security/credentials/ops/oauth.rs b/crates/openhuman-core/src/security/credentials/ops/oauth.rsdeleted file mode 100644index 6a4e034fb4..0000000000--- a/crates/openhuman-core/src/security/credentials/ops/oauth.rs+++ /dev/null@@ -1,39 +0,0 @@-//! The one backend-brokered OAuth call the core still serves.-//!-//! `auth.oauth_connect`, `auth.oauth_list_integrations`,-//! `auth.oauth_fetch_integration_tokens` and `auth.oauth_revoke_integration`-//! moved to `openhuman-tinyhumans` (`hosted::oauth`, on the TinyHumans SDK).-//! `auth.oauth_fetch_client_key` stays here because its route-//! (`POST /auth/integrations/{id}/client-key`) has no SDK method and is absent-//! from the SDK's public-route registry; it moves once the route is added to-//! the SDK upstream.--use serde_json::json;--use crate::backend::BackendClient;-use crate::config::Config;-use crate::core::Outcome;-use crate::security::credentials::jwt::get_session_token;--pub async fn oauth_fetch_client_key(- config: &Config,- integration_id: &str,-) -> Result<Outcome<serde_json::Value>, String> {- let token = get_session_token(config)?.ok_or_else(|| "session JWT required".to_string())?;- let api_url = crate::backend::require_base_url(&config.api_url)?;- let client = BackendClient::new(&api_url).map_err(|e| e.to_string())?;- // `flatten_authed_error` keeps a 401 on the `SESSION_EXPIRED` sentinel (and- // a missing transport on `BACKEND_UNAVAILABLE:`) instead of an opaque string.- let client_key = client- .fetch_client_key(integration_id, &token)- .await- .map_err(crate::backend::flatten_authed_error)?;- log::debug!(- "[credentials] client key retrieved for integration {}",- integration_id- );- Ok(Outcome::single_log(- json!({ "clientKey": client_key, "integrationId": integration_id }),- "client key retrieved (one-time handoff)",- ))-}diff --git a/crates/openhuman-core/src/security/credentials/ops_provider_oauth_tests.rs b/crates/openhuman-core/src/security/credentials/ops_provider_oauth_tests.rsindex 29e79a78a7..b1c07ed4cd 100644--- a/crates/openhuman-core/src/security/credentials/ops_provider_oauth_tests.rs+++ b/crates/openhuman-core/src/security/credentials/ops_provider_oauth_tests.rs@@ -267,16 +267,6 @@ async fn list_provider_credentials_sorts_by_provider_then_profile_name() {assert_eq!(all.value[2].provider, "zeta");}-// ── oauth_* (validation paths that don't require network) ─────--#[tokio::test]-async fn oauth_fetch_client_key_errors_without_session() {- let tmp = TempDir::new().unwrap();- let config = test_config(&tmp);- let err = oauth_fetch_client_key(&config, "int-1").await.unwrap_err();- assert!(err.contains("session JWT required"));-}-// ── list_provider_credentials_by_prefix ───────────────────────/// Issue #1149 root-cause regression: the exact-match filter ondiff --git a/crates/openhuman-core/src/security/credentials/schemas.rs b/crates/openhuman-core/src/security/credentials/schemas.rsindex 29543d8e11..e25706b470 100644--- a/crates/openhuman-core/src/security/credentials/schemas.rs+++ b/crates/openhuman-core/src/security/credentials/schemas.rs@@ -36,12 +36,6 @@ struct AuthListProviderCredentialsParams {provider: Option<String>,}-#[derive(Debug, Deserialize)]-#[serde(rename_all = "camelCase")]-struct AuthOauthFetchClientKeyParams {- integration_id: String,-}-#[derive(Debug, Deserialize, Default)]#[serde(rename_all = "camelCase")]struct AuthClearCredentialParams {@@ -58,7 +52,6 @@ pub fn all_controller_schemas() -> Vec<ControllerSchema> {schemas("auth_store_provider_credentials"),schemas("auth_remove_provider_credentials"),schemas("auth_list_provider_credentials"),- schemas("auth_oauth_fetch_client_key"),]}@@ -92,10 +85,6 @@ pub fn all_registered_controllers() -> Vec<RegisteredController> {schema: schemas("auth_list_provider_credentials"),handler: handle_auth_list_provider_credentials,},- RegisteredController {- schema: schemas("auth_oauth_fetch_client_key"),- handler: handle_auth_oauth_fetch_client_key,- },]}@@ -187,16 +176,6 @@ pub fn schemas(function: &str) -> ControllerSchema {inputs: vec![optional_string("provider", "Optional provider filter.")],outputs: vec![json_output("profiles", "Listed provider credentials.")],},- "auth_oauth_fetch_client_key" => ControllerSchema {- namespace: "auth",- function: "oauth_fetch_client_key",- description: "Fetch one-time client key share for an encrypted OAuth integration.",- inputs: vec![required_string(- "integrationId",- "Integration id (24-char hex).",- )],- outputs: vec![json_output("result", "Client key share payload (base64).")],- },_ => ControllerSchema {namespace: "auth",function: "unknown",@@ -309,20 +288,6 @@ fn handle_auth_list_provider_credentials(params: Map<String, Value>) -> Controll})}-fn handle_auth_oauth_fetch_client_key(params: Map<String, Value>) -> ControllerFuture {- Box::pin(async move {- let config = config_rpc::load_config_with_timeout().await?;- let payload = deserialize_params::<AuthOauthFetchClientKeyParams>(params)?;- to_json(- crate::security::credentials::rpc::oauth_fetch_client_key(- &config,- payload.integration_id.trim(),- )- .await?,- )- })-}-fn deserialize_params<T: DeserializeOwned>(params: Map<String, Value>) -> Result<T, String> {serde_json::from_value(Value::Object(params)).map_err(|e| format!("invalid params: {e}"))}diff --git a/crates/openhuman-core/src/security/credentials/schemas_tests.rs b/crates/openhuman-core/src/security/credentials/schemas_tests.rsindex 087ac0a3a9..be0f1adacd 100644--- a/crates/openhuman-core/src/security/credentials/schemas_tests.rs+++ b/crates/openhuman-core/src/security/credentials/schemas_tests.rs@@ -59,7 +59,6 @@ fn every_known_schema_key_returns_a_non_unknown_schema() {"auth_store_provider_credentials","auth_remove_provider_credentials","auth_list_provider_credentials",- "auth_oauth_fetch_client_key",];for k in keys {let s = schemas(k);