You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Adds the SSRF_ALLOWED_HOSTS environment setting with an empty-list default. The validator normalises host patterns and skips the internal-address check when a host matches the allowlist. Tests cover allowed and rejected hosts, including a webhook request that uses an allowed private IP. The environment-variable reference describes the setting.
This adds an opt-in allowlist for trusted internal hosts, and it is off by default. The documentation should state that a leading-dot entry trusts the domain and all its subdomains. Operators otherwise may trust more hosts than they intend. A small documentation fix covers this before merge or soon after.
- [ ] Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 98.92%. Comparing base (4a45da1) to head (a544a38). ⚠️ Report is 1 commits behind head on main.
The reason will be displayed to describe this comment to others. Learn more.
0 issues found across 1 file (changes from recent commits).
Confidence score: 5/5
Automated review surfaced no issues in the provided summaries.
No files require special attention.
Requires human review: Adds an operator-configured SSRF_ALLOWED_HOSTS allowlist that exempts matching hosts from SSRF validation, with docs and tests. Decisive factor: this deliberately weakens SSRF protection for configured or wildcard hosts, a security-policy tradeoff needing human sign-off.
Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 6 remain after this review.
The reason will be displayed to describe this comment to others. Learn more.
Minor · Security & Privacy · Quick win
Document the subdomain scope of a leading-dot entry.
A leading dot trusts the domain and all its subdomains. For example, .internal.example.com also trusts every name under internal.example.com. An operator who only intends to trust internal.example.com can therefore trust more hosts than planned. A subdomain under that domain that resolves to a private address can then be used as a webhook or integration target. The practical risk depends on who can create names under the trusted domain.
State this scope in the entry, and show the exact-host form for narrow access. A value without a leading dot matches only that host.
Suggested documentation change
--- "a/docs/docs/deployment-self-hosting/core-configuration/environment-variables.md"+++ "b/docs/docs/deployment-self-hosting/core-configuration/environment-variables.md"@@ -14,7 +14,8 @@
- `DJANGO_ALLOWED_HOSTS`: Comma-separated list of domains that can access the API. Alternatively `*` to allow any.
- `SSRF_ALLOWED_HOSTS`: Comma-separated list of trusted hosts that webhook and integration URLs can target, even if they
resolve to a private network address, e.g. `.internal.example.com`.
+ A leading dot trusts the domain and all its subdomains. To trust only one host, omit the dot, e.g. `internal.example.com`.
- `DATABASE_URL`: The URL of your PostgreSQL database. Both `postgres://` and `postgresql://` schemas are supported.
- `DJANGO_DB_CONN_MAX_AGE`: Lifetime of a database connection, in seconds. Defaults to `60`. Set to `-1` to close the
connection at the end of each request (Django's default behaviour). See
IMPORTANT
Review the replacement and indentation, then test before committing.
Suggested change
resolve to a private network address, e.g. `.internal.example.com`.
resolve to a private network address, e.g. `.internal.example.com`.
A leading dot trusts the domain and all its subdomains. To trust only one host, omit the dot, e.g. `internal.example.com`.
Tools
LanguageTool
[typographical] ~17-~17: Two consecutive dots
Context: ...solve to a private network address, e.g. .internal.example.com. - DATABASE_URL: The URL of your Postg...
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
apiIssue related to the REST APIfeatureNew feature or request
1 participant
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Thanks for submitting a PR! Please check the boxes below:
docs/if required so people know about the feature.Changes
closes #8992
Added an allowlist (
SSRF_ALLOWED_HOSTS) coming from environment variables to let internal addresses be usedHow did you test this code?
With tests and manually, created webhooks with http://127.0.0.1:9000/, it lets users use localhost if it is in
SSRF_ALLOWED_HOSTSotherwise not