codemod/admin-services-ip-allowlist
Read-only audit of deployment template JSON for web application service administration endpoints that do not inherit an existing explicit IP allowlist from the main site configuration.
# @codemod/admin-services-ip-allowlist
Read-only audit of deployment template JSON for web application service administration endpoints that do not inherit the same explicit IP allowlist already applied to the main site.
## Installation
```bash
# Install from registry
codemod run @codemod/admin-services-ip-allowlist
# Or run locally
codemod workflow run -w workflow.yaml -t /path/to/deployment-json-root
```
## What It Reports
This codemod targets deployment template `.json` files and reports web application service resources when all of these are true:
- The resource is `web/sites`, `web/sites/config`, or a nested child `config` resource.
- The main site already defines `ipSecurityRestrictions` as a literal allowlist of specific IPs or CIDR ranges.
- That allowlist does not contain broad entries such as `0.0.0.0/0`, `::/0`, `*`, `Any`, or `Internet`.
- `scmIpSecurityRestrictionsUseMain` is missing or explicitly `false`.
When those conditions hold, the codemod emits a finding and metrics. It does not edit source files.
## Preserve Cases
- Resources that already set `scmIpSecurityRestrictionsUseMain` to `true`
- Resources whose `ipSecurityRestrictions` include broad allow rules
- Resources that use service tags, expressions, or other non-literal values instead of explicit IP/CIDR allow entries
- Unrelated deployment resources and non-resource JSON objects
- Embedded templates are reported only when the nested resources themselves match the supported shapes
## Metrics
- `admin_services_ip_allowlist_files`
- `admin_services_ip_allowlist_findings`
- `admin_services_ip_allowlist_resources_scanned`
## Development
```bash
pnpm test
pnpm check-types
npx codemod ai call validate_codemod_package --input '{"package_path":".","run_default_test":true,"run_check_types":true}'
```
## License
MIT