Skip to content

Commit 6fdb136

Browse files
docs: document secure DM mode preset (openclaw#7872)
* docs: document secure DM mode preset * fix: resolve merge conflict in resizable-divider
1 parent 44d1aa3 commit 6fdb136

File tree

5 files changed

+58
-2
lines changed

5 files changed

+58
-2
lines changed

docs/cli/security.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,5 +22,5 @@ openclaw security audit --deep
2222
openclaw security audit --fix
2323
```
2424

25-
The audit warns when multiple DM senders share the main session and recommends `session.dmScope="per-channel-peer"` (or `per-account-channel-peer` for multi-account channels) for shared inboxes.
25+
The audit warns when multiple DM senders share the main session and recommends **secure DM mode**: `session.dmScope="per-channel-peer"` (or `per-account-channel-peer` for multi-account channels) for shared inboxes.
2626
It also warns when small models (`<=300B`) are used without sandboxing and with web/browser tools enabled.

docs/concepts/session.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,26 @@ Use `session.dmScope` to control how **direct messages** are grouped:
1717
- `per-account-channel-peer`: isolate by account + channel + sender (recommended for multi-account inboxes).
1818
Use `session.identityLinks` to map provider-prefixed peer ids to a canonical identity so the same person shares a DM session across channels when using `per-peer`, `per-channel-peer`, or `per-account-channel-peer`.
1919

20+
### Secure DM mode (recommended)
21+
22+
If your agent can receive DMs from **multiple people** (pairing approvals for more than one sender, a DM allowlist with multiple entries, or `dmPolicy: "open"`), enable **secure DM mode** to avoid cross-user context leakage:
23+
24+
```json5
25+
// ~/.openclaw/openclaw.json
26+
{
27+
session: {
28+
// Secure DM mode: isolate DM context per channel + sender.
29+
dmScope: "per-channel-peer",
30+
},
31+
}
32+
```
33+
34+
Notes:
35+
36+
- Default is `dmScope: "main"` for continuity (all DMs share the main session).
37+
- For multi-account inboxes on the same channel, prefer `per-account-channel-peer`.
38+
- If the same person contacts you on multiple channels, use `session.identityLinks` to collapse their DM sessions into one canonical identity.
39+
2040
## Gateway is the source of truth
2141

2242
All session state is **owned by the gateway** (the “master” OpenClaw). UI clients (macOS app, WebChat, etc.) must query the gateway for session lists and token counts instead of reading local files.

docs/gateway/configuration-examples.md

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -446,6 +446,32 @@ Save to `~/.openclaw/openclaw.json` and you can DM the bot from that number.
446446
}
447447
```
448448

449+
### Secure DM mode (shared inbox / multi-user DMs)
450+
451+
If more than one person can DM your bot (multiple entries in `allowFrom`, pairing approvals for multiple people, or `dmPolicy: "open"`), enable **secure DM mode** so DMs from different senders don’t share one context by default:
452+
453+
```json5
454+
{
455+
// Secure DM mode (recommended for multi-user or sensitive DM agents)
456+
session: { dmScope: "per-channel-peer" },
457+
458+
channels: {
459+
// Example: WhatsApp multi-user inbox
460+
whatsapp: {
461+
dmPolicy: "allowlist",
462+
allowFrom: ["+15555550123", "+15555550124"],
463+
},
464+
465+
// Example: Discord multi-user inbox
466+
discord: {
467+
enabled: true,
468+
token: "YOUR_DISCORD_BOT_TOKEN",
469+
dm: { enabled: true, allowFrom: ["alice", "bob"] },
470+
},
471+
},
472+
}
473+
```
474+
449475
### OAuth with API key failover
450476

451477
```json5

docs/gateway/configuration.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2766,6 +2766,7 @@ Fields:
27662766
- `per-peer`: isolate DMs by sender id across channels.
27672767
- `per-channel-peer`: isolate DMs per channel + sender (recommended for multi-user inboxes).
27682768
- `per-account-channel-peer`: isolate DMs per account + channel + sender (recommended for multi-account inboxes).
2769+
- Secure DM mode (recommended): set `session.dmScope: "per-channel-peer"` when multiple people can DM the bot (shared inboxes, multi-person allowlists, or `dmPolicy: "open"`).
27692770
- `identityLinks`: map canonical ids to provider-prefixed peers so the same person shares a DM session across channels when using `per-peer`, `per-channel-peer`, or `per-account-channel-peer`.
27702771
- Example: `alice: ["telegram:123456789", "discord:987654321012345678"]`.
27712772
- `reset`: primary reset policy. Defaults to daily resets at 4:00 AM local time on the gateway host.

docs/gateway/security/index.md

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,16 @@ By default, OpenClaw routes **all DMs into the main session** so your assistant
205205
}
206206
```
207207

208-
This prevents cross-user context leakage while keeping group chats isolated. If you run multiple accounts on the same channel, use `per-account-channel-peer` instead. If the same person contacts you on multiple channels, use `session.identityLinks` to collapse those DM sessions into one canonical identity. See [Session Management](/concepts/session) and [Configuration](/gateway/configuration).
208+
This prevents cross-user context leakage while keeping group chats isolated.
209+
210+
### Secure DM mode (recommended)
211+
212+
Treat the snippet above as **secure DM mode**:
213+
214+
- Default: `session.dmScope: "main"` (all DMs share one session for continuity).
215+
- Secure DM mode: `session.dmScope: "per-channel-peer"` (each channel+sender pair gets an isolated DM context).
216+
217+
If you run multiple accounts on the same channel, use `per-account-channel-peer` instead. If the same person contacts you on multiple channels, use `session.identityLinks` to collapse those DM sessions into one canonical identity. See [Session Management](/concepts/session) and [Configuration](/gateway/configuration).
209218

210219
## Allowlists (DM + groups) — terminology
211220

0 commit comments

Comments
 (0)