MCPcopy Create free account
hub / github.com/ajitpratap0/GoSQLX / TestProtocol_CallTool_SecurityScan

Function TestProtocol_CallTool_SecurityScan

pkg/mcp/protocol_test.go:196–213  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

194}
195
196func TestProtocol_CallTool_SecurityScan(t *testing.T) {
197 c := newInProcessClient(t)
198 ctx := context.Background()
199
200 req := mcpmcp.CallToolRequest{}
201 req.Params.Name = "security_scan"
202 req.Params.Arguments = map[string]any{"sql": "SELECT * FROM users WHERE 1=1 OR ''=''"}
203
204 result, err := c.CallTool(ctx, req)
205 if err != nil {
206 t.Fatalf("CallTool security_scan: %v", err)
207 }
208
209 data := extractProtocolResult(t, result)
210 if data["is_clean"] == true {
211 t.Error("expected injection detection for tautology pattern")
212 }
213}
214
215func TestProtocol_CallTool_LintSQL(t *testing.T) {
216 c := newInProcessClient(t)

Callers

nothing calls this directly

Calls 4

newInProcessClientFunction · 0.85
extractProtocolResultFunction · 0.85
FatalfMethod · 0.65
ErrorMethod · 0.45

Tested by

no test coverage detected