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

Bug report: Status 500 on content-length >197700

Open davepo opened this issue 4 years ago • 1 comments

Describe the bug I get a status 500 every time I try submitting data > 197700. That's not a specific number, but just my closest frame of reference based on sources used.

To Reproduce Attempt to bake with the following python function:

def query_cyberchef(source_data): headers = { 'Content-Type': 'application/json', } encodedBytes = base64.urlsafe_b64encode(source_data.encode("utf-8")) encodedStr = str(encodedBytes, "utf-8") data = {"input":encodedStr, "recipe":[{ "op": "From Base64","args": ["A-Za-z0-9-_=", 'true'] },{ "op": "Remove whitespace","args": ['true', 'true', 'true', 'true', 'true', 'false'] },{ "op": "CTPH","args": [] }]} response = requests.post('http://localhost:3000/bake', headers=headers, data=json.dumps(data)) return response

Expected behavior I would expect a Status code 200 with the has as the CTPH in the response. This works on smaller files and I don't see anything other than the content-length that is different.

Node version: 14.15.5 Same results with 10.23.3

Additional context Error: failed with status code 500 at ServerResponse.onResFinished (/home/redrobin/CyberChef-server/node_modules/pino-http/logger.js:51:33) at ServerResponse.emit (events.js:327:22) at ServerResponse.EventEmitter.emit (domain.js:467:12) at onFinish (_http_outgoing.js:766:10) at callback (internal/streams/writable.js:513:21) at afterWrite (internal/streams/writable.js:466:5) at afterWriteTick (internal/streams/writable.js:453:10) at processTicksAndRejections (internal/process/task_queues.js:79:21)

davepo avatar Feb 24 '21 22:02 davepo

To resolve this bug, you only need to change the app.use(express.json()) in the app.js file to ### app.use(express.json({ limit: '10mb' })); because the default request body size limit in Express is 100KB.

xxxbbbbs-dev avatar Dec 01 '23 07:12 xxxbbbbs-dev