{"record":{"id":"8851929117b33f1f","repo":"Hmbown/CodeWhale","slug":"reviewed-plugin-mcp-endpoint-must-not-contain-a-qu","errorCode":null,"errorMessage":"reviewed plugin MCP endpoint must not contain a query or fragment","messagePattern":"reviewed plugin MCP endpoint must not contain a query or fragment","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/tui/src/mcp.rs","lineNumber":1114,"sourceCode":"#[cfg(windows)]\nfn open_reviewed_launch_file(path: &Path) -> Result<fs::File> {\n    crate::plugins::manifest::open_bundle_file(path)\n        .context(\"open reviewed launch file without links, hard links, or write/delete sharing\")\n}\n\n#[cfg(all(not(unix), not(windows)))]\nfn open_reviewed_launch_file(path: &Path) -> Result<fs::File> {\n    fs::File::open(path).context(\"open reviewed launch file\")\n}\n\nfn reviewed_remote_endpoint_identity(endpoint: &str) -> Result<(String, String)> {\n    let endpoint =\n        reqwest::Url::parse(endpoint).context(\"reviewed plugin MCP endpoint is invalid\")?;\n    if !endpoint.username().is_empty() || endpoint.password().is_some() {\n        anyhow::bail!(\"reviewed plugin MCP endpoint must not contain user information\");\n    }\n    if endpoint.query().is_some() || endpoint.fragment().is_some() {\n        anyhow::bail!(\"reviewed plugin MCP endpoint must not contain a query or fragment\");\n    }\n    let origin = reviewed_remote_origin(&endpoint)\n        .ok_or_else(|| anyhow::anyhow!(\"reviewed plugin MCP endpoint has an unsafe origin\"))?;\n    Ok((endpoint.to_string(), origin))\n}\n\nfn reviewed_remote_origin(endpoint: &reqwest::Url) -> Option<String> {\n    if !endpoint.username().is_empty() || endpoint.password().is_some() {\n        return None;\n    }\n    let host = endpoint.host_str()?;\n    let allowed_scheme = endpoint.scheme() == \"https\"\n        || (endpoint.scheme() == \"http\"\n            && (host.eq_ignore_ascii_case(\"localhost\")\n                || host\n                    .trim_matches(['[', ']'])\n                    .parse::<std::net::IpAddr>()\n                    .is_ok_and(|address| address.is_loopback())));","sourceCodeStart":1096,"sourceCodeEnd":1132,"githubUrl":"https://github.com/Hmbown/CodeWhale/blob/73e0f67d83c59909b571efdfc88c4bc28c309cb1/crates/tui/src/mcp.rs#L1096-L1132","documentation":"reviewed_remote_endpoint_identity rejects remote MCP endpoint URLs containing a query string or fragment. Queries/fragments carry per-request or session state that would be baked into the reviewed identity and could smuggle parameters or change what the URL resolves to after approval. The endpoint must be a bare, stable origin+path URL.","triggerScenarios":"Thrown when endpoint.query().is_some() or endpoint.fragment().is_some() — e.g. https://api.example.com/mcp?token=x or .../mcp#frag — during endpoint normalization in reviewed_remote_endpoint_identity.","commonSituations":"Copied a URL straight from a browser address bar (fragments/queries attached); embedded an API key in the query string because the vendor's docs suggested it; left a tracking suffix on the URL.","solutions":["Strip the query string and fragment so the endpoint is only scheme://host/path","Move any key from the query into an authentication header or secret store","Re-approve the plugin with the cleaned endpoint if the approved record contains the query-laden URL"],"exampleFix":"// before\n\"endpoint\": \"https://api.example.com/mcp?session=abc#tools\"\n// after\n\"endpoint\": \"https://api.example.com/mcp\"","handlingStrategy":"validation","validationCode":"function endpointIsBare(endpoint) {\n  const u = new URL(endpoint);\n  return u.search === '' && u.hash === '';\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Strip query strings and #fragments when copying endpoint URLs from browsers","Never pass API keys or session ids as query parameters on reviewed endpoints — use headers","Add a config lint rejecting '?' and '#' in MCP endpoint fields"],"tags":["url","mcp","plugin-review"],"backgroundTag":"invalid-url-format","analyzedSha":"73e0f67d83c59909b571efdfc88c4bc28c309cb1","analyzedAt":"2026-09-22T01:30:00.501Z","contentChangedAt":"2026-09-22T01:30:00.501Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}