ssrf-agent

1.0.5 • Public • Published

ssrf-agent

prevent SSRF in http(s) request

Install

npm install ssrf-agent --save

Usage

const ssrfAgent = require('ssrf-agent');
const request = require('request');
// with request module
const url = 'http://www.welefen.com'
request(url, {
  agent: ssrfAgent(url)
}, (err, response, body) => {
  
})
const ssrfAgent = require('ssrf-agent');
const fetch = require('node-fetch');
// with node-fetch module
const url = 'http://www.welefen.com'
fetch(url, {
  agent: ssrfAgent(url)
}).then(res => res.text).then(data => {

}).catch(err => {

})

Options

const getAgent = require('ssrf-agent');
const agent = getAgent(ipChecker, agent);
  • ipChecker(ip) {Function} check ip is allowed, default is require('ip').isPrivate
  • agent {String | Object} default is http, support http https or agent instance

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 1.0.5
    16
    • latest

Version History

  • Version
    Downloads (Last 7 Days)
    • Published
  • 1.0.5
    16
  • 1.0.3
    0
  • 1.0.2
    1
  • 1.0.1
    0
  • 1.0.0
    0

Package Sidebar

Install

npm i ssrf-agent

Weekly Downloads

17

Version

1.0.5

License

MIT

Unpacked Size

5.99 kB

Total Files

6

Last publish

Collaborators

  • welefen