{"id":23059886,"url":"https://github.com/ricardoferreirasilva/nestjs-referers","last_synced_at":"2025-08-15T08:31:20.616Z","repository":{"id":44016880,"uuid":"232591955","full_name":"ricardoferreirasilva/nestjs-referers","owner":"ricardoferreirasilva","description":"Decorator based validation for request referers in NestJS.","archived":false,"fork":false,"pushed_at":"2023-01-24T01:11:29.000Z","size":1253,"stargazers_count":3,"open_issues_count":13,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-11-15T04:07:25.142Z","etag":null,"topics":["decorator","http","nestjs","nestjs-referers","referers","request"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/nestjs-referers","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/ricardoferreirasilva.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-01-08T15:16:15.000Z","updated_at":"2024-10-04T14:13:12.000Z","dependencies_parsed_at":"2023-02-13T07:45:53.474Z","dependency_job_id":null,"html_url":"https://github.com/ricardoferreirasilva/nestjs-referers","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ricardoferreirasilva%2Fnestjs-referers","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ricardoferreirasilva%2Fnestjs-referers/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ricardoferreirasilva%2Fnestjs-referers/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ricardoferreirasilva%2Fnestjs-referers/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ricardoferreirasilva","download_url":"https://codeload.github.com/ricardoferreirasilva/nestjs-referers/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":229881197,"owners_count":18138643,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["decorator","http","nestjs","nestjs-referers","referers","request"],"created_at":"2024-12-16T03:10:43.828Z","updated_at":"2024-12-16T03:10:44.528Z","avatar_url":"https://github.com/ricardoferreirasilva.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003ch1 align=\"center\"\u003e\u003c/h1\u003e\n\n\u003cdiv align=\"center\"\u003e\n  \u003ca href=\"http://nestjs.com/\" target=\"_blank\"\u003e\n    \u003cimg src=\"https://nestjs.com/img/logo_text.svg\" width=\"150\" alt=\"Nest Logo\" /\u003e\n  \u003c/a\u003e\n\u003c/div\u003e\n\n\u003ch3 align=\"center\"\u003eNestJS Referers\u003c/h3\u003e\n\u003cp align=\"center\"\u003eDecorator based validation for request referers.\u003c/p\u003e\n\u003cdiv align=\"center\"\u003e\n  \u003ca href=\"https://nestjs.com\" target=\"_blank\"\u003e\n    \u003cimg src=\"https://img.shields.io/badge/built%20with-NestJs-red.svg\" alt=\"Built with NestJS\"\u003e\n    \u003cimg src=\"https://github.com/ricardoferreirasilva/nestjs-referers/workflows/Node%20CI/badge.svg\" alt=\"CI Badge\" /\u003e\n  \u003c/a\u003e\n\u003c/div\u003e\n\n### Introduction\n\nNestJS Referers is a simple package that implements decorator based validation for the referer header of incoming HTTP requests.\nThe adopted syntax for specifying allowed URL's was based on [Algolia's](https://www.algolia.com/doc/guides/security/api-keys/in-depth/api-key-restrictions/) example.\n\nA few examples:\n- https://algolia.com/* will restrict access to all referers starting with https://algolia.com\n- *.algolia.com will restrict access to all referers ending with .algolia.com\n- If you want to allow access for the full domain algolia.com, you can use *algolia.com/*\n\nRegarding security, you should know that referers can be easily spoofed like any other HTTP header, so you should not rely on this technique alone for securing requests.\n\n### Installation\n\n```bash\nnpm i nestjs-referers --save\n```\n\n### Basic usage\n\nYou can checkout the usage of this package with this example.\n\n**test.controller.ts**\n\n```typescript\nimport { Controller,Get} from '@nestjs/common';\nimport { ValidateReferers } from \"nestjs-referers\"\n\n\n@Controller('test')\nexport class TestController {\n    constructor(){}\n\n    @Get('/')\n    @ValidateReferers(\"*localhost*\",\"https://website/*\")\n    async testRoute() {\n       return \"OK\"\n    }\n}\n\n\n```\n\n\n\n### Installation for Development\n\n1. Clone the repo\n2. Run npm/yarn install\n\n```bash\ncd nestjs-referers\nnpm install\n```\n\n## Change Log\n\nSee [Changelog](CHANGELOG.md) for more information.\n\n## Contributing\n\nAll contributions are welcome! Check out [Contributing](CONTRIBUTING.md).\n\n## Author\n\n**Ricardo Ferreira da Silva (Check out my [Website](https://ricardoferreirasilva.pt))**\n\n## License\n\nLicensed under the MIT License - see the [LICENSE](LICENSE) file for details.","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fricardoferreirasilva%2Fnestjs-referers","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fricardoferreirasilva%2Fnestjs-referers","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fricardoferreirasilva%2Fnestjs-referers/lists"}