Skip to content

fix: stop a prod start when Studio, Keycloak or Sentry is not https - #223

Merged
cevheri merged 7 commits into
mainfrom
fix/218-prod-https-only
Oct 24, 2026
Merged

cevheri merged 7 commits into
mainfrom
fix/218-prod-https-only

Conversation

@cevheri

@cevheri cevheri commented Oct 24, 2026 •

Copy link
Copy Markdown
Member

A prod build now stops at start with ProdHttpsConfigError when PROD_API_URL, OIDC_ISSUER or a set SENTRY_DSN is not an https URL. The error names only the define, never the value. An http issuer on loopback is refused in prod too. Dev and test builds (main_local.dart) check nothing, and tool/studio-dev's https values pass.

tool/release/check_defines.sh applies the same rule before the build, so release.yml stops before anything is signed or uploaded.

One pattern, AppConfig.httpsUrlPattern, runs in Dart, in NativeSentry.requireHttpsDsn and in the release script, and an architecture test checks the copies match. OIDC_ISSUER is trimmed the way the sign-in reads it. PROD_API_URL and SENTRY_DSN are refused if they have leading or trailing whitespace.

Native Sentry: NativeSentry.kt reads BuildConfig.SENTRY_DSN itself and starts before the Flutter engine, so it has its own check, with JVM tests.

OidcClient refuses a discovery document whose authorization, pushed authorization, token, JWKS or end-session endpoint is not https. In that case:

  • a sign-in fails with OidcFailure.insecureEndpoint, shown as auth.oidc_config
  • a refresh keeps the session and sends nothing
  • the provider logout does not open
  • every log line names only the endpoint's key

The OpenID Connect client follows no redirect either. A 3xx to discovery or the JWKS fails the sign-in, and the log names only the request's role.

ApiClient follows no redirect. Studio's API never redirects, so a 3xx fails through studioError and nothing is sent to the Location, including on a retry.

docs/security.md has a new "Encryption in transit" section, and the docs/release.md Data safety row points to it.

Closes #218

@cevheri
cevheri force-pushed the fix/218-prod-https-only branch 2 times, most recently from bc126f9 to 391e70c Compare October 24, 2026 18:22
A prod build now refuses a PROD_API_URL, OIDC_ISSUER or set SENTRY_DSN that is not an https URL with
ProdHttpsConfigError, which names only the define. NativeSentry refuses a non-https DSN before the
Flutter engine starts. The release guard fails when the release passes a URL define left unchecked.
…k or Sentry URL

tool/release/check_defines.sh now refuses a PROD_API_URL, OIDC_ISSUER or set SENTRY_DSN that is not an
https URL, the rule of a prod start, naming the variable and never its value, so nothing is signed or
uploaded with an http value.
… not https

OidcClient now checks authorization_endpoint, token_endpoint, jwks_uri and end_session_endpoint after
discovery and sends nothing to one that is not an https URL with a host: a sign-in fails with
OidcFailure.insecureEndpoint (auth.oidc_config), a refresh keeps the session, a logout is not opened,
and the log names only the endpoint's key. Only an http issuer, never in a prod build, may name http
endpoints on its own host.
AppConfig.httpsUrlPattern is the rule of a prod start, NativeSentry.requireHttpsDsn and
tool/release/check_defines.sh, so an underscore host or an IPv6 literal passes everywhere. OIDC_ISSUER
is trimmed as the sign-in reads it; PROD_API_URL and SENTRY_DSN are refused with surrounding whitespace.
The build-defines test uses the same predicate.
… in every log

The package sends the authorization request to pushed_authorization_request_endpoint first when
discovery requires it, so it joins the endpoints that must be https. The refresh and logout logs now
name the refused endpoint's key as the sign-in does.
Studio's API never redirects, so ApiClient turns redirects off and a 3xx fails through studioError
instead of sending the request, or a retry, to the Location.
@cevheri
cevheri force-pushed the fix/218-prod-https-only branch from 391e70c to b9cd2c9 Compare October 24, 2026 18:44
oidc_core takes any status under 400 as success, and package:http followed a 302 from the https issuer
to plain http for discovery and the JWKS. The provider client now turns redirects off and fails a 3xx
with OidcRedirectRefusedException, logging only the request's role.
@cevheri
cevheri merged commit 18e81b9 into main Oct 24, 2026
6 checks passed
@cevheri
cevheri deleted the fix/218-prod-https-only branch October 24, 2026 19:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Stop a prod build at start when Studio, Keycloak or Sentry is not https

1 participant