fix(protocol): bound rich message decoding
Reject malformed nested payloads, cap compressed card expansion, and enforce per-message decode budgets. Preserve unknown-wire metadata in diagnostics so unsupported QQ elements remain observable without exhausting memory.
This commit is contained in:
4 files changed
+1016
-129
No files matched your search
@@ -35,9 +35,9 @@ describe('decodeRichBody / 闪传 flash_file (#199/#200)', () => {
|
||||
expect(out).toEqual([{ type: 'flash_file', filesetId: 'fs-deep', fileName: 'a.zip', sceneType: 0 }]);
|
||||
});
|
||||
|
||||
it('defaults missing fields (still emits a non-empty element)', () => {
|
||||
it('drops a malformed card that has no fileset identity', () => {
|
||||
const out = decodeRichBody(flashBody({ busId: 'FlashTransfer', templateId: 'flash' }), true);
|
||||
expect(out).toEqual([{ type: 'flash_file', filesetId: '', fileName: '', sceneType: 0 }]);
|
||||
expect(out).toEqual([]);
|
||||
});
|
||||
|
||||
it('ignores a non-FlashTransfer markdown card (no flash_file element)', () => {
|
||||
|
||||
Reference in new issue
Block a user