Summary
The agent_memory module uses a caller-supplied tenant value to construct filesystem paths for resolving secrets without first validating that value. If a caller can supply a path-traversal value and secrets for other tenants are mounted in the expected location, the path may escape the intended tenant directory and expose their credentials.
Affected context
The issue occurs in agent_memory when create_client(tenant=...) uses the tenant parameter to build a path for secret resolution. It becomes risky when the parameter can be influenced by an untrusted caller and the resulting path is used to access mounted secrets without confinement to the intended tenant directory.
Exploit preconditions
- Attack surface: The
agent_memoryclient-creation path that resolves tenant secrets from the filesystem - Required access: Ability to call
create_clientwith a tenant value that is not trusted or constrained - Trigger point: Construction and use of the secret path during client creation
- Why exploitation is possible: Path traversal sequences in the tenant value can cause the resolved path to escape the intended tenant directory
Why this happens
The application incorporates a caller-supplied tenant identifier into a filesystem path without ensuring that the resolved path remains within the designated tenant directory. This is a path traversal weakness mapped to CWE-22: Improper Limitation of a Pathname to a Restricted Directory. The underlying insecure pattern is treating an identifier as a safe path component without validation and path confinement.
Potential impact
- An attacker may access credentials belonging to another tenant.
- Exposed secrets could include OAuth client IDs and client secrets.
- Compromised credentials could be used to access services or data available to the affected tenant.
- Cross-tenant access could undermine confidentiality boundaries between tenants.
General mitigation guidance
Defensive patterns focus on treating tenant identifiers as untrusted input and constraining secret access to an explicit tenant boundary. Common approaches include:
- Accepting tenant identifiers only from a strict, documented allowlist or format.
- Resolving paths and verifying they remain beneath the intended base directory before accessing files.
- Using secure-by-default APIs that operate relative to a trusted directory rather than concatenating arbitrary path components.
- Limiting which secrets are mounted or accessible to each workload, and applying least-privilege filesystem permissions.
- Avoiding reliance on caller-supplied tenant values as the sole authorization boundary.
How teams detect issues like this
- Use static analysis to identify filesystem paths built from request, caller, or configuration values.
- Review code that joins tenant identifiers with secret directories, especially where validation or canonical-path checks are absent.
- Add tests and policy checks that verify resolved paths stay within approved tenant-specific directories.
- Monitor secret access for unexpected cross-tenant reads and enforce workload-level access boundaries.
- Automated code review tools may help flag tainted input flowing into filesystem operations.

