V0.38.5 git board rewrite (#238)
Co-authored-by: gobha <jasafpro@gmail.com> Co-committed-by: gobha <jasafpro@gmail.com>
This commit is contained in:
@@ -63,6 +63,12 @@ type HTTPModuleConfig struct {
|
||||
// Ignored when AllowDomains is non-empty.
|
||||
BlockDomains []string
|
||||
|
||||
// AllowPrivateIPs disables the SSRF check that blocks connections to
|
||||
// private/loopback/link-local addresses. Use for self-hosted deployments
|
||||
// where extensions need to reach internal services.
|
||||
// Default: false (private IPs blocked).
|
||||
AllowPrivateIPs bool
|
||||
|
||||
// Timeout overrides the default 10 s request timeout.
|
||||
// Zero means use default.
|
||||
Timeout time.Duration
|
||||
@@ -345,11 +351,13 @@ func (ac *accessControl) checkDomain(host string) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// client builds an SSRF-safe http.Client with IP validation on connect.
|
||||
// client builds an HTTP client with optional SSRF IP validation on connect.
|
||||
func (ac *accessControl) client() *http.Client {
|
||||
dialer := &net.Dialer{
|
||||
Timeout: 5 * time.Second,
|
||||
Control: ssrfControl,
|
||||
}
|
||||
if !ac.cfg.AllowPrivateIPs {
|
||||
dialer.Control = ssrfControl
|
||||
}
|
||||
|
||||
transport := &http.Transport{
|
||||
|
||||
Reference in New Issue
Block a user