fix(memory): percent-encode colons in peer_id so Matrix peers can use Memory (#6100)#6102
Merged
Conversation
… Memory (#6100) #5119/#5120 made the peer:{pid}:{key} framing injective by rejecting any peer_id containing ':', which locked Matrix users (@user:matrix.org) out of memory_store/recall/list. Instead of rejecting, escape_peer_id percent-encodes the colon (%->%25, :->%3A) before it enters the key, keeping the framing injective: peer T1 (prefix peer:T1:) can no longer strip the escaped key peer:T1%3AU2:... of peer T1:U2, so cross-peer isolation holds. Colon-free peer_ids encode to themselves (existing rows byte-identical, no migration); empty peer_id and peer:-prefixed keys are still rejected. Updates unit + security integration tests to assert accept-escape-isolate.
Deploying with
|
| Status | Name | Latest Commit | Updated (UTC) |
|---|---|---|---|
| ❌ Deployment failed View logs |
librefang-deploy | 5d8e573 | Jun 14 2026, 03:55 PM |
The previous commit replaced the channels entry header with the new memory entry header, leaving five continuation lines orphaned under the memory bullet. This restores the channels entry as a separate bullet so both fixes are correctly attributed.
houko
commented
Jun 14, 2026
houko
left a comment
Contributor
Author
There was a problem hiding this comment.
The CHANGELOG diff replaced the channels: the dashboard configure form is no longer empty… entry header with the new memory entry header, leaving its five continuation lines orphaned under the memory bullet (the The Add-a-channel form… block through First-party adapter --describe is dependency-free… on lines 789–793 of the PR-branch file). Pushed a one-line fix that restores the channels entry as a separate bullet so both fixes are correctly attributed.
Generated by Claude Code
houko
enabled auto-merge (squash)
June 14, 2026 14:02
added 2 commits
June 15, 2026 00:37
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
#5119 / #5120 made the per-peer key framing
peer:{pid}:{key}injective by rejecting anypeer_idcontaining:. Matrix user IDs are natively@user:matrix.org, so every Matrix user was locked out ofmemory_store/memory_recall/memory_listwith anInvalidInputerror.Change
Instead of rejecting, percent-encode the colon before it enters the key (
escape_peer_id:%→%25,:→%3A). The framing stays injective: peerT1(prefixpeer:T1:) can no longer strip the escaped keypeer:T1%3AU2:…of peerT1:U2, so the cross-peer isolation boundary from #5119 is preserved — now enforced by escaping rather than rejection. Colon-free peer_ids encode to themselves, so existing rows are byte-identical and need no migration. Emptypeer_idandpeer:-prefixed keys are still rejected.Files:
manifest_helpers.rs: newescape_peer_id;peer_scoped_keyescapes instead of rejecting colons.memory_access.rs:reject_bad_peer_iddrops the colon check;memory_listbuilds the recovery prefix from the escaped pid.agent_execution.rs/messaging.rs: stale "rejects colon-bearing" comments updated.Tests
test_peer_scoped_key(unit): colon peer_ids now assert escaped output, plus Matrix and%-escaping cases and aT1/T1:U2disjoint-prefix assertion.kernel_handle_contract_memory.rs): colon peer_ids are accepted and round-trip; a colon-prefix peer cannot read another peer's rows; legacy raw-colon plants stay invisible to the escaped peer.Test plan
cargo test -p librefang-kernel --lib test_peer_scoped_keycargo test -p librefang-kernel --test kernel_handle_contract_memorycargo clippy -p librefang-kernel -- -D warningsCloses #6100