fix(security): redact IM list credentials and harden MinerU SSRF
Stop returning bot credentials from Viewer-accessible IM channel list endpoints and validate self-hosted MinerU URLs at config save and fetch time.
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
package docparser
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
|
||||
func TestValidateMinerUOutboundURL_RejectsLoopback(t *testing.T) {
|
||||
err := validateMinerUOutboundURL("http://127.0.0.1:8080")
|
||||
require.Error(t, err)
|
||||
assert.Contains(t, err.Error(), "SSRF")
|
||||
}
|
||||
|
||||
func TestPingMinerU_RejectsPrivateEndpoint(t *testing.T) {
|
||||
ok, msg := PingMinerU("http://127.0.0.1:8080")
|
||||
assert.False(t, ok)
|
||||
assert.Contains(t, msg, "SSRF")
|
||||
}
|
||||
Reference in New Issue
Block a user