{"id":22409013,"url":"https://github.com/hubspotwebteam/serverless-resource-policy","last_synced_at":"2025-07-31T20:31:05.603Z","repository":{"id":57116597,"uuid":"161075110","full_name":"HubSpotWebTeam/serverless-resource-policy","owner":"HubSpotWebTeam","description":"Custom serverless plugin for whitelisting certain IP and/or CIDR addresses by setting a resource policy","archived":false,"fork":false,"pushed_at":"2018-12-10T17:15:39.000Z","size":9,"stargazers_count":8,"open_issues_count":1,"forks_count":1,"subscribers_count":6,"default_branch":"master","last_synced_at":"2024-11-28T19:04:56.408Z","etag":null,"topics":["cidr","hacktoberfest","ip","plugin","resource-policy","resourcepolicy","serverless","whitelist"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/HubSpotWebTeam.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-12-09T19:45:35.000Z","updated_at":"2022-08-11T20:23:56.000Z","dependencies_parsed_at":"2022-08-22T22:20:15.466Z","dependency_job_id":null,"html_url":"https://github.com/HubSpotWebTeam/serverless-resource-policy","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/HubSpotWebTeam%2Fserverless-resource-policy","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HubSpotWebTeam%2Fserverless-resource-policy/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HubSpotWebTeam%2Fserverless-resource-policy/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HubSpotWebTeam%2Fserverless-resource-policy/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/HubSpotWebTeam","download_url":"https://codeload.github.com/HubSpotWebTeam/serverless-resource-policy/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":228295622,"owners_count":17897596,"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":["cidr","hacktoberfest","ip","plugin","resource-policy","resourcepolicy","serverless","whitelist"],"created_at":"2024-12-05T12:06:20.721Z","updated_at":"2024-12-05T12:06:21.399Z","avatar_url":"https://github.com/HubSpotWebTeam.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Serverless Resource Policy\n\nCreates a whitelist for IP or CIDR addresses accessing a serverless application, using serverless resource policies. This enables you to allow requests only from the IP or CIDR addresses you specify.\n\n## Private and Public Stages\n\nCIDR and IP addresses are whitelisted by stages.\n\n- `privateStages`: Private to whitelisted CIDR and IP addresses. In the example below, our `dev` and `staging` stages are `privateStages`, so only those CIDR and IP addresses can access `dev` and `staging`.\n- `publicStages`: No whitelisting necessary. These stages are public to all CIDR and IP addresses.\n\n## How to Use\n\n1. Install in your serverless application: `npm install --save serverless-resource-policy`\n2. In your `serverless.yml` file, add the `serverless-resource-plugin`, for example:\n   ```\n   plugins:\n   - serverless-resource-policy\n   ```\n3. Within the `provider` block, add a `stage` variable:\n   ```\n   provider:\n     stage: ${opt:stage, 'dev'}\n   ```\n4. Within a `custom` block, add:\n   ```\n   custom:\n     serverless-resource-policy:\n       stage: ${self:provider.stage}\n       privateStages:\n         - dev\n         - staging\n       publicStages:\n         - production\n       netblocks:\n         - 123.45.67.890/30\n         - 987.65.432.109\n   ```\n\n\u003e The `netblocks` object will contain the list of whitelisted IPs.\n\n### Full Example\n\n```\n# serverless.yml\n\nservice: my-service-name\n\nplugins:\n  - serverless-resource-policy\n\nprovider:\n  stage: ${opt:stage, 'dev'}\n\ncustom:\n  serverless-resource-policy:\n    stage: ${self:provider.stage}\n    privateStages:\n      - dev\n      - staging\n    publicStages:\n      - production\n    netblocks:\n      - 123.45.67.890/30\n      - 987.65.432.109\n```\n\n# Contributing\n\nCurrently maintained by the lovely folks on HubSpot's Web Team, but we need your help. Please feel free to submit pull requests to add new functionality.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhubspotwebteam%2Fserverless-resource-policy","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhubspotwebteam%2Fserverless-resource-policy","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhubspotwebteam%2Fserverless-resource-policy/lists"}