@unicitylabs/openclaw-unicity 0.2.5 → 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 -3
package/package.json
CHANGED
package/src/channel.ts
CHANGED
|
@@ -213,10 +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?.
|
|
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:");
|
|
217
222
|
|
|
218
223
|
const inboundCtx = runtime.channel.reply.finalizeInboundContext({
|
|
219
|
-
Body:
|
|
224
|
+
Body: `${metadataHeader}\n${sanitizedContent}`,
|
|
220
225
|
From: peerId,
|
|
221
226
|
To: sphere.identity?.nametag ?? sphere.identity?.chainPubkey ?? "agent",
|
|
222
227
|
SessionKey: `unicity:dm:${peerId}`,
|
|
@@ -226,7 +231,7 @@ export const unicityChannelPlugin = {
|
|
|
226
231
|
OriginatingChannel: "unicity",
|
|
227
232
|
OriginatingTo: peerId,
|
|
228
233
|
AccountId: ctx.account.accountId,
|
|
229
|
-
SenderName:
|
|
234
|
+
SenderName: senderName,
|
|
230
235
|
SenderId: msg.senderPubkey,
|
|
231
236
|
IsOwner: isOwner,
|
|
232
237
|
CommandAuthorized: isOwner,
|