Fix structured IPC envelope leakage

Normalize EJClaw structured send_message envelopes, preserve attachments, unwrap stored room payloads, and add regression tests.
This commit is contained in:
Eyejoker
2026-04-28 01:35:26 +09:00
committed by GitHub
parent 20e1a1e5e1
commit 8bb77ffaa3
11 changed files with 291 additions and 14 deletions

View File

@@ -556,6 +556,7 @@ describe('IPC message authorization', () => {
'review text',
'reviewer',
'run-reviewer-ipc',
undefined,
);
expect(result).toEqual(
expect.objectContaining({
@@ -565,6 +566,39 @@ describe('IPC message authorization', () => {
);
});
it('forwards structured attachments through authorized IPC messages', async () => {
const sendMessage = vi.fn(async () => {});
const attachments = [
{
path: '/tmp/ejclaw-room-mobile-list-390.png',
name: 'room.png',
mime: 'image/png',
},
];
const result = await forwardAuthorizedIpcMessage(
{
type: 'message',
chatJid: 'other@g.us',
text: '스크린샷입니다.',
attachments,
},
'other-group',
false,
groups,
sendMessage,
);
expect(sendMessage).toHaveBeenCalledWith(
'other@g.us',
'스크린샷입니다.',
undefined,
undefined,
attachments,
);
expect(result.outcome).toBe('sent');
});
it('injects authorized inbound messages for the source group without routing them as outbound sends', async () => {
const sendMessage = vi.fn(async () => {});
const injectInboundMessage = vi.fn(async () => {});