Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No way of handling the 'error' event in busboy #42

Open
chadhakunal opened this issue Jul 31, 2023 · 0 comments
Open

No way of handling the 'error' event in busboy #42

chadhakunal opened this issue Jul 31, 2023 · 0 comments

Comments

@chadhakunal
Copy link

chadhakunal commented Jul 31, 2023

Hi team,
There is no way of handling busboy's error event currently which is leading to global exceptions in express whenever a malformed body is passed

Eg:
If I pass \n instead of \r\n, an error is thrown

  • Valid Request:
curl -k '<path>' \
  -H 'Content-Type: multipart/form-data; boundary=----WebKitFormBoundary76aZhgZIDJfqZd9S' \
  -H 'Accept: application/json, text/plain, */*' \
  --data-raw $'------WebKitFormBoundary76aZhgZIDJfqZd9S\r\nContent-Disposition: form-data; name="file"; filename="img1.jpg"\r\nContent-Type: image/jpeg\r\n\r\n\r\n------WebKitFormBoundary76aZhgZIDJfqZd9S--\r\n' \
  --compressed
  • Invalid Request:
curl -k '<path>' \
  -H 'Content-Type: multipart/form-data; boundary=----WebKitFormBoundary76aZhgZIDJfqZd9S' \
  -H 'Accept: application/json, text/plain, */*' \
  --data-raw $'------WebKitFormBoundary76aZhgZIDJfqZd9S\nContent-Disposition: form-data; name="file"; filename="img1.jpg"\nContent-Type: image/jpeg\n\n\n------WebKitFormBoundary76aZhgZIDJfqZd9S--\n' \
  --compressed

Would it be possible to expose the error event in express busboy?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant