Skip to content

Solution for long term memory for agent coding CLIs and to facilitate handoff between different agent vendors

Rust

Merge pull request #800 from gb: fix(sanitize): redact JSON secrets and Basic auth, strip control sequences

AkitaOnRails1a83c0de7a0b
diff --cc CHANGELOG.md
index 64138e58,3f6912aa..ad5672d6
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@@ -7,52 -7,22 +7,67 @@@ and this project adheres to [Semantic V
## [Unreleased]
+### Security
+- Bumped `rmcp` to 2.x (2.2.0), resolving three MCP transport advisories:
+ GHSA-9pj6-vhgr-3mwh (unauthenticated Streamable-HTTP session-table leak /
+ DoS), GHSA-33f5-2c5q-wgwj (missing OAuth resource-field validation), and
+ GHSA-9g45-5xwm-f3wc (custom headers leaking to cross-origin redirect
+ targets). Behavior-preserving: the only source change is the
+ `rmcp::model::Content` → `ContentBlock` rename (imported under the prior
+ name), the feature set is unchanged, and the 23-tool MCP surface is
+ unaffected. (#794)
+
+### Docs
+- `docs/llm-providers.md` now covers the `opencode` LLM provider, which has
+ shipped since 1.x but was missing from the recommended-defaults table:
+ `OPENCODE_API_KEY` as the only credential, Go as the default endpoint, Zen
+ via `AI_MEMORY_LLM_BASE_URL`, the built-in default model, per-catalogue
+ model ids, and which model goes through the Responses endpoint (#763).
+
### Fixed
+- The Windows Docker wrapper (`bin/ai-memory.ps1`) now forwards the same
+ provider credentials and host-config env vars as the POSIX wrapper into the
+ helper container. A host-exported `GEMINI_API_KEY` / `GOOGLE_API_KEY`,
+ Copilot token, `OPENCODE_API_KEY`, `CLAUDE_CONFIG_DIR`, or
+ `AI_MEMORY_WORKSTREAM_ID` previously never reached `Config::load`, so
+ `llm-test`, Copilot auth, OpenCode, and a relocated Claude config all
+ reported "not configured" on native Windows Docker Desktop even though the
+ same export worked through `bin/ai-memory`. The POSIX wrapper also now
+ forwards `OPENCODE_API_KEY`. (#803)
+- `Config::load` now treats Windows `%USERPROFILE%` (then `dirs::home_dir`) as
+ the operator home when `AI_MEMORY_HOME` and `$HOME` are unset. Native
+ Windows often has no `HOME`, so the #103 catch-all guard — skip a stored
+ `repo_path` equal to the user profile so it cannot prefix-match every
+ project beneath it — was inert there and a home-directory project could
+ swallow unrelated cwds. (#804)
+- Automatic handoff selection and cwd-prefix project matching now treat
+ Windows drive-letter and UNC paths as case-insensitive. A Linux server
+ (the Docker Desktop helper) comparing host cwds from Explorer, Git, and
+ PowerShell previously required a byte-exact match, so `C:\Users\…\repo`
+ vs `c:\users\…\repo` missed the pending auto-handoff and could mint a
+ fragment project. Unix paths stay case-sensitive. (#806)
+- Fixed `Ctrl+C` at the native-session chooser leaving the launcher alive and
+ renewing its workstream lease. Cancelling now releases the acquired run and
+ exits without waiting for Enter or linking a native session (#795).
+- The privacy strip now redacts Windows credential paths (`C:\Users\…\.ssh`,
+ `.aws`, `.kube`, `.gnupg`, `.config\gcloud`). The previous patterns required
+ a POSIX `/` separator, so a captured tool result that echoed a native
+ Windows path stored the profile directory and key file name verbatim. (#805)
+ - The privacy strip now redacts secrets written in JSON. The quote before a
+ value put it outside the value character class, so `{"db_password":"..."}`
+ was stored verbatim while the identical YAML form was redacted, and JSON is
+ the shape most captured tool payloads arrive in. The same rule now also
+ accepts an auth scheme word before the value, so
+ `Authorization: Basic <base64>` (which carries `user:password`) is redacted
+ like the `Bearer` form already was, and covers two unprefixed names the
- generic env rule missed: Azure `AccountKey=` and npm `_authToken=`.
++ generic env rule missed: Azure `AccountKey=` and npm `_authToken=`. (#800)
+ - Terminal escape sequences, NUL and bidi override characters are stripped
+ from captured text instead of being stored. Page bodies and observations are
+ replayed to a terminal by `ai-memory read-page` and `ai-memory search`, where
+ an escape rewrites the screen or the window title and a bidi override
+ reverses what the reader sees; a NUL additionally made the markdown file
+ binary, costing it `grep` and git diffs. Tabs, newlines and carriage returns
- are kept.
++ are kept. (#800)
## [2.3.2] - 2026-09-20
diff --cc crates/ai-memory-core/src/sanitize.rs
index b12688fa,6ea3540c..a691c2db
--- a/crates/ai-memory-core/src/sanitize.rs
+++ b/crates/ai-memory-core/src/sanitize.rs
@@@ -158,34 -176,18 +176,34 @@@ const BUILTIN_PATTERNS: &[(&str, &str)
// Generic env-var catch-all: any *_KEY / *_TOKEN / *_SECRET /
// *_PASSWORD / *_CREDENTIAL[S] / *_PRIVATE_KEY assignment.
(
- r#"(?i)\b[A-Z][A-Z0-9_]*_(KEY|TOKEN|SECRET|PASSWORD|PASSWD|CREDENTIAL|CREDENTIALS|PRIVATE_KEY)\s*[=:]\s*\S+"#,
+ r#"(?i)\b[A-Z][A-Z0-9_]*_(KEY|TOKEN|SECRET|PASSWORD|PASSWD|CREDENTIAL|CREDENTIALS|PRIVATE_KEY)"?\s*[=:]\s*\S+"#,
"env_secret",
),
- // Filesystem paths that commonly contain credentials.
- (r"(?:/[^/\s]+)*/\.ssh(?:/[^\s]+)?", "credential_path"),
- (r"(?:/[^/\s]+)*/\.aws(?:/[^\s]+)?", "credential_path"),
- (r"(?:/[^/\s]+)*/\.kube(?:/[^\s]+)?", "credential_path"),
+ // Filesystem paths that commonly contain credentials. The separator
+ // class is `[\\/]` and an optional `X:` drive prefix is accepted so a
+ // Windows agent echoing `C:\Users\alice\.ssh\id_rsa` is redacted the
+ // same way as `/home/user/.ssh/id_rsa`. Case-insensitive because NTFS
+ // is; Unix paths stay covered because they still start with `/`.
(
- r"(?:/[^/\s]+)*/\.config/gcloud(?:/[^\s]+)?",
+ r"(?i)(?:[A-Za-z]:)?(?:[\\/][^\\/\s]+)*[\\/]\.ssh(?:[\\/][^\s]+)?",
+ "credential_path",
+ ),
+ (
+ r"(?i)(?:[A-Za-z]:)?(?:[\\/][^\\/\s]+)*[\\/]\.aws(?:[\\/][^\s]+)?",
+ "credential_path",
+ ),
+ (
+ r"(?i)(?:[A-Za-z]:)?(?:[\\/][^\\/\s]+)*[\\/]\.kube(?:[\\/][^\s]+)?",
+ "credential_path",
+ ),
+ (
+ r"(?i)(?:[A-Za-z]:)?(?:[\\/][^\\/\s]+)*[\\/]\.config[\\/]gcloud(?:[\\/][^\s]+)?",
+ "credential_path",
+ ),
+ (
+ r"(?i)(?:[A-Za-z]:)?(?:[\\/][^\\/\s]+)*[\\/]\.gnupg(?:[\\/][^\s]+)?",
"credential_path",
),
- (r"(?:/[^/\s]+)*/\.gnupg(?:/[^\s]+)?", "credential_path"),
];
/// Stateful sanitizer. Cheap to clone — wraps an `Arc` of compiled