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(security): remove unused credential store and parallel search modules
Steven Enamakel7a34936c28bf
diff --git a/crates/openhuman-core/src/search/tools/parallel/enrich.rs b/crates/openhuman-core/src/search/tools/parallel/enrich.rsindex a82e27fa4b..ddb3753eda 100644--- a/crates/openhuman-core/src/search/tools/parallel/enrich.rs+++ b/crates/openhuman-core/src/search/tools/parallel/enrich.rs@@ -12,13 +12,13 @@ use std::sync::Arc;#[derive(Debug, Deserialize)]pub(super) struct EnrichResponse {#[serde(default, rename = "runId")]- run_id: Option<String>,+ pub(super) run_id: Option<String>,#[serde(default)]- status: Option<String>,+ pub(super) status: Option<String>,#[serde(default)]- output: Option<serde_json::Value>,+ pub(super) output: Option<serde_json::Value>,#[serde(rename = "costUsd", default)]- cost_usd: f64,+ pub(super) cost_usd: f64,}pub(super) fn format_enrich_response(resp: EnrichResponse) -> Result<String, String> {@@ -58,7 +58,7 @@ pub(super) fn format_enrich_response(resp: EnrichResponse) -> Result<String, StrOk(out)}-fn enrich_payload(resp: &EnrichResponse, display: &str) -> serde_json::Value {+pub(super) fn enrich_payload(resp: &EnrichResponse, display: &str) -> serde_json::Value {json!({"display": display,"status": resp.status,diff --git a/crates/openhuman-core/src/search/tools/parallel/research.rs b/crates/openhuman-core/src/search/tools/parallel/research.rsindex be4c396992..9ad5775bf7 100644--- a/crates/openhuman-core/src/search/tools/parallel/research.rs+++ b/crates/openhuman-core/src/search/tools/parallel/research.rs@@ -12,13 +12,13 @@ use std::sync::Arc;#[derive(Debug, Deserialize)]pub(super) struct ResearchResponse {#[serde(default, rename = "runId")]- run_id: Option<String>,+ pub(super) run_id: Option<String>,#[serde(default)]- status: Option<String>,+ pub(super) status: Option<String>,#[serde(default)]- result: Option<serde_json::Value>,+ pub(super) result: Option<serde_json::Value>,#[serde(rename = "costUsd", default)]- cost_usd: f64,+ pub(super) cost_usd: f64,}pub(super) fn format_research_response(resp: ResearchResponse) -> Result<String, String> {@@ -58,7 +58,7 @@ pub(super) fn format_research_response(resp: ResearchResponse) -> Result<String,Ok(out)}-fn research_payload(resp: &ResearchResponse, display: &str) -> serde_json::Value {+pub(super) fn research_payload(resp: &ResearchResponse, display: &str) -> serde_json::Value {json!({"display": display,"status": resp.status,diff --git a/crates/openhuman-core/src/security/credentials/profiles/store_core.rs b/crates/openhuman-core/src/security/credentials/profiles/store_core.rsnew file mode 100644index 0000000000..d0624ee7b1--- /dev/null+++ b/crates/openhuman-core/src/security/credentials/profiles/store_core.rs@@ -0,0 +1,198 @@+//! Construction and the public CRUD surface of [`AuthProfilesStore`].++use anyhow::Result;+use chrono::Utc;+use std::path::Path;++#[cfg(test)]+use std::sync::atomic::{AtomicBool, AtomicUsize};+#[cfg(test)]+use std::sync::Arc;++use super::{+ is_lock_create_unwritable_fs, AuthProfile, AuthProfilesData, AuthProfilesStore,+ PROFILES_FILENAME,+};+use crate::security::keyring::SecretStore;++use super::LOCK_FILENAME;++impl AuthProfilesStore {+ pub fn new(state_dir: &Path, encrypt_secrets: bool) -> Self {+ let user_id = super::user_id_from_state_dir(state_dir);+ let policy = crate::security::keyring_consent::policy::check_secret_access();+ let use_keychain = policy+ == crate::security::keyring_consent::PolicyDecision::Proceed+ && crate::security::keyring::is_available();+ log::debug!(+ "[auth] AuthProfilesStore::new state_dir={} user_id={user_id} use_keychain={use_keychain} policy={policy:?}",+ state_dir.display()+ );+ match policy {+ crate::security::keyring_consent::PolicyDecision::Proceed => {+ if !use_keychain {+ // OS keychain unavailable despite Proceed policy (probe failed).+ log::info!(+ "[auth] OS keychain unavailable — using encrypted JSON for auth profiles user_id={user_id}"+ );+ }+ }+ crate::security::keyring_consent::PolicyDecision::ConsentRequired => {+ log::warn!(+ "[auth] keyring consent has not been given — secrets will NOT be persisted \+ to the OS keychain until the user grants consent. \+ Falling back to encrypted JSON for auth profiles user_id={user_id}"+ );+ }+ crate::security::keyring_consent::PolicyDecision::Declined => {+ log::warn!(+ "[auth] user explicitly declined OS keychain storage — \+ using encrypted JSON for auth profiles user_id={user_id}"+ );+ }+ }+ Self {+ path: state_dir.join(PROFILES_FILENAME),+ lock_path: state_dir.join(LOCK_FILENAME),+ secret_store: SecretStore::new(state_dir, encrypt_secrets),+ user_id,+ use_keychain,+ #[cfg(test)]+ force_transient_failures_write: Arc::new(AtomicUsize::new(0)),+ #[cfg(test)]+ force_transient_failures_rename: Arc::new(AtomicUsize::new(0)),+ #[cfg(test)]+ force_lock_unwritable: Arc::new(AtomicBool::new(false)),+ }+ }++ pub fn path(&self) -> &Path {+ &self.path+ }++ pub fn load(&self) -> Result<AuthProfilesData> {+ match self.acquire_lock() {+ Ok(_lock) => self.load_locked(),+ Err(e) if is_lock_create_unwritable_fs(&e) => {+ // RCA Sentry TAURI-RUST-4SZ: a full / read-only filesystem+ // can't create the exclusive lock file, but the store already+ // exists and writers publish via atomic tmp+rename, so a+ // lock-free read is still consistent. The read path is the+ // hot caller here (`app_state_snapshot` polls it every tick),+ // so failing it strands the UI AND floods Sentry once per+ // poll. Degrade to a lock-free read-only load instead — the+ // user keeps their session view, and because no error is+ // produced the noise stops at the source rather than being+ // suppressed downstream. Opportunistic migrations are skipped+ // (they couldn't persist on a full disk anyway).+ log::warn!(+ "[auth] auth-profile lock could not be created ({e}); \+ serving lock-free read-only load (likely disk full / read-only FS)"+ );+ self.load_unlocked_readonly()+ }+ Err(e) => Err(e),+ }+ }++ pub fn upsert_profile(&self, mut profile: AuthProfile, set_active: bool) -> Result<()> {+ let _lock = self.acquire_lock()?;+ let mut data = self.load_locked()?;++ profile.updated_at = Utc::now();+ if let Some(existing) = data.profiles.get(&profile.id) {+ profile.created_at = existing.created_at;+ }++ if set_active {+ data.active_profiles+ .insert(profile.provider.clone(), profile.id.clone());+ }++ data.profiles.insert(profile.id.clone(), profile);+ data.updated_at = Utc::now();++ self.save_locked(&data)+ }++ pub fn remove_profile(&self, profile_id: &str) -> Result<bool> {+ let _lock = self.acquire_lock()?;+ let mut data = self.load_locked()?;++ let removed = data.profiles.remove(profile_id).is_some();+ if !removed {+ return Ok(false);+ }++ data.active_profiles+ .retain(|_, active| active != profile_id);+ data.updated_at = Utc::now();+ self.save_locked(&data)?;++ // Clean up keychain entry for this profile (idempotent if keychain+ // is unavailable or no entry exists).+ if self.use_keychain {+ self.keychain_delete_secrets(profile_id);+ }++ Ok(true)+ }++ pub fn set_active_profile(&self, provider: &str, profile_id: &str) -> Result<()> {+ let _lock = self.acquire_lock()?;+ let mut data = self.load_locked()?;++ if !data.profiles.contains_key(profile_id) {+ anyhow::bail!("Auth profile not found: {profile_id}");+ }++ data.active_profiles+ .insert(provider.to_ascii_lowercase(), profile_id.to_string());+ data.updated_at = Utc::now();+ self.save_locked(&data)+ }++ pub fn clear_active_profile(&self, provider: &str) -> Result<()> {+ let _lock = self.acquire_lock()?;+ let mut data = self.load_locked()?;+ data.active_profiles.remove(&provider.to_ascii_lowercase());+ data.updated_at = Utc::now();+ self.save_locked(&data)+ }++ pub fn update_profile<F>(&self, profile_id: &str, mut updater: F) -> Result<AuthProfile>+ where+ F: FnMut(&mut AuthProfile) -> Result<()>,+ {+ let _lock = self.acquire_lock()?;+ let mut data = self.load_locked()?;++ let profile = data+ .profiles+ .get_mut(profile_id)+ .ok_or_else(|| anyhow::anyhow!("Auth profile not found: {profile_id}"))?;++ updater(profile)?;+ profile.updated_at = Utc::now();+ let updated_profile = profile.clone();+ data.updated_at = Utc::now();+ self.save_locked(&data)?;+ Ok(updated_profile)+ }++ pub(super) fn load_locked(&self) -> Result<AuthProfilesData> {+ self.load_resolved(true)+ }++ /// Lock-free read-only load used as the [`AuthProfilesStore::load`]+ /// fallback when the exclusive lock can't be created because the+ /// filesystem won't accept the lock file (disk full / read-only mount —+ /// Sentry TAURI-RUST-4SZ). Safe without the lock because writers publish+ /// the store atomically (tmp + `fs::rename`), so a bare read always sees+ /// a complete file. Skips the opportunistic migration / dropped-profile+ /// rewrite that `load_locked` performs — that write needs both the lock+ /// and a writable disk, and this path runs precisely when neither holds.+ pub(super) fn load_unlocked_readonly(&self) -> Result<AuthProfilesData> {+ self.load_resolved(false)+ }+}diff --git a/crates/openhuman-core/src/tools/schemas/web_search.rs b/crates/openhuman-core/src/tools/schemas/web_search.rsindex 9c7c5c23e0..021bf772a8 100644--- a/crates/openhuman-core/src/tools/schemas/web_search.rs+++ b/crates/openhuman-core/src/tools/schemas/web_search.rs@@ -307,3 +307,23 @@ fn handle_searxng_search(params: Map<String, Value>) -> ControllerFuture {fn optional_string_array(params: &Map<String, Value>, key: &str) -> Result<Vec<String>, String> {+ let Some(value) = params.get(key) else {+ return Ok(Vec::new());+ };+ if value.is_null() {+ return Ok(Vec::new());+ }+ let items = value+ .as_array()+ .ok_or_else(|| format!("`{key}` must be an array of strings"))?;+ items+ .iter()+ .filter_map(|item| match item.as_str() {+ Some(value) => {+ let trimmed = value.trim();+ (!trimmed.is_empty()).then(|| Ok(trimmed.to_string()))+ }+ None => Some(Err(format!("`{key}` must contain only strings"))),+ })+ .collect()+}