openclaw/extensions/matrix
w-sss 19a3a30dc0
fix(matrix): correct DM classification without trusting remote user's is_direct flag
Problem: Matrix DM classification logic had security vulnerabilities:
1. Unreachable code branch when is_direct flag was absent
2. When is_direct: true, skipped 2-member check (shared rooms misclassified as DMs)
3. **CWE-285: Improper Authorization** - trusted remote user's is_direct flag

Security Issues:
- Remote attacker could set is_direct=true on their membership to force DM classification
- Remote attacker could set is_direct=false to bypass DM-only restrictions
- Both could lead to policy bypass (DM allowlist/pairing checks)

Fix:
- hasDirectMatrixMemberFlag() returns boolean | null for local user only
- isStrictDirectMembership() only trusts local user's is_direct (selfUserId)
- Removed directViaSender lookups entirely (do not trust remote-controlled data)
- Falls back to strict 2-member check when is_direct is false/null

Key Insights:
- In Matrix, m.room.member.content.is_direct is set by each member themselves
- Only trust signals the bot controls (local user's membership state)
- 2-member check remains as safe fallback that cannot be manipulated

Closes #56599
2026-03-30 18:55:09 -04:00
..
src fix(matrix): correct DM classification without trusting remote user's is_direct flag 2026-03-30 18:55:09 -04:00
CHANGELOG.md build: sync plugins for 2026.3.14 2026-03-14 06:05:39 +00:00
api.ts refactor: route plugin sdk facades through extension barrels 2026-03-27 20:47:36 +00:00
helper-api.ts Matrix: rebuild plugin migration branch 2026-03-19 01:58:29 -04:00
index.test.ts CLI: keep root help plugin descriptors non-activating (#57294) 2026-03-29 18:49:57 -04:00
index.ts CLI: keep root help plugin descriptors non-activating (#57294) 2026-03-29 18:49:57 -04:00
legacy-crypto-inspector.ts Matrix: rebuild plugin migration branch 2026-03-19 01:58:29 -04:00
openclaw.plugin.json
package-manifest.contract.test.ts refactor(plugins): decouple bundled plugin runtime loading 2026-03-29 09:10:38 +01:00
package.json chore: bump version to 2026.3.30 2026-03-30 09:28:29 +09:00
runtime-api.ts fix(matrix): avoid heavy jiti runtime barrels 2026-03-28 15:35:05 +05:30
setup-entry.ts refactor: dedupe channel entrypoints and test bridges 2026-03-16 23:52:23 -07:00
test-api.ts refactor: move bundled plugin policy into manifests 2026-03-27 16:40:27 +00:00
thread-bindings-runtime.ts Matrix: fix Jiti runtime API boundary 2026-03-19 11:40:44 -04:00