{"id":17855360,"url":"https://github.com/arubacao/aws-ip-range-middleware","last_synced_at":"2025-03-20T12:33:51.270Z","repository":{"id":62488264,"uuid":"121495490","full_name":"arubacao/aws-ip-range-middleware","owner":"arubacao","description":"Laravel Middleware for Amazon Web Services (AWS) IP Address Range Validation","archived":false,"fork":false,"pushed_at":"2021-05-03T00:07:50.000Z","size":19,"stargazers_count":17,"open_issues_count":1,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-17T16:50:01.229Z","etag":null,"topics":["aws","ip","ip-ranges","laravel","middleware"],"latest_commit_sha":null,"homepage":"","language":"PHP","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/arubacao.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-02-14T10:01:32.000Z","updated_at":"2025-03-13T08:45:57.000Z","dependencies_parsed_at":"2022-11-02T11:15:22.302Z","dependency_job_id":null,"html_url":"https://github.com/arubacao/aws-ip-range-middleware","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arubacao%2Faws-ip-range-middleware","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arubacao%2Faws-ip-range-middleware/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arubacao%2Faws-ip-range-middleware/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/arubacao%2Faws-ip-range-middleware/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/arubacao","download_url":"https://codeload.github.com/arubacao/aws-ip-range-middleware/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244611549,"owners_count":20481214,"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":["aws","ip","ip-ranges","laravel","middleware"],"created_at":"2024-10-28T02:04:02.015Z","updated_at":"2025-03-20T12:33:50.988Z","avatar_url":"https://github.com/arubacao.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Laravel Middleware for Amazon Web Services (AWS) IP Address Range Validation\n\n[![Latest Version on Packagist](https://img.shields.io/packagist/v/arubacao/aws-ip-range-middleware.svg?style=flat-square)](https://packagist.org/packages/arubacao/aws-ip-range-middleware)\n[![Run Tests](https://github.com/arubacao/aws-ip-range-middleware/workflows/Run%20Tests/badge.svg)](https://github.com/arubacao/aws-ip-range-middleware/actions?query=workflow%3A%22Run+Tests%22)\n[![Codecov](https://img.shields.io/codecov/c/github/arubacao/aws-ip-range-middleware.svg?style=flat-square)](https://codecov.io/gh/arubacao/aws-ip-range-middleware)\n[![Total Downloads](https://img.shields.io/packagist/dt/arubacao/aws-ip-range-middleware.svg?style=flat-square)](https://packagist.org/packages/arubacao/aws-ip-range-middleware)\n\nThis package allows for **validation** of incoming **requests** against the official [Amazon Web Services (AWS) IP Address Range](https://docs.aws.amazon.com/general/latest/gr/aws-ip-ranges.html).  \nUse this to determine if an incoming request actually comes from the AWS infrastructure e.g. for [Simple Notification Service (SNS)](https://docs.aws.amazon.com/sns/latest/dg/welcome.html) payloads.\n\n## Features\n - Passes incoming HTTP requests from AWS, rejects everything else \n - AWS _ip address range_ is fetched on demand and therefore always up-to-date\n - Caching of _ip address range_ --\u003e only fetched once per day\n - Retry with exponential back-off on network issues while fetching the _ip address range_ from AWS \n\n#### Notes\n - `arubacao/aws-ip-range-middleware` is functional and fully tested for Laravel `5.0` - `7.*` and PHP `7.0` - `7.3`.\n## Installation\nInstall this package via composer:\n\n```bash\ncomposer require arubacao/aws-ip-range-middleware\n```\n\n#### Registering Middleware\n\nFirst assign the _aws-ip-range-middleware_ a key in your `app/Http/Kernel.php` file to the `$routeMiddleware` property.\n\n```PHP\n// Within App\\Http\\Kernel Class...\n\nprotected $routeMiddleware = [\n    'auth' =\u003e \\Illuminate\\Auth\\Middleware\\Authenticate::class,\n    'auth.basic' =\u003e \\Illuminate\\Auth\\Middleware\\AuthenticateWithBasicAuth::class,\n    // .\n    // .\n    // .\n    'aws-ip-range' =\u003e \\Arubacao\\AwsIpRange\\AwsIpRangeMiddleware::class,\n];\n```\n\n## Usage\n\nOnce the _aws-ip-range-middleware_ has been defined in the HTTP kernel, you may use the middleware method to assign _aws-ip-range-middleware_ to a route:\n\n```PHP\nRoute::post('api/sns', function () {\n    //\n})-\u003emiddleware('aws-ip-range');\n\n\n// Older Laravel Versions:\nRoute::post('api/sns', ['middleware' =\u003e 'aws-ip-range', function () {\n    //\n}]);\n```\n\nWhen assigning middleware, you may also pass the fully qualified class name:  \n_Note: In this case you do not need to register the aws-ip-range-middleware in the HTTP kernel_  \n\n```PHP\nuse Arubacao\\AwsIpRange\\AwsIpRangeMiddleware;\n\nRoute::post('api/sns', function () {\n    //\n})-\u003emiddleware(AwsIpRangeMiddleware::class);\n\n\n// Older Laravel Versions:\nRoute::post('api/sns', ['middleware' =\u003e AwsIpRangeMiddleware::class, function () {\n    //\n}]);\n```\n\n\n## Todo's\n\n - Enable/Disable caching\n - Choose cache storage\n - Command to fetch ip address range and store locally \n\n## Testing\n\n``` bash\ncomposer test\n```\n\n## Contributing\n\nPlease see [CONTRIBUTING](CONTRIBUTING.md) for details.\n\n## Credits\n\n- [Christopher Lass](https://github.com/arubacao)\n- [All Contributors](../../contributors)\n\n## License\n\nThe MIT License (MIT). Please see [License File](LICENSE.md) for more information.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Farubacao%2Faws-ip-range-middleware","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Farubacao%2Faws-ip-range-middleware","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Farubacao%2Faws-ip-range-middleware/lists"}