Superagent: Limit maximum response size

Created on 7 Aug 2017  路  9Comments  路  Source: visionmedia/superagent

Superagent buffers and uncompresses responses in memory. Malicious server could send extremely large response causing superagent to use excessive amounts of memory.

I suggest adding a way to set a maximum response size, and have a default limit set.

Most helpful comment

Heads up, this is blocking my company's CI builds - would appreciate a speedy fix if it's possible.

Edit: see https://nodesecurity.io/advisories/479

All 9 comments

Heads up, this is blocking my company's CI builds - would appreciate a speedy fix if it's possible.

Edit: see https://nodesecurity.io/advisories/479

Could you help by making a pull request?

I'm in to help, breaking our builds as well (for the time being @letsgolesco you can use a .nsprc file to ignore this advisory). I'll report back with any progress.

To ignore for now, add the following to an .nsprc file:

{
  "exceptions": ["https://nodesecurity.io/advisories/479"]
}

Fixed in v3.7.0

This is still showing on https://nodesecurity.io/advisories/479 as not fixed, so I've dropped them an email to update the advisory :-)

It's updated now 馃帀

Can someone point me to where it is explained how to set a maximum response size? I would like to download more than 200MB, but I can't find how to specify a bigger number.

In case someone stumbles upon this issue, the maximum response size can be changed via the method maxResponseSize.

superagent.get(url)
    .maxResponseSize(4000000000)
Was this page helpful?
0 / 5 - 0 ratings