TypeScript icon, indicating that this package has built-in type declarations

3.0.0 • Public • Published

Welcome to got-ssrf 👋

GitHub Actions codecov Version Downloads

Protect Got requests from SSRF

🏠 Homepage

Why does this matter?

SSRF is the evil sibling to CSRF that essentially allows RCE against your backends:

This module automatically rejects all such requests so you can safely use got without even thinking about it.


npm i got-ssrf


Note that this package is ESM-only; see for what to do if you're using CJS (i.e. require()).

import { gotSsrf } from 'got-ssrf'

await gotSsrf(url) // automatically filters requests for safety

If you have any other plugins you want to "mix" got-ssrf with, see for how to do so. Example:

import got from 'got'
import { gotSsrf } from 'got-ssrf'
import { gotInstance } from 'some-other-got-plugin'

const merged = got.extend(gotSsrf, gotInstance)


This library is tested against a whole host of weird edge cases (a URL is not as straightforward as it seems). To see what behaviours are expected, please see the test suite.

As this library doesn't parse the URLs itself (but rather relies on got, which relies on the node URL module), a good rule of thumb is that whatever you'd expect from the node URL module, you can expect of this library as well.

If you want to disallow "weird" URLs (and trust me, there are many), as people may try to 'smuggle' hostnames in them (and cause SSRF that may not be caught by the URL module), you'll need to do an input validation of the URL (and reject the "weird" ones) before passing it into got/got-ssrf.

Run tests

npm test


👤 Jane Jeon

🤝 Contributing

Contributions, issues and feature requests are welcome!
Feel free to check issues page.

Show your support

Give a ⭐️ if this project helped you!

📝 License

Copyright © 2023 Jane Jeon
This project is LGPL-3.0 licensed.

TL;DR: you are free to import and use this library "as-is" in your code, without needing to make your code source-available or to license it under the same license as this library; however, if you do change this library and you distribute it (directly or as part of your code consuming this library), please do contribute back any improvements for this library and this library alone.

Package Sidebar


npm i got-ssrf

Weekly Downloads






Unpacked Size

16.1 kB

Total Files


Last publish


  • janejeon