Repository navigation
feat(sdk): accept a localhost app origin in every environment - #1381
Merged
Merged
Conversation
A loopback HTTP origin (localhost, 127.0.0.1 or [::1], any port) is now an admissible application origin in LAB, staging and production. The SDK accepts it for the declaration, storage, assets and return URL; the server registers and pairs a manifest whose homepage is that origin; the approval screen describes it as an app running on this computer with an unverified identity. Connect's own origins stay HTTPS outside LAB and local builds. This replaces the native-platform 127.0.0.1 special case and removes MDBASE_CONNECT_ALLOW_INSECURE_MANIFESTS, allowNativeLoopbackHttp and the platform argument that carried it. Also let the npm-installed SDK start under a development server: a version query on the SDK's module URL no longer makes it refuse its packaged files.
…est apps The provider system suite registers its applications on loopback origins. The approval screen now presents every loopback application as an unverified app on this computer, so assert that heading and the note naming the app.
Contributor
Author
|
CI caught one failure from this change: the provider system suite registers its test apps on loopback origins and asserted the approval heading was the app's name. Updated the two assertions to the local-app identity (heading, origin line and the note naming the app). |
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.
Summary
Lets an outside developer build an app on
http://localhostagainst production (or staging), with no flag, allowlist entry or separate SDK build.A loopback HTTP origin (
http://localhost:<port>,http://127.0.0.1:<port>,http://[::1]:<port>) is now an admissible application origin in every environment. Connect's own origins (control plane, log, portal) stay HTTPS outside LAB and isolated local builds. No other plain-HTTP origin is an application origin anywhere.What changes
isLoopbackHttpOrigin, used by the SDK and the server.origin, storage, asset and return-URL checks accept a loopback application origin in every environment.selectAppEnvironmentstill requires HTTPS for the control plane and log outside LAB/local builds.POST /v1/apps/register,/v1/apps/validateand installation pairing START parse manifests with loopback allowed. Pairing accepts a loopback origin only when it is the origin the manifest's homepage or redirect URIs declare. A loopback origin listed only underinstallation_originsis still refused in staging and production.connect-devvalidate-manifeststays strict unless--allow-localis passed, so a loopback homepage in a production manifest is caught before it ships.Also fixed, because it blocked the same developer: the npm-installed SDK failed under
vite devwith "The app couldn't load" (application_packaged_assets_unavailable). Vite serves the SDK's module with a?v=<hash>query andpackagedApplicationAssetsrefused any module URL with a query. First-party apps link the workspace package and never met it. The query is now ignored; the files resolve beside the module on the app's origin and their bytes are still checked against the packaged pins.Replaced and deleted
MDBASE_CONNECT_ALLOW_INSECURE_MANIFESTSis removed from the server, compose files and scripts. The server always parses with loopback allowed.allowNativeLoopbackHttpoption and theplatformargument toselectAppEnvironment/packagedApplicationAssetsare removed. Storage modules no longer takeallowLoopbackHttpfor the application origin; it remains only where it relaxes HTTPS for Connect's own origins in LAB.Net: 86 files, +402 / −300, most of it deleting the parameter plumbing.
Why this is safe
Origin, and requesting or framing a loopback URL does not transfer that origin or its storage. The party that can serve a loopback origin is a program already running on the person's computer.http://127.0.0.1:<port>for manifests declaringplatform: "native". This extends the same admission tolocalhostand[::1]and to web declarations, and requires the origin to be the one the manifest declares.A development manifest (loopback homepage) and the published manifest (HTTPS homepage) are separate registered applications, so approvals and device storage made on localhost stay on localhost.
Full write-up:
docs/local-app-development.md.Checks
pnpm ci:local(native plan): all node gates (lint, typecheck, unit tests, package audit, builds, architecture, public API inventories),cargo fmt --check, the feature check,clippy -D warningsand the CI script tests pass.ci:localrun of this gate stalled linking on the build VM and was stopped. Rerun on its own asrcargo test --locked --workspace --no-fail-fast -j 8: 806 passed, 0 failed, 189 ignored. No Rust source changes in this PR.pnpm e2e(runtime daemon request path): pass.pnpm check:changelog: pass.vite devandvite buildonhttp://localhost, up to the signed-out and work-before-connecting screens.Not exercised: a real sign-in from
http://localhostagainst production or staging, which needs this change deployed. The server-side registration and pairing paths are covered by the Postgres-backed tests inservices/server.Follow-ups (not in this PR)
mdbase-cloud-opsrender.yamlstill setsMDBASE_CONNECT_ALLOW_INSECURE_MANIFESTS. The server now ignores it; the line can go.test/upgrade/server-retained-v2.shstill passes the flag, deliberately: it starts the retained old image, which reads it.app_platform/platformresponse fields are no longer read by the portal.