fix(security): harden web_fetch and datasource connector SSRF paths

Use SSRF-safe HTTP clients in chat pipeline web_fetch and Feishu/Yuque/Notion
connectors, validating tenant-supplied base_url values before outbound requests.
This commit is contained in:
wizardchen
2026-07-02 12:21:39 +08:00
committed by lyingbug
parent 1d322c525a
commit 8325dac738
13 changed files with 179 additions and 66 deletions
@@ -4,11 +4,19 @@ import (
"context"
"net/http"
"net/http/httptest"
"os"
"testing"
secutils "github.com/Tencent/WeKnora/internal/utils"
"github.com/Tencent/WeKnora/internal/types"
)
func TestMain(m *testing.M) {
os.Setenv("SSRF_WHITELIST", "127.0.0.1,localhost")
secutils.ResetSSRFWhitelistForTest()
os.Exit(m.Run())
}
func makeDSConfig(f *fakeYuque, resourceIDs []string) *types.DataSourceConfig {
return &types.DataSourceConfig{
Type: types.ConnectorTypeYuque,