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)
| 478 | // credentials. Go's net/http embeds the full request URL in |
| 479 | // *url.Error messages, which can leak userinfo. |
| 480 | func 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. |
no test coverage detected