{"id":36964679,"url":"https://github.com/swapniluneva/ssrf-agent-guard","last_synced_at":"2026-01-13T19:42:36.676Z","repository":{"id":326184022,"uuid":"1103193519","full_name":"swapniluneva/ssrf-agent-guard","owner":"swapniluneva","description":"ssrf-agent-guard is a Node.js module for protecting your HTTP/HTTPS requests against SSRF (Server-Side Request Forgery) attacks. It wraps http.Agent and https.Agent to enforce pre and post DNS host/IP checks, block access to cloud metadata endpoints, private IPs, and unsafe domains.","archived":false,"fork":false,"pushed_at":"2025-12-14T08:52:37.000Z","size":77,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-12-16T12:39:02.708Z","etag":null,"topics":["axios","cybersecurity","http","node-fetch","nodejs","request","ssrf","ssrf-agent-guard","ssrf-prevention"],"latest_commit_sha":null,"homepage":"https://github.com/swapniluneva/ssrf-agent-guard","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/swapniluneva.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-11-24T14:51:40.000Z","updated_at":"2025-12-14T08:47:29.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/swapniluneva/ssrf-agent-guard","commit_stats":null,"previous_names":["swapniluneva/ssrf-agent-guard"],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/swapniluneva/ssrf-agent-guard","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/swapniluneva%2Fssrf-agent-guard","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/swapniluneva%2Fssrf-agent-guard/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/swapniluneva%2Fssrf-agent-guard/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/swapniluneva%2Fssrf-agent-guard/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/swapniluneva","download_url":"https://codeload.github.com/swapniluneva/ssrf-agent-guard/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/swapniluneva%2Fssrf-agent-guard/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28397826,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-13T14:36:09.778Z","status":"ssl_error","status_checked_at":"2026-01-13T14:35:19.697Z","response_time":56,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["axios","cybersecurity","http","node-fetch","nodejs","request","ssrf","ssrf-agent-guard","ssrf-prevention"],"created_at":"2026-01-13T19:42:35.931Z","updated_at":"2026-01-13T19:42:36.662Z","avatar_url":"https://github.com/swapniluneva.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ssrf-agent-guard\n\n[![npm version](https://img.shields.io/npm/v/ssrf-agent-guard.svg)](https://www.npmjs.com/package/ssrf-agent-guard)                                                        \n[![npm downloads](https://img.shields.io/npm/dm/ssrf-agent-guard.svg)](https://www.npmjs.com/package/ssrf-agent-guard)                                                     \n[![codecov](https://codecov.io/gh/swapniluneva/ssrf-agent-guard/branch/main/graph/badge.svg)](https://codecov.io/gh/swapniluneva/ssrf-agent-guard)\n\n#### `ssrf-agent-guard` is a Node.js module for protecting your HTTP/HTTPS requests against SSRF (Server-Side Request Forgery) attacks. It wraps http.Agent and https.Agent to enforce pre and post DNS host/IP checks, block access to cloud metadata endpoints, private IPs, and unsafe domains.\n---\n\n## Features\n\n* Block requests to internal/private IPs\n* Detect and block cloud provider metadata endpoints (AWS, GCP, Azure, Oracle, DigitalOcean, Kubernetes)\n* DNS rebinding detection\n* Policy-based domain filtering (allowlists, denylists, TLD blocking)\n* Multiple operation modes (block, report, allow)\n* Custom logging support\n* Fully written in TypeScript with type definitions\n\n## Documentation\n\nFor complete API documentation, see [API.md](./API.md).\n\nFor framework-specific examples, see the [examples](./examples) directory:\n- [Express.js](./examples/express)\n- [Fastify](./examples/fastify)\n- [NestJS](./examples/nestjs)\n\n---\n\n## Installation\n\n```bash\nnpm install ssrf-agent-guard\n# or using yarn\nyarn add ssrf-agent-guard\n```\n\n---\n\n## Usage\n\n### axios\n\n```ts\nconst ssrfAgentGuard = require('ssrf-agent-guard');\nconst url = 'https://127.0.0.1'\naxios.get(\n  url, {\n    httpAgent: ssrfAgentGuard(url), \n    httpsAgent: ssrfAgentGuard(url)\n    })\n      .then((response) =\u003e {\n        console.log(`Success`);\n      })\n      .catch((error) =\u003e {\n        console.log(`${error.toString().split('\\n')[0]}`);\n      })\n      .then(() =\u003e {\n\n      });\n```\n\n### node-fetch\n\n```ts\nconst ssrfAgentGuard = require('ssrf-agent-guard');\nconst url = 'https://127.0.0.1'\nfetch(url, {\n    agent: ssrfAgentGuard(url)\n  })\n  .then((response) =\u003e {\n    console.log(`Success`);\n  })\n  .catch(error =\u003e {\n    console.log(`${error.toString().split('\\n')[0]}`);\n  });\n```\n\n### Advanced Configuration\n\n```ts\nconst ssrfAgentGuard = require('ssrf-agent-guard');\n\nconst agent = ssrfAgentGuard('https://api.example.com', {\n  mode: 'block',                    // 'block' | 'report' | 'allow'\n  blockCloudMetadata: true,         // Block AWS/GCP/Azure metadata endpoints\n  detectDnsRebinding: true,         // Detect DNS rebinding attacks\n  policy: {\n    allowDomains: ['*.trusted.com'], // Only allow these domains\n    denyDomains: ['evil.com'],       // Block these domains\n    denyTLD: ['local', 'internal']   // Block these TLDs\n  },\n  logger: (level, msg, meta) =\u003e {\n    console.log(`[${level}] ${msg}`, meta);\n  }\n});\n```\n\n---\n\n## Development\n\n```bash\n# install dependencies\nnpm install\n\n# build\nnpm run build\n\n# run tests\nnpm test\n```\n\n---\n\n## Contributing\n\n1. Fork the repository\n2. Create a branch (`git checkout -b feature/new-feature`)\n3. Make changes and run tests\n4. Commit and push your branch\n5. Open a Pull Request\n\n---\n\n## Credits: \n  * SSRF prevention techniques: [SSRF Cheatsheet](https://cheatsheetseries.owasp.org/cheatsheets/Server_Side_Request_Forgery_Prevention_Cheat_Sheet.html)\n  * Implementation inspired By [ssrf-req-filter](https://github.com/y-mehta/ssrf-req-filter/)\n\n---\n\n## License\n\nMIT © [Swapnil Srivastava](https://swapniluneva.github.io)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fswapniluneva%2Fssrf-agent-guard","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fswapniluneva%2Fssrf-agent-guard","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fswapniluneva%2Fssrf-agent-guard/lists"}