Skip to main content

resolve_secret

Function resolve_secret 

Source
pub fn resolve_secret(secret_ref: &SecretRef) -> Result<String, ResolverError>
Expand description

Resolve a SecretRef to the plaintext credential string. Each backend has a distinct path:

  • Env: read env_var from the srv process’s own environment. Caller is expected to have set this in their shell or a .env-style loader before launching AgentMux.
  • PlaintextDev: return the literal stored string. Debug builds only — guarded behind cfg(debug_assertions). In release builds, the same call returns [ResolverError::PlaintextDevDisabledInRelease] so a forgotten dev-secret never leaks into a packaged binary. Reagent P1 on PR #751 caught the missing guard. Phase 3’s encrypted vault is the production path.
  • SecretsManager: read from AWS Secrets Manager with the host’s own AWS login, the whole secret or the field sm_json_path names. A failed read is ResolverError::SecretsManagerRead.

The value is the credential to use: an account connected with OAuth stores a JSON token blob, of which only its access_token is the credential (oauth_tokens::bearer_value). A plain key is unchanged.