MCP servers: fields that can be emptied, addresses without passwords
CI / test (push) Failing after 6m34s
CI / test (push) Failing after 6m34s
From review. A server's description, timeout and rate can be emptied from the console and the page (MCPServerRequest.Clear), where an empty field used to leave them as they were. An address with a user and password in it is refused (adminapi.CheckMCPAddress): the credential belongs in a header, sealed, and the address is shown and audited as written. The console accepts llmgw:admin and the page lets it be changed, address fixed. A grant to a key that is not there is refused rather than said done. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
721705b29d
commit
f94d902cc3
5 files changed
+106
-18
No files matched your search
@@ -12,6 +12,7 @@ import (
|
||||
"slices"
|
||||
"strings"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"gitea.mynodes.xyz/ilker/llmgw/internal/mcpclient/mcptest"
|
||||
"gitea.mynodes.xyz/ilker/llmgw/internal/secrets"
|
||||
@@ -183,3 +184,26 @@ func TestAGrantBelowALevelThatNamesOtherToolsSaysSoAndKeepsWhatItHad(t *testing.
|
||||
t.Errorf("the team's list is %v; it should keep hr's, which it saw from its organization", l.AllowedTools)
|
||||
}
|
||||
}
|
||||
|
||||
func TestAnMCPServersFieldsCanBeEmptiedAndItsAddressHoldsNoPassword(t *testing.T) {
|
||||
mux, st, _ := mcpPage(t, mcpAdmin)
|
||||
ctx := context.Background()
|
||||
_ = st.PutMCPServer(ctx, store.MCPServer{Name: "hr", URL: "https://hr/mcp", Description: "people", Enabled: true,
|
||||
Timeout: 30 * time.Second, RatePerMinute: 10})
|
||||
mirrorPost(t, mux, "/admin/mcp/hr/edit", url.Values{"csrf": {"tok"}, "url": {"https://hr/mcp"}, "description": {""},
|
||||
"timeout": {""}, "rate": {""}})
|
||||
if m, _ := st.MCPServer(ctx, "hr"); m.Description != "" || m.Timeout != 0 || m.RatePerMinute != 0 {
|
||||
t.Errorf("emptied fields kept: %+v", m)
|
||||
}
|
||||
body := mirrorPost(t, mux, "/admin/mcp/add", url.Values{"csrf": {"tok"}, "name": {"db"},
|
||||
"url": {"https://admin:hunter2@db.internal/mcp"}, "auth": {"none"}}).Body.String()
|
||||
if _, err := st.MCPServer(ctx, "db"); err == nil || !strings.Contains(body, "user and password in it") {
|
||||
t.Errorf("an address with a password was kept: %s", body)
|
||||
}
|
||||
// A grant to a key that is not there is refused, not said done.
|
||||
body = mirrorPost(t, mux, "/admin/mcp/hr/grant", url.Values{"csrf": {"tok"}, "scope": {"key"}, "which": {"key-nope"},
|
||||
"tools": {"hr.*"}}).Body.String()
|
||||
if !strings.Contains(body, "There is no key-nope") {
|
||||
t.Errorf("a grant to no key: %s", body)
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user