pub enum RouterError {
Header(InvalidHeaderValue),
UnprotectedAuthenticator,
}Expand description
The Streamable HTTP route table.
The error returned by McpRouter::into_router.
Two failure modes, both at mount time rather than at the first request:
a configured security header that is not a legal HTTP value
(Header), and the silent-fail-open combination
described in issue #11
(UnprotectedAuthenticator). The
router was previously typed Result<_, InvalidHeaderValue> and the
new variant widens it; callers that used ? continue to work because
the existing ServeError::Routes wraps InvalidHeaderValue and
BridgeServeError::Router does the same.
Variants§
Header(InvalidHeaderValue)
A configured security header is not a legal HTTP header value.
Surfaces a malformed SecurityHeaders at mount time rather than
at the first response. The alternative is a server that starts and
then answers every request with a header set it cannot write.
UnprotectedAuthenticator
A real authenticator was wired but the policy is still the default
AuthPolicy::Public.
The combination is the exact fail-open the issue #11 review
described: with_authenticator is consulted, a valid token
produces a scoped AuthContext, but AuthPolicy::refuse answers
None on an empty required() and the endpoint is served to
anonymous callers. Failing closed here means a deployment that
wired a token authenticator but forgot the with_policy call
gets a startup error, not a permission boundary that does not
exist.
The fix is to follow with_authenticator with
with_policy(AuthPolicy::Require(scopes)) — or, for a deployment
that genuinely wants anonymous callers, drop the
with_authenticator call entirely.
Trait Implementations§
Source§impl Debug for RouterError
impl Debug for RouterError
Source§impl Display for RouterError
impl Display for RouterError
Source§impl Error for RouterError
impl Error for RouterError
Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()