Repository navigation
v0.4.0
byward v0.4.0
v0.4.0 makes every configuration refusal one format that never prints the value it refused, and holds every host and URL setting to the rules a browser and a dialer apply. Many values that loaded on v0.3.3 now stop startup with exit 2. Read Breaking changes before you upgrade, and run the new version's byward check --offline against your configuration first.
byward puts any MCP server, HTTP or stdio, behind OAuth 2.1 and your identity provider: Microsoft Entra ID first-class, and Okta, Keycloak, Google, Auth0 or any other OpenID Connect provider.
Pre-1.0, and no independent security audit yet. Read the security posture before deploying it.
A minor release on v0.3.3, with breaking setting changes. No store migration: the SQLite schema stays at v8, and the PostgreSQL store is unchanged.
Breaking changes
Every refusal below happens at startup, in check --offline, in doctor and in the operator commands, and exits 2. None of them shows the value it refused: it names the setting, the entry's place, the value's length and the reason. To find what your configuration hits, run the new version's byward check --offline (for example docker run --rm --env-file … ghcr.io/byward-dev/byward:v0.4.0 check --offline). The old version does not check these.
Listen addresses (BYWARD_LISTEN, BYWARD_INTERNAL_LISTEN)
- The port must be a number (#515). A service name (
127.0.0.1:http), a signed port (127.0.0.1:+8080) and an empty port (127.0.0.1:) are refused. Upgrade: write the port as a number, such as127.0.0.1:80, or:0for any free port. - Brackets only around an IPv6 address (#636).
[1.2.3.4]:80,[my_mcp]:80and[]:80are refused. They loaded with the brackets dropped, and[]:80listened on every interface. Upgrade: write1.2.3.4:80ormy_mcp:80. For every interface, write:80or0.0.0.0:80. An IPv6 address keeps its brackets ([::1]:80). - An IPv6 zone must be a name an interface can have (#640). An empty zone, one longer than 15 bytes,
.or.., and a zone with white space, a control character,/or:are refused. Upgrade: write the zone asip linkorifconfigshows it ([fe80::1%eth0]:8080), or as its index ([fe80::1%2]:8080). - Host names hold only ASCII letters, digits,
-,.and_(#615), and no label starts or ends with a hyphen (#632).~is refused. Upgrade: write the host name as DNS does (a-b.example, not-a.example).
URL settings (BYWARD_PUBLIC_URL, BYWARD_UPSTREAM_URL, BYWARD_RESOURCE_DOCUMENTATION, BYWARD_OIDC_ISSUER)
- No white space, control character or invisible formatting character (#592). A space, U+0085, U+00A0 or a zero-width space in a path is refused. An escaped one (
%20) still loads. - A port is a number from 1 to 65535 (#605). A port of 0, above 65535, with a leading zero, or empty after its
:is refused inBYWARD_UPSTREAM_URL,BYWARD_RESOURCE_DOCUMENTATIONandBYWARD_OIDC_ISSUER. Upgrade: give the real port, or leave it out for the scheme's default. - A port needs a host (#616).
http://:9000/mcpandhttps://:443/realms/xare refused. Upgrade: write the host, such asBYWARD_UPSTREAM_URL=http://127.0.0.1:9000/mcp. An upstream written ashttp://:9000/…reached this machine, so127.0.0.1orlocalhostis what it meant. - Host names hold only ASCII letters, digits,
-,.and_(#615), and no label starts or ends with a hyphen (#632). This applies toBYWARD_PUBLIC_URLand to the host ofBYWARD_UPSTREAM_URL._stays allowed, so a Compose service name such ashttp://my_mcp:8000/mcpstill loads. Upgrade: write an internationalized name in itsxn--form. - An http
BYWARD_OIDC_ISSUERmust be on a loopback host as written (#592).localhost,LOCALHOST,127.0.0.1and[::1]count;127.1andlocalhost.do not. Upgrade: use https for an issuer that is not on this machine. - No IPv6 zone in a URL (#650, #644).
BYWARD_UPSTREAM_URL,BYWARD_RESOURCE_DOCUMENTATIONandBYWARD_OIDC_ISSUERrefuse an address with a%zone, which no URL a client follows carries, and which a dialer drops in silence.BYWARD_PUBLIC_URLandBYWARD_ALLOWED_ORIGINSalready refused a zone; only their wording changes. Upgrade: give the address without its%zone.
BYWARD_PUBLIC_URL with its scheme's default port (#615)
https://mcp.example.com:443/mcp and http://localhost:80/mcp are refused. Browsers drop a scheme's default port, so a browser client held a different issuer and resource than the one byward published. byward refuses the URL rather than rewriting it, because the IdP redirect URI is registered as written.
Upgrade. Dropping the port changes the public URL, and byward binds several values to it:
- Register the redirect URI without the port first (
byward init entra --public-urlprints it), then change the setting. Otherwise sign-in fails at the IdP. - Old access tokens and pending authorization codes get 401 (
invalid_token, withresource_metadataon the new URL). - Refresh tokens keep working when they send no
resource, or the new URL. One that sends the old URL gets400 invalid_targetand is not spent, and that user signs in again. - A user who signs in again sees consent once.
- An upstream that pins the identity assertion's issuer or JWKS URL, and a client that pinned the old issuer, take the new one.
The sealing keys, stored grants and DCR registrations are not affected.
Host lists (BYWARD_ALLOWED_HOSTS, BYWARD_ALLOWED_ORIGINS, BYWARD_CIMD_TRUSTED_HOSTS, BYWARD_CIMD_ALLOWED_HOSTS, BYWARD_CLIENT_DENYLIST)
BYWARD_ALLOWED_HOSTStakes an IPv4 address only in dotted decimal (#639).127.1,0x7f.0.0.1,2130706433and010.0.0.1are refused. They were rewritten in silence, and010.0.0.1became8.0.0.1. A name ending in a number (mcp.10,10.0.0.999) is refused too. Upgrade: write127.0.0.1, or10.0.0.1if that is what010.0.0.1meant, or the host name.~is refused in a host name (#639, #646), and so is a label that starts or ends with a hyphen (#632), in every one of these lists.- The CIMD lists name hosts, never addresses (#646, #524).
BYWARD_CIMD_TRUSTED_HOSTSandBYWARD_CIMD_ALLOWED_HOSTSrefuse an IP address (203.0.113.5,::1) and a name ending in a number (127.1,mcp.10). An address has other spellings that no entry could match.BYWARD_CLIENT_DENYLISTrefuses a client ID with an IPv6 zone. Upgrade: give a CIMD list entry as the host name of the app's client ID (claude.ai). A client ID at an IP address can still be denied by its URL. A client ID's trust can change:https://claude.ai./…is now Verified whenclaude.aiis trusted.
No sealed token, remembered consent or IdP registration depends on these lists, so changing an entry signs no one out.
Lists, identifiers and values that look like secrets
-
A list that names no entry is refused (#574). A value such as
,inBYWARD_UPSTREAM_STRIP_HEADERS,BYWARD_OAUTH_RATE_LIMITS,BYWARD_TRUSTED_PROXIES,BYWARD_ALLOWED_HOSTSorBYWARD_ALLOWED_ORIGINSgetswant at least one entry; got a list of none. Upgrade: give an entry, or leave the variable unset or empty. -
BYWARD_SCOPEand eachBYWARD_OIDC_SCOPESentry refuse any character a scope can't hold (#574): white space, a control character, DEL or anything outside ASCII (RFC 6749 §3.3). -
BYWARD_OIDC_SUBJECT_CLAIMwith white space at either end is refused (#574). A padded claim name never matched. -
BYWARD_ENTRA_CLIENT_IDmust be a GUID (#592). The Entra adapter already refused anything else at startup; config now refuses it first, saying where to find the value. -
BYWARD_ENTRA_CLIENT_IDwith an upper-case letter is refused (#676, #514). The ID token's audience is compared with it exactly, so an upper-case client ID could fail every sign-in. The tenant still takes either case. Upgrade: writeBYWARD_ENTRA_CLIENT_IDin lower case. -
A value that looks like a secret is refused by its kind (#628, #495).
- Where: all 66 settings that are not secret, including the free-text ones (such as
BYWARD_RESOURCE_NAME,BYWARD_OPERATOR_NAME,BYWARD_SCOPE_DESCRIPTION,BYWARD_UPSTREAM_CREDENTIAL_HEADERand the OIDC claim names) and the host lists. - What: a GitHub or Slack token by its documented prefix, a connection string with a password, or a JWT. Each is checked in what
--print-configand the startup log would show: a URL by its scheme, host and path, a command by its program, and a list entry by entry. - The refusal: it names the setting and the kind ("it looks like a GitHub token"), never the value.
- Not refused: a
BearerorBasicword in free text, such asBYWARD_SCOPE_DESCRIPTION="Basic read access to your dashboards". ABearervalue holding a JWT is still refused as a JWT. A word that starts witheyJand is followed by a dot, such aseyJohn.Smith, reads as a JWT and is refused. - Order: a setting shown as given, such as
BYWARD_LISTEN, that holds a URL with a password is now refused by that kind before its own parser's reason.
- Where: all 66 settings that are not secret, including the free-text ones (such as
-
The access gate's and app tokens' lists are checked at load, entry by entry, by the IdP's rule (#628). These are
BYWARD_GATE_TENANTS,_ROLES,_GROUPS,_EMAIL_DOMAINS,_HOSTED_DOMAINS,BYWARD_APP_ROLESandBYWARD_APP_CLIENT_IDS. Before, they were checked when the broker was wired, with the refused value quoted. Now a refused entry is named by its place and length.- With
BYWARD_IDP=entra, an app role inBYWARD_APP_ROLESorBYWARD_GATE_ROLESmust follow Microsoft Graph's appRole value rule: at most 120 characters, only ASCII letters, digits and Graph's listed punctuation (no space,"or\), not starting with.. - A domain name where a GUID belongs is named as one ("it looks like a domain name, not a GUID"). That covers
BYWARD_GATE_TENANTS,BYWARD_GATE_GROUPSwith Entra,BYWARD_APP_CLIENT_IDS,BYWARD_ENTRA_CLIENT_IDandBYWARD_ENTRA_TENANT.BYWARD_GATE_GROUPS=contoso.comwith Entra, which--print-configloaded before, is now refused at load.
Upgrade: move a secret to its own setting's
_FILE. Give a role as the app role's value in Entra, and a tenant or group by its GUID. - With
Secrets, and settings for a mode that is off
- A secret given both inline and from its file is refused (#601). Before, the file was used and the inline value dropped in silence. The error is
BYWARD_X and BYWARD_X_FILE are both set; give one of them. Upgrade: remove the inline variable, or set it to nothing; keep the_FILEvariable or--x-fileflag. The file is the value byward already used, so nothing changes at run time. - A flag set to nothing for the upstream mode that is off is refused (#604). For example,
--stdio-max-processes=beside an HTTP upstream, or--upstream-header-timeout=beside a stdio command. The same setting set to nothing as a variable still loads. Upgrade: drop the flag. - A CIMD host list given as a flag set to nothing is refused while CIMD is off (#667).
--cimd-trusted-hosts=or--cimd-allowed-hosts=besideBYWARD_CIMD=falseused to load. It now gets--cimd-trusted-hosts has no effect while BYWARD_CIMD is false; remove one of them, as the app-only settings already did. A variable set to nothing still loads. Upgrade: drop the flag. BYWARD_IDENTITY_HEADERSbeside a stdio upstream is refused for any value,falseincluded (#627). A stdio upstream gets the user in its environment (BYWARD_SUBJECT). Upgrade: remove the setting, or leave it empty.
Sign-in, client registration and revoke-user
- A URL with a port and no host is refused everywhere a client or an IdP supplies one (#626). That covers a CIMD client ID and each
BYWARD_CLIENT_DENYLISTCIMD entry (https://:443/x), a redirect URI (https://:443/cb), an endpoint in an IdP's discovery document, and a client'sjwks_uri. None of these could have worked. A stored DCR registration with such ajwks_urinow loads as an unknown client, and that client registers again. - An OIDC IdP's endpoints are checked by the URL settings' rule (#674, #651). A discovery document is refused if its authorization or token endpoint, or its JWKS URI, has an IPv6 zone, user information, a port outside 1 to 65535, white space or a control or invisible character, or a fragment (RFC 6749 §3.1 and §3.2 forbid one on the two endpoints; byward refuses one on the JWKS URI too). A query is still kept, as Azure AD B2C's
?p=<policy>needs. Some refusals of an endpoint now name a different first rule broken:http://u:…@idp.example/tokenreads "holds a user name or password", not "must use https". Upgrade: fix the IdP's discovery document. - With an OIDC IdP, sign-in refuses a subject that breaks OIDC Core (#645, #594; thanks to @marcus-beauregard (#620)). Under
sub, a subject must be 1 to 255 printable ASCII characters (OIDC Core 1.0 §2 limits it to ASCII; byward also refuses control characters and DEL). Under any subject claim, one with white space at either end, a control character or invalid UTF-8 is refused. No conforming IdP sends one. Sign-in never trims a subject; it refuses one, sincealiceandaliceare two users. The refusal names the claim, and the value only by its length. Upgrade: none for a conforming IdP. If sign-in fails with this error, the message says which of two causes it is. For white space at either end or a control character, fix the value at the IdP. For asubthe spec forbids, fix it at the IdP, or key users on another claim withBYWARD_OIDC_SUBJECT_CLAIM. byward revoke-useruses the same user-key rule (#645). It takes exactly the keys sign-in can store, and trims what is pasted (alicefollowed by a newline namesalice). A key shaped like a credential is still revoked, but it is shown as "not shown", by its length, and audited as[REDACTED]. Upgrade: none. A key it now refuses could never have signed in.
Host and Origin matching
-
The internal listener refuses a Host header that names no host (#650, #644). That covers:
- a bracketed name or IPv4 address (
[mcp.example.com]:443,[127.0.0.1]:80); - a malformed bracketed IPv6 address;
- an unclosed or stray bracket;
- a port that isn't 1 to 5 digits.
Upgrade: have metrics scrapers and health probes send the address as written, such as
127.0.0.1:9090or[::1]:9090. - a bracketed name or IPv4 address (
-
The internal listener refuses a Host header that names an IPv6 address with a zone (#671, #652), such as
[fe80::1%eth0]:9090, with 421. Clients strip the zone before they send Host (RFC 6874), and every URL setting already refused one. Upgrade: send the address without its zone, such as[fe80::1]:9090. Kubelet and Prometheus send none. -
Not breaking: an Origin header matches in any spelling a browser produces (#639). That covers case, the IP address's spelling and the default port.
BYWARD_ALLOWED_ORIGINSentries need no change.
Refusal wording
Scripts or alerts that match on configuration errors need to follow these:
- Every refusal has one format (#574):
BYWARD_X: want …; got ….- A value refused for its form shows only its place, its length and a fixed reason.
- One refused for its meaning shows only what the parser read, such as a number as parsed or a reserved header's name.
- Command-line refusals show no text given: a stray argument and an undefined flag are shown by their length.
- A clash between two header settings names the two settings, never the header.
- Refusals say which part is wrong and give an example (#592). This covers URLs, durations, trusted proxies, header names and secret files.
- A setting given by flag is named by its flag (#633):
--listen: want …, notBYWARD_LISTEN: want …. A setting given by variable, or left at its default, is named as before. In the stdio refusals:- a command given after
--is namedthe command after --; - the env file is named only when one is given;
- an inline env under
--devis namedBYWARD_UPSTREAM_ENV.
- a command given after
- A setting refused for the upstream mode that is off gets that refusal alone (#637). Its value is not parsed and its secret file is not opened, so its follow-on errors are gone: a parse error, an empty-file error, "secrets must come from a file", or "cannot be combined with
BYWARD_INSECURE_NO_AUTH". Beside a stdio upstream, an unreadableBYWARD_UPSTREAM_CREDENTIAL_FILEorBYWARD_STORE_POSTGRES_DSN_FILEnow gives the refusal, not the read error. With several errors, their order can change. BYWARD_PUBLIC_URL's refusals of a bad port or a missing host give the URL example (#605, #616), andBYWARD_ALLOWED_ORIGINSsays "it has no host before its port".
Upgrade: match a refusal on the setting's name as the operator gave it (--x for a flag, BYWARD_X for a variable), and on the reason, not on the value.
Fixed
A value refused for its form is never printed, and a secret pasted into the wrong place stays hidden. This is the redesign v0.3.3 named as a known gap (#478, #485; ADR-0031):
- Every setting has a shape that decides how it is shown, and its text is an opaque value that every log and error shows only by its length (#498, #574).
--print-configquotes a value that holds a character that is not printable, so a newline in a setting can no longer forge a line (#518).byward initshows no argument or flag value it was given (#593).- A file that cannot be used is named by its setting and cause, never its path, at startup, in
check --offline,doctorand the operator commands (#586, #612). - A refused secret file is named by the flag or variable that gave it (#622).
byward revoke-usernames a refused key by its length, never its text (#620, #645).
stdio upstreams:
- A request that ends before its process answers, because the MCP client went away or byward is shutting down, is no longer logged as an upstream failure or answered 502 (#546, #560).
- The same holds while the stdio bridge is still reading the request body or waiting for the
server/discoverprobe: a client that went away is recorded as 499, not 400. A shutdown during the probe wait is answered 503 (retryable, connection closed). A shutdown doesn't yet cut a body upload that has stalled: that request waits out the shutdown grace and gets no answer, as in v0.3.3 (#697) (#672, #692). - A process that closed its stdin is stopped, not left holding its slot until the idle timeout (#566).
- A crash is logged as a crash, not as a stop byward chose (#588).
- Only an answered or timed-out
server/discoverprobe marks an upstream as not speaking the 2026-07-28 protocol, so a cancelled probe no longer caches that verdict for 10 minutes (#572). - A 2026-07-28 notification the process cannot take is logged, and a request that ended evicts no process (#559).
Relay and observability:
- A client that goes away before the HTTP upstream answers is recorded as 499, not logged as an upstream error and recorded as 502 (#528).
- A stream cut off after its headers now writes its request line, its metric and its span status (#565).
- A Unicode format character or other non-printable character in a JSON log line, such as U+202E RIGHT-TO-LEFT OVERRIDE in a user's
emailclaim, is now written as a\uXXXXescape. So it can no longer reorder or hide text when an operator reads the log in a terminal. The line decodes to the same value as before, so log pipelines see no change. Plain strings and the text format are unchanged (#690, #691).
Configuration and operator commands:
- A variable set to nothing is the same as unset for every setting, so an env template or Compose file that lists every variable starts (#591).
- A CIMD host list beside a
BYWARD_CIMDthat does not parse is no longer also refused as having no effect: the parse error comes alone, with the list's own form errors (#669). byward jwkswith a stdio upstream prints no keys and says why (#497), and no longer suggests a stdio command after--(#500).doctorno longer advises Entra token version 2 for a v2 token that fails byward's checks (#510).
Dependencies: github.com/go-jose/go-jose/v4 4.1.9 (#543), modernc.org/sqlite 1.62.0 (#544, #686), github.com/jackc/pgx/v5 5.13.0 (#680), golang.org/x/sys 0.50.0 (#681), and the distroless static-debian13 base image digest (#679).
Docs
- New guides: put the MongoDB MCP Server behind byward, verified with 3.3.0 (#519), and DBHub, verified with 2.0.0 (#525).
- New ADRs: ADR-0031, setting shapes for display and refusal (#496), and ADR-0032, one host rule (#526).
Every change runs CI: unit and integration tests, PostgreSQL 15 and 18, the MCP SDK clients (TypeScript, Python, Go), MCP Inspector and the MCP conformance authorization suite.
Upgrading
- Run the new version's
byward check --offlineagainst your configuration, and fix what it refuses, using the steps under Breaking changes. - If your
BYWARD_PUBLIC_URLhas:443or:80, register the redirect URI without the port before you change the setting (see above). - Replace the binary or the container image. No store migration runs: the SQLite schema stays at v8.
Install
docker pull ghcr.io/byward-dev/byward:v0.4.0latest now points at v0.4.0. Verify the release as in packaging.
Known gaps
- After
byward revoke-user, an app-only caller stays out only once the tokens it already holds expire (up to about an hour), because Entra keeps returning them. - A secret with no documented prefix, pasted into a setting that is not secret, is still accepted and shown (#628). The likeliest is an Entra client secret given as an app role value, which fits Graph's rule. A
BearerorBasiccredential without a JWT is not refused either (#657 decides whether it will be). A connection string in a list setting also passes when a comma splits its password and the part before the comma is all digits, so it reads as a port. The security posture names the settings. - A span limit
OTEL_*setting that is not a number is printed with its value by the OpenTelemetry SDK, even with tracing off. - stdio upstream processes share byward's uid (#182). The operator isolates them by host settings, or separate containers or VMs.
The security posture lists the rest.
MCP is a trademark of LF Projects, LLC. byward is an independent project.