fix(adapters): reject createApp({ tls }) on Deno and Bun
Only Node's listen() reads tls. serveDeno and serveBun serve through the runtime's own listener, so an app created with tls came up as plain HTTP without warning, for a caller who had asked for HTTPS. createApp now marks the app with a symbol, following the MARK_EDGE pattern. Both adapters throw on that mark before they boot or bind. Signed-off-by: Diego Resendez <diego.resendez@zero-oneit.com>
This commit is contained in:
3 files changed
+51
-1
No files matched your search
+4
-1
@@ -45,7 +45,7 @@ import { getArgs, getHandlerNeeds, resolveArgs } from '../params';
|
||||
import { buildOpenApi, type OpenApiInfo } from '../openapi';
|
||||
import { connectLink, isPermanentRefusal, type Link } from '../mesh/link';
|
||||
import { Rooms } from '../rooms';
|
||||
import type { TlsOptions, SecurityOptions, CorsOptions } from '../security';
|
||||
import { TLS_REQUESTED, type TlsOptions, type SecurityOptions, type CorsOptions } from '../security';
|
||||
import { buildRemote, type RemoteRoute as TeacupRemoteRoute } from '../mesh/teacup';
|
||||
import {
|
||||
buildManifest,
|
||||
@@ -533,6 +533,9 @@ export function createApp(opts: AppOptions): App {
|
||||
|
||||
// `edgeHandler` calls this: on the edge core never encodes, whatever detection concluded.
|
||||
[MARK_EDGE]: edgeMarker(compression),
|
||||
|
||||
// `serveDeno` and `serveBun` refuse an app that asked for TLS only Node's listener can give.
|
||||
[TLS_REQUESTED]: Boolean(opts.tls),
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user