•  


GitHub - hanover-computing/got-ssrf: Protect untrusted requests from SSRF
Skip to content

hanover-computing/got-ssrf

Repository files navigation

Welcome to got-ssrf ??

GitHub Actions codecov Version Downloads

Protect Got requests from SSRF

Why does this matter?

SSRF is the evil sibling to CSRF that essentially allows RCE against your backends: https://portswigger.net/web-security/ssrf .

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

Install

npm i got-ssrf

Usage

Note that this package is ESM-only; see https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c 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 https://github.com/sindresorhus/got/blob/main/documentation/examples/advanced-creation.js 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
)

Security

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

Author

?? Jane Jeon git@janejeon.com

?? 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 git@janejeon.com .
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.

- "漢字路" 한글한자자동변환 서비스는 교육부 고전문헌국역지원사업의 지원으로 구축되었습니다.
- "漢字路" 한글한자자동변환 서비스는 전통문화연구회 "울산대학교한국어처리연구실 옥철영(IT융합전공)교수팀"에서 개발한 한글한자자동변환기를 바탕하여 지속적으로 공동 연구 개발하고 있는 서비스입니다.
- 현재 고유명사(인명, 지명등)을 비롯한 여러 변환오류가 있으며 이를 해결하고자 많은 연구 개발을 진행하고자 하고 있습니다. 이를 인지하시고 다른 곳에서 인용시 한자 변환 결과를 한번 더 검토하시고 사용해 주시기 바랍니다.
- 변환오류 및 건의,문의사항은 juntong@juntong.or.kr로 메일로 보내주시면 감사하겠습니다. .
Copyright ⓒ 2020 By '전통문화연구회(傳統文化硏究會)' All Rights reserved.
 한국   대만   중국   일본