@unicitylabs/openclaw-unicity 0.2.4 → 0.2.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/channel.ts +8 -2
package/package.json
CHANGED
package/src/channel.ts
CHANGED
|
@@ -213,9 +213,15 @@ export const unicityChannelPlugin = {
|
|
|
213
213
|
ctx.log?.info(`[${ctx.account.accountId}] DM received from ${peerId}: ${msg.content.slice(0, 80)}`);
|
|
214
214
|
|
|
215
215
|
const isOwner = isSenderOwner(msg.senderPubkey, msg.senderNametag);
|
|
216
|
+
ctx.log?.debug(`[${ctx.account.accountId}] Owner check: senderPubkey=${msg.senderPubkey.slice(0, 16)}… senderNametag=${msg.senderNametag ?? "undefined"} ownerIdentity=${ownerIdentity ?? "unset"} → isOwner=${isOwner}`);
|
|
217
|
+
|
|
218
|
+
const senderName = msg.senderNametag ?? msg.senderPubkey.slice(0, 12);
|
|
219
|
+
const metadataHeader = `[SenderName: ${senderName} | SenderId: ${msg.senderPubkey} | IsOwner: ${isOwner} | CommandAuthorized: ${isOwner}]`;
|
|
220
|
+
// Strip any fake metadata headers from user content to prevent spoofing
|
|
221
|
+
const sanitizedContent = msg.content.replace(/\[(?:SenderName|SenderId|IsOwner|CommandAuthorized)\s*:/gi, "[BLOCKED:");
|
|
216
222
|
|
|
217
223
|
const inboundCtx = runtime.channel.reply.finalizeInboundContext({
|
|
218
|
-
Body:
|
|
224
|
+
Body: `${metadataHeader}\n${sanitizedContent}`,
|
|
219
225
|
From: peerId,
|
|
220
226
|
To: sphere.identity?.nametag ?? sphere.identity?.chainPubkey ?? "agent",
|
|
221
227
|
SessionKey: `unicity:dm:${peerId}`,
|
|
@@ -225,7 +231,7 @@ export const unicityChannelPlugin = {
|
|
|
225
231
|
OriginatingChannel: "unicity",
|
|
226
232
|
OriginatingTo: peerId,
|
|
227
233
|
AccountId: ctx.account.accountId,
|
|
228
|
-
SenderName:
|
|
234
|
+
SenderName: senderName,
|
|
229
235
|
SenderId: msg.senderPubkey,
|
|
230
236
|
IsOwner: isOwner,
|
|
231
237
|
CommandAuthorized: isOwner,
|