MCPcopy Index your code
hub / github.com/coder/coder / redactErrorURL

Function redactErrorURL

coderd/x/chatd/mcpclient/mcpclient.go:480–490  ·  view source on GitHub ↗

redactErrorURL rewrites URLs in an error string to strip credentials. Go's net/http embeds the full request URL in *url.Error messages, which can leak userinfo.

(err error)

Source from the content-addressed store, hash-verified

478// credentials. Go's net/http embeds the full request URL in
479// *url.Error messages, which can leak userinfo.
480func redactErrorURL(err error) string {
481 if err == nil {
482 return ""
483 }
484 var urlErr *url.Error
485 if errors.As(err, &urlErr) {
486 urlErr.URL = RedactURL(urlErr.URL)
487 return urlErr.Error()
488 }
489 return err.Error()
490}
491
492// MCPToolIdentifier is implemented by tools that originate from
493// an MCP server config and can report the config's database ID.

Callers 1

ConnectAllFunction · 0.85

Calls 4

ErrorMethod · 0.95
RedactURLFunction · 0.85
AsMethod · 0.80
ErrorMethod · 0.45

Tested by

no test coverage detected