Skip to content

v0.4.0

Choose a tag to compare

@github-actions github-actions released this 28 Nov 08:51
· 82 commits to main since this release
74556d6

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 as 127.0.0.1:80, or :0 for any free port.
  • Brackets only around an IPv6 address (#636). [1.2.3.4]:80, [my_mcp]:80 and []:80 are refused. They loaded with the brackets dropped, and []:80 listened on every interface. Upgrade: write 1.2.3.4:80 or my_mcp:80. For every interface, write :80 or 0.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 as ip link or ifconfig shows 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 in BYWARD_UPSTREAM_URL, BYWARD_RESOURCE_DOCUMENTATION and BYWARD_OIDC_ISSUER. Upgrade: give the real port, or leave it out for the scheme's default.
  • A port needs a host (#616). http://:9000/mcp and https://:443/realms/x are refused. Upgrade: write the host, such as BYWARD_UPSTREAM_URL=http://127.0.0.1:9000/mcp. An upstream written as http://:9000/… reached this machine, so 127.0.0.1 or localhost is what it meant.
  • Host names hold only ASCII letters, digits, -, . and _ (#615), and no label starts or ends with a hyphen (#632). This applies to BYWARD_PUBLIC_URL and to the host of BYWARD_UPSTREAM_URL. _ stays allowed, so a Compose service name such as http://my_mcp:8000/mcp still loads. Upgrade: write an internationalized name in its xn-- form.
  • An http BYWARD_OIDC_ISSUER must be on a loopback host as written (#592). localhost, LOCALHOST, 127.0.0.1 and [::1] count; 127.1 and localhost. 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_DOCUMENTATION and BYWARD_OIDC_ISSUER refuse an address with a %zone, which no URL a client follows carries, and which a dialer drops in silence. BYWARD_PUBLIC_URL and BYWARD_ALLOWED_ORIGINS already 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:

  1. Register the redirect URI without the port first (byward init entra --public-url prints it), then change the setting. Otherwise sign-in fails at the IdP.
  2. Old access tokens and pending authorization codes get 401 (invalid_token, with resource_metadata on the new URL).
  3. Refresh tokens keep working when they send no resource, or the new URL. One that sends the old URL gets 400 invalid_target and is not spent, and that user signs in again.
  4. A user who signs in again sees consent once.
  5. 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_HOSTS takes an IPv4 address only in dotted decimal (#639). 127.1, 0x7f.0.0.1, 2130706433 and 010.0.0.1 are refused. They were rewritten in silence, and 010.0.0.1 became 8.0.0.1. A name ending in a number (mcp.10, 10.0.0.999) is refused too. Upgrade: write 127.0.0.1, or 10.0.0.1 if that is what 010.0.0.1 meant, 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_HOSTS and BYWARD_CIMD_ALLOWED_HOSTS refuse 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_DENYLIST refuses 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 when claude.ai is 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 , in BYWARD_UPSTREAM_STRIP_HEADERS, BYWARD_OAUTH_RATE_LIMITS, BYWARD_TRUSTED_PROXIES, BYWARD_ALLOWED_HOSTS or BYWARD_ALLOWED_ORIGINS gets want at least one entry; got a list of none. Upgrade: give an entry, or leave the variable unset or empty.

  • BYWARD_SCOPE and each BYWARD_OIDC_SCOPES entry 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_CLAIM with white space at either end is refused (#574). A padded claim name never matched.

  • BYWARD_ENTRA_CLIENT_ID must 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_ID with 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: write BYWARD_ENTRA_CLIENT_ID in 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_HEADER and 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-config and 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 Bearer or Basic word in free text, such as BYWARD_SCOPE_DESCRIPTION="Basic read access to your dashboards". A Bearer value holding a JWT is still refused as a JWT. A word that starts with eyJ and is followed by a dot, such as eyJohn.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.
  • 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_ROLES and BYWARD_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 in BYWARD_APP_ROLES or BYWARD_GATE_ROLES must 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_GROUPS with Entra, BYWARD_APP_CLIENT_IDS, BYWARD_ENTRA_CLIENT_ID and BYWARD_ENTRA_TENANT. BYWARD_GATE_GROUPS=contoso.com with Entra, which --print-config loaded 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.

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 _FILE variable or --x-file flag. 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= beside BYWARD_CIMD=false used 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_HEADERS beside a stdio upstream is refused for any value, false included (#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_DENYLIST CIMD entry (https://:443/x), a redirect URI (https://:443/cb), an endpoint in an IdP's discovery document, and a client's jwks_uri. None of these could have worked. A stored DCR registration with such a jwks_uri now 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/token reads "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, since alice and alice are 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 a sub the spec forbids, fix it at the IdP, or key users on another claim with BYWARD_OIDC_SUBJECT_CLAIM.
  • byward revoke-user uses the same user-key rule (#645). It takes exactly the keys sign-in can store, and trims what is pasted (alice followed by a newline names alice). 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:9090 or [::1]:9090.

  • 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_ORIGINS entries 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 …, not BYWARD_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 named the command after --;
    • the env file is named only when one is given;
    • an inline env under --dev is named BYWARD_UPSTREAM_ENV.
  • 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 unreadable BYWARD_UPSTREAM_CREDENTIAL_FILE or BYWARD_STORE_POSTGRES_DSN_FILE now 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), and BYWARD_ALLOWED_ORIGINS says "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-config quotes a value that holds a character that is not printable, so a newline in a setting can no longer forge a line (#518).
  • byward init shows 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, doctor and the operator commands (#586, #612).
  • A refused secret file is named by the flag or variable that gave it (#622).
  • byward revoke-user names 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/discover probe: 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/discover probe 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 email claim, is now written as a \uXXXX escape. 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_CIMD that 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 jwks with a stdio upstream prints no keys and says why (#497), and no longer suggests a stdio command after -- (#500).
  • doctor no 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

  1. Run the new version's byward check --offline against your configuration, and fix what it refuses, using the steps under Breaking changes.
  2. If your BYWARD_PUBLIC_URL has :443 or :80, register the redirect URI without the port before you change the setting (see above).
  3. 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.0

latest 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 Bearer or Basic credential 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.