Repository navigation
fix: stop a prod start when Studio, Keycloak or Sentry is not https - #223
Merged
Merged
Conversation
cevheri
force-pushed
the
fix/218-prod-https-only
branch
2 times, most recently
from
October 24, 2026 18:22
bc126f9 to
391e70c
Compare
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
force-pushed
the
fix/218-prod-https-only
branch
from
October 24, 2026 18:44
391e70c to
b9cd2c9
Compare
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A prod build now stops at start with
ProdHttpsConfigErrorwhenPROD_API_URL,OIDC_ISSUERor a setSENTRY_DSNis 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.shapplies the same rule before the build, so release.yml stops before anything is signed or uploaded.One pattern,
AppConfig.httpsUrlPattern, runs in Dart, inNativeSentry.requireHttpsDsnand in the release script, and an architecture test checks the copies match.OIDC_ISSUERis trimmed the way the sign-in reads it.PROD_API_URLandSENTRY_DSNare refused if they have leading or trailing whitespace.Native Sentry:
NativeSentry.ktreadsBuildConfig.SENTRY_DSNitself and starts before the Flutter engine, so it has its own check, with JVM tests.OidcClientrefuses a discovery document whose authorization, pushed authorization, token, JWKS or end-session endpoint is not https. In that case:OidcFailure.insecureEndpoint, shown asauth.oidc_configThe 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.
ApiClientfollows no redirect. Studio's API never redirects, so a 3xx fails throughstudioErrorand nothing is sent to theLocation, 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