CyberChef-server icon indicating copy to clipboard operation
CyberChef-server copied to clipboard

Bug report: ArrayBuffer return data always empty

Open amohar opened this issue 1 year ago • 0 comments

Describe the bug No data is ever returned when executing recipes where operations return ArrayBuffer type. The affected examples are recipes containing the following modules (non-exhaustive list - this is what I've checked):

  • Encode text
  • Generate QR Code
  • Generate Image

To Reproduce To reproduce this issue, execute any of the following:

  • curl -X POST -H "Content-Type:application/json" -d '{"input":"Test", "recipe":[{"op":"Encode text","args":["UTF-32BE (12001)"]}]}' localhost:3000/bake
  • curl -X POST -H "Content-Type:application/json" -d '{"input":"Test", "recipe":[{"op":"Generate Image","args":["Greyscale",8,64]}]}' localhost:3000/bake
  • curl -X POST -H "Content-Type:application/json" -d '{"input":"Test", "recipe":[{"op":"Generate QR Code","args":["PNG",5,4,"Medium"]}]}' localhost:3000/bake

From these tests, it could be concluded that any op that, by default, returns ArrayBuffer type could be affected.

Expected behavior The expected behavior is receiving a result JSON, which returns the correct result.

The observed behavior is, in all these cases, receiving an empty result. The result looks like this:

{"value":{},"type":"ArrayBuffer"}

Notes

This happens even if the output type is explicitly stated, like so: curl -X POST -H "Content-Type:application/json" -d '{"input":"Test", "recipe":[{"op":"Encode text","args":["UTF-32BE (12001)"]}],"outputType":"ArrayBuffer"}' localhost:3000/bake

However, the correct result is returned if another output type is selected, like so: curl -X POST -H "Content-Type:application/json" -d '{"input":"Test", "recipe":[{"op":"Encode text","args":["UTF-32BE (12001)"]}],"outputType":"string"}' localhost:3000/bake

In this case, this is the returned result: {"value":"\u0000\u0000\u0000T\u0000\u0000\u0000e\u0000\u0000\u0000s\u0000\u0000\u0000t","type":"string"}

Node version: v18.12.1

amohar avatar Jan 21 '24 20:01 amohar