dsh-auth-remote 0.1.5 → 0.1.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +8 -0
- package/CHANGELOG.zh-CN.md +8 -0
- package/CONTRIBUTING.md +2 -0
- package/CONTRIBUTING.zh-CN.md +2 -0
- package/README.md +16 -10
- package/README.zh-CN.md +16 -10
- package/cordis.patch.yml +4 -5
- package/dist/client.js +2 -2
- package/dist/client.js.map +2 -2
- package/dist/index.js +280 -87
- package/dist/index.js.map +4 -4
- package/dist/types/adapters/dsh/browser-auth.d.ts +3 -0
- package/dist/types/adapters/dsh/browser-auth.d.ts.map +1 -1
- package/dist/types/adapters/dsh/public-url.d.ts +10 -0
- package/dist/types/adapters/dsh/public-url.d.ts.map +1 -0
- package/dist/types/adapters/dsh/readiness.d.ts +2 -3
- package/dist/types/adapters/dsh/readiness.d.ts.map +1 -1
- package/dist/types/adapters/dsh/runtime-capabilities.d.ts +46 -0
- package/dist/types/adapters/dsh/runtime-capabilities.d.ts.map +1 -0
- package/dist/types/adapters/dsh/startup-urls.d.ts +2 -2
- package/dist/types/adapters/dsh/startup-urls.d.ts.map +1 -1
- package/dist/types/adapters/dsh/webserver.d.ts +8 -2
- package/dist/types/adapters/dsh/webserver.d.ts.map +1 -1
- package/dist/types/config.d.ts +48 -14
- package/dist/types/config.d.ts.map +1 -1
- package/dist/types/http/gate.d.ts +1 -2
- package/dist/types/http/gate.d.ts.map +1 -1
- package/dist/types/index.d.ts +6 -2
- package/dist/types/index.d.ts.map +1 -1
- package/docs/deployment.md +83 -38
- package/docs/deployment.zh-CN.md +84 -39
- package/docs/development.md +9 -5
- package/docs/development.zh-CN.md +9 -5
- package/docs/legacy-compatibility.md +115 -0
- package/docs/releasing.md +7 -5
- package/docs/releasing.zh-CN.md +7 -5
- package/docs/reverse-proxy.md +7 -5
- package/docs/reverse-proxy.zh-CN.md +7 -5
- package/examples/web-profile-auth-remote.patch.yml +7 -3
- package/package.json +9 -8
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import type { HostConnectionHandle } from '@deepseek-ai/dsh-client-connection';
|
|
2
|
+
import type { OriginProtocol } from '../../http/origin-policy.js';
|
|
2
3
|
/** Host-only bridge to the public Connection token exchange. */
|
|
3
4
|
export declare class NativeBrowserAuth {
|
|
5
|
+
private readonly protocol;
|
|
4
6
|
private readonly cookies;
|
|
7
|
+
constructor(protocol?: OriginProtocol);
|
|
5
8
|
cookieFor(connection: HostConnectionHandle, authority: string, origin: string, now?: number): string;
|
|
6
9
|
clear(connection: HostConnectionHandle): void;
|
|
7
10
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"browser-auth.d.ts","sourceRoot":"","sources":["../../../../src/adapters/dsh/browser-auth.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,oCAAoC,CAAA;
|
|
1
|
+
{"version":3,"file":"browser-auth.d.ts","sourceRoot":"","sources":["../../../../src/adapters/dsh/browser-auth.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,oCAAoC,CAAA;AAC9E,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAA;AAOjE,gEAAgE;AAChE,qBAAa,iBAAiB;IAGhB,OAAO,CAAC,QAAQ,CAAC,QAAQ;IAFrC,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAiE;gBAE5D,QAAQ,GAAE,cAAwB;IAE/D,SAAS,CACP,UAAU,EAAE,oBAAoB,EAChC,SAAS,EAAE,MAAM,EACjB,MAAM,EAAE,MAAM,EACd,GAAG,SAAa,GACf,MAAM;IAuBT,KAAK,CAAC,UAAU,EAAE,oBAAoB,GAAG,IAAI;CAG9C"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { type OriginProtocol } from '../../http/origin-policy.js';
|
|
2
|
+
export interface RootPublicUrl {
|
|
3
|
+
readonly url: string;
|
|
4
|
+
readonly origin: string;
|
|
5
|
+
}
|
|
6
|
+
/** Validate raw input before URL normalization can hide paths or authority aliases. */
|
|
7
|
+
export declare function parsePublicUrl(value: string): RootPublicUrl;
|
|
8
|
+
/** A configured zero port is never an advertised port: finalize after listening. */
|
|
9
|
+
export declare function listenerPublicUrl(host: string, port: number, protocol: OriginProtocol): string;
|
|
10
|
+
//# sourceMappingURL=public-url.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"public-url.d.ts","sourceRoot":"","sources":["../../../../src/adapters/dsh/public-url.ts"],"names":[],"mappings":"AACA,OAAO,EAAsB,KAAK,cAAc,EAAE,MAAM,6BAA6B,CAAA;AAErF,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAA;IACpB,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAA;CACxB;AAED,uFAAuF;AACvF,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,GAAG,aAAa,CAe3D;AAED,oFAAoF;AACpF,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,cAAc,GAAG,MAAM,CAQ9F"}
|
|
@@ -4,13 +4,12 @@ import type { ResolvedAuthConfig } from '../../config.js';
|
|
|
4
4
|
import type { GuardedWebServer } from './webserver.js';
|
|
5
5
|
/** Connection availability and the native authorities used by the bridge. */
|
|
6
6
|
export declare class DshReadiness {
|
|
7
|
-
private readonly server;
|
|
8
7
|
private readonly config;
|
|
9
8
|
private readonly onUnavailable;
|
|
10
9
|
private readonly native;
|
|
11
10
|
private connection;
|
|
12
11
|
private isReady;
|
|
13
|
-
constructor(
|
|
12
|
+
constructor(_server: GuardedWebServer, config: ResolvedAuthConfig, onUnavailable?: () => void);
|
|
14
13
|
ready(): boolean;
|
|
15
14
|
currentConnection(): HostConnectionHandle | undefined;
|
|
16
15
|
attach(connection: HostConnectionHandle, profileAnchor?: string): void;
|
|
@@ -18,5 +17,5 @@ export declare class DshReadiness {
|
|
|
18
17
|
detach(connection?: HostConnectionHandle): void;
|
|
19
18
|
}
|
|
20
19
|
/** Dynamic injection avoids waiting for Connection before supplying WebServer. */
|
|
21
|
-
export declare function watchConnection(ctx: Context, readiness: DshReadiness, onReady?: () => void): void;
|
|
20
|
+
export declare function watchConnection(ctx: Context, readiness: DshReadiness, onReady?: () => void, onFailure?: (error: unknown) => Promise<void>): void;
|
|
22
21
|
//# sourceMappingURL=readiness.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"readiness.d.ts","sourceRoot":"","sources":["../../../../src/adapters/dsh/readiness.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAA;AAClD,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,oCAAoC,CAAA;AAC9E,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAA;AAGzD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAA;AAEtD,6EAA6E;AAC7E,qBAAa,YAAY;
|
|
1
|
+
{"version":3,"file":"readiness.d.ts","sourceRoot":"","sources":["../../../../src/adapters/dsh/readiness.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAA;AAClD,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,oCAAoC,CAAA;AAC9E,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAA;AAGzD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAA;AAEtD,6EAA6E;AAC7E,qBAAa,YAAY;IAOrB,OAAO,CAAC,QAAQ,CAAC,MAAM;IACvB,OAAO,CAAC,QAAQ,CAAC,aAAa;IAPhC,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAmB;IAC1C,OAAO,CAAC,UAAU,CAAkC;IACpD,OAAO,CAAC,OAAO,CAAQ;gBAGrB,OAAO,EAAE,gBAAgB,EACR,MAAM,EAAE,kBAAkB,EAC1B,aAAa,GAAE,MAAM,IAAe;IAKvD,KAAK,IAAI,OAAO;IAIhB,iBAAiB,IAAI,oBAAoB,GAAG,SAAS;IAIrD,MAAM,CAAC,UAAU,EAAE,oBAAoB,EAAE,aAAa,CAAC,EAAE,MAAM,GAAG,IAAI;IAgBtE,YAAY,CAAC,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM;IAMvD,MAAM,CAAC,UAAU,CAAC,EAAE,oBAAoB,GAAG,IAAI;CAUhD;AAED,kFAAkF;AAClF,wBAAgB,eAAe,CAC7B,GAAG,EAAE,OAAO,EACZ,SAAS,EAAE,YAAY,EACvB,OAAO,GAAE,MAAM,IAAe,EAC9B,SAAS,GAAE,CAAC,KAAK,EAAE,OAAO,KAAK,OAAO,CAAC,IAAI,CAAkB,GAC5D,IAAI,CAiBN"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import type { OriginProtocol } from '../../http/origin-policy.js';
|
|
2
|
+
export interface RuntimeCapabilities {
|
|
3
|
+
readonly version: string;
|
|
4
|
+
readonly publicUrl: boolean;
|
|
5
|
+
readonly nativeTransport: boolean;
|
|
6
|
+
}
|
|
7
|
+
export interface NativeListenerConfig {
|
|
8
|
+
host: string;
|
|
9
|
+
port: number;
|
|
10
|
+
tls?: {
|
|
11
|
+
certFile: string;
|
|
12
|
+
keyFile: string;
|
|
13
|
+
};
|
|
14
|
+
compression?: 'none' | 'gzip';
|
|
15
|
+
compressionLevel?: number;
|
|
16
|
+
compressionThresholdBytes?: number;
|
|
17
|
+
}
|
|
18
|
+
interface NativeApi {
|
|
19
|
+
default: {
|
|
20
|
+
Config?: (input: NativeListenerConfig) => unknown;
|
|
21
|
+
prototype: object;
|
|
22
|
+
};
|
|
23
|
+
isLoopbackHost?: (host: string) => boolean;
|
|
24
|
+
isWildcardHost?: (host: string) => boolean;
|
|
25
|
+
normalizeBindAddress?: (host: string) => string;
|
|
26
|
+
}
|
|
27
|
+
/** Version admission and API verification remain separate checks. */
|
|
28
|
+
export declare function getRuntimeCapabilities(version: string): RuntimeCapabilities;
|
|
29
|
+
/** Old packages can load this module: new exports are only read on the native branch. */
|
|
30
|
+
export declare function validateListenerConfig(capabilities: RuntimeCapabilities, config: NativeListenerConfig, native?: NativeApi): NativeListenerConfig;
|
|
31
|
+
/** Older WebServer has no protocol getter; modern missing/invalid getters fail closed. */
|
|
32
|
+
export declare function listenerProtocol(server: {
|
|
33
|
+
readonly protocol?: string;
|
|
34
|
+
}, capabilities: RuntimeCapabilities): OriginProtocol;
|
|
35
|
+
/** Match Connection's bind-authority URL rules, including mapped/scoped IPv6. */
|
|
36
|
+
export declare function listenerTransport(actual: {
|
|
37
|
+
host: string;
|
|
38
|
+
port: number;
|
|
39
|
+
protocol: OriginProtocol;
|
|
40
|
+
}, capabilities: RuntimeCapabilities): {
|
|
41
|
+
authority: string;
|
|
42
|
+
origin: string;
|
|
43
|
+
loopback: boolean;
|
|
44
|
+
};
|
|
45
|
+
export {};
|
|
46
|
+
//# sourceMappingURL=runtime-capabilities.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runtime-capabilities.d.ts","sourceRoot":"","sources":["../../../../src/adapters/dsh/runtime-capabilities.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAA;AAGjE,MAAM,WAAW,mBAAmB;IAClC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;IACxB,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAA;IAC3B,QAAQ,CAAC,eAAe,EAAE,OAAO,CAAA;CAClC;AAED,MAAM,WAAW,oBAAoB;IACnC,IAAI,EAAE,MAAM,CAAA;IACZ,IAAI,EAAE,MAAM,CAAA;IACZ,GAAG,CAAC,EAAE;QAAE,QAAQ,EAAE,MAAM,CAAC;QAA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1
1
|
import type { ResolvedAuthConfig } from '../../config.js';
|
|
2
|
-
/**
|
|
3
|
-
export declare function startupLines(profile: string, config: ResolvedAuthConfig
|
|
2
|
+
/** The listener and one distinct public root, with no native token or login path. */
|
|
3
|
+
export declare function startupLines(profile: string, config: ResolvedAuthConfig): string[];
|
|
4
4
|
//# sourceMappingURL=startup-urls.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"startup-urls.d.ts","sourceRoot":"","sources":["../../../../src/adapters/dsh/startup-urls.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAA;AAEzD,
|
|
1
|
+
{"version":3,"file":"startup-urls.d.ts","sourceRoot":"","sources":["../../../../src/adapters/dsh/startup-urls.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAA;AAEzD,qFAAqF;AACrF,wBAAgB,YAAY,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,kBAAkB,GAAG,MAAM,EAAE,CAKlF"}
|
|
@@ -2,7 +2,8 @@ import type { IncomingMessage, ServerResponse } from 'node:http';
|
|
|
2
2
|
import type { Duplex } from 'node:stream';
|
|
3
3
|
import type { Context } from '@deepseek-ai/cordis';
|
|
4
4
|
import WebServer, { type WebRoute, type WebUpgradeRoute } from '@deepseek-ai/dsh-host-webserver';
|
|
5
|
-
import type {
|
|
5
|
+
import type { NativeListenerConfig } from './runtime-capabilities.js';
|
|
6
|
+
import { type OriginPolicy } from '../../http/origin-policy.js';
|
|
6
7
|
export declare const READY_PATH = "/auth-remote/ready";
|
|
7
8
|
export declare const READY_PROTOCOL_VERSION = 1;
|
|
8
9
|
/** A gate owns admission and then calls the official route exactly once. */
|
|
@@ -28,7 +29,12 @@ export declare class SwitchGate implements WebGate {
|
|
|
28
29
|
/** Wrap only public WebServer registration methods; its routing and IO stay official. */
|
|
29
30
|
export declare class GuardedWebServer extends WebServer {
|
|
30
31
|
private readonly gate;
|
|
31
|
-
|
|
32
|
+
private originPolicy;
|
|
33
|
+
constructor(ctx: Context, config: NativeListenerConfig & {
|
|
34
|
+
originPolicy?: OriginPolicy;
|
|
35
|
+
}, gate?: WebGate);
|
|
36
|
+
/** Ready and the authenticated gate consume the same listener-finalized policy. */
|
|
37
|
+
protected setOriginPolicy(policy: OriginPolicy): void;
|
|
32
38
|
register(route: WebRoute): () => void;
|
|
33
39
|
registerFallback(handler: WebRoute['handler']): () => void;
|
|
34
40
|
registerUpgrade(route: WebUpgradeRoute): () => void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webserver.d.ts","sourceRoot":"","sources":["../../../../src/adapters/dsh/webserver.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,WAAW,CAAA;AAChE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AACzC,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAA;AAClD,OAAO,SAAS,EAAE,EAEhB,KAAK,QAAQ,EACb,KAAK,eAAe,EACrB,MAAM,iCAAiC,CAAA;AACxC,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"webserver.d.ts","sourceRoot":"","sources":["../../../../src/adapters/dsh/webserver.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,WAAW,CAAA;AAChE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AACzC,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAA;AAClD,OAAO,SAAS,EAAE,EAEhB,KAAK,QAAQ,EACb,KAAK,eAAe,EACrB,MAAM,iCAAiC,CAAA;AACxC,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAA;AACrE,OAAO,EAAyB,KAAK,YAAY,EAAE,MAAM,6BAA6B,CAA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SAAS;IAM3C,OAAO,CAAC,QAAQ,CAAC,IAAI;IALvB,OAAO,CAAC,YAAY,CAA0B;gBAG5C,GAAG,EAAE,OAAO,EACZ,MAAM,EAAE,oBAAoB,GAAG;QAAE,YAAY,CAAC,EAAE,YAAY,CAAA;KAAE,EAC7C,IAAI,GAAE,OAAwB;IA+CjD,mFAAmF;IACnF,SAAS,CAAC,eAAe,CAAC,MAAM,EAAE,YAAY,GAAG,IAAI;IAI5C,QAAQ,CAAC,KAAK,EAAE,QAAQ,GAAG,MAAM,IAAI;IAQrC,gBAAgB,CAAC,OAAO,EAAE,QAAQ,CAAC,SAAS,CAAC,GAAG,MAAM,IAAI;IAM1D,eAAe,CAAC,KAAK,EAAE,eAAe,GAAG,MAAM,IAAI;CAS7D"}
|
package/dist/types/config.d.ts
CHANGED
|
@@ -1,27 +1,61 @@
|
|
|
1
|
-
import type { Config as WebServerConfig } from '@deepseek-ai/dsh-host-webserver';
|
|
2
1
|
import z from '@deepseek-ai/schemastery';
|
|
3
|
-
import { type
|
|
2
|
+
import { type RootPublicUrl } from './adapters/dsh/public-url.js';
|
|
3
|
+
import { type RuntimeCapabilities, type NativeListenerConfig } from './adapters/dsh/runtime-capabilities.js';
|
|
4
|
+
import { type OriginPolicy, type OriginProtocol } from './http/origin-policy.js';
|
|
4
5
|
export interface AuthConfig {
|
|
5
|
-
|
|
6
|
+
publicUrl?: string;
|
|
7
|
+
host?: string;
|
|
8
|
+
port?: number;
|
|
9
|
+
tlsCert?: string;
|
|
10
|
+
tlsKey?: string;
|
|
11
|
+
allowedOrigins?: string[] | undefined;
|
|
6
12
|
requireTotp?: boolean;
|
|
7
13
|
sessionHours?: number;
|
|
8
14
|
preserveOriginPaths?: string[];
|
|
9
15
|
}
|
|
10
|
-
export interface ResolvedAuthConfig extends Omit<
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
16
|
+
export interface ResolvedAuthConfig extends Omit<PendingAuthConfig, 'publicUrl'> {
|
|
17
|
+
readonly publicUrl: string;
|
|
18
|
+
readonly listenerUrl: string;
|
|
19
|
+
readonly protocol: OriginProtocol;
|
|
20
|
+
readonly nativeAuthority: string;
|
|
21
|
+
readonly nativeOrigin: string;
|
|
22
|
+
readonly allowedOrigins: readonly string[];
|
|
23
|
+
readonly originPolicy: OriginPolicy;
|
|
17
24
|
}
|
|
18
25
|
export declare const DEFAULT_REQUIRE_TOTP = true;
|
|
19
26
|
export declare const DEFAULT_SESSION_HOURS = 168;
|
|
20
27
|
export declare const DEFAULT_WEB_HOST = "127.0.0.1";
|
|
21
28
|
export declare const DEFAULT_WEB_PORT = 3080;
|
|
22
|
-
export interface WebListenerConfig extends Omit<WebServerConfig, 'host'> {
|
|
23
|
-
host: string;
|
|
24
|
-
}
|
|
25
29
|
export declare const Config: z<AuthConfig>;
|
|
26
|
-
export
|
|
30
|
+
export interface WebStartupConfig {
|
|
31
|
+
host?: string;
|
|
32
|
+
port?: number;
|
|
33
|
+
publicUrl?: string;
|
|
34
|
+
tls?: {
|
|
35
|
+
certFile?: string;
|
|
36
|
+
keyFile?: string;
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
export interface PendingAuthConfig extends NativeListenerConfig {
|
|
40
|
+
readonly capabilities: RuntimeCapabilities;
|
|
41
|
+
readonly publicUrl: RootPublicUrl | undefined;
|
|
42
|
+
readonly publicUrlSource: 'cli' | 'file' | 'legacy' | 'derived';
|
|
43
|
+
readonly tlsSource: 'cli' | 'file' | undefined;
|
|
44
|
+
readonly legacyWarning: boolean;
|
|
45
|
+
readonly requireTotp: boolean;
|
|
46
|
+
readonly sessionHours: number;
|
|
47
|
+
readonly preserveOriginPaths: readonly string[];
|
|
48
|
+
}
|
|
49
|
+
/** Resolve effective inputs without reading certificates or constructing a source policy. */
|
|
50
|
+
export declare function resolveStartupConfig(input: AuthConfig, startup: WebStartupConfig, context: {
|
|
51
|
+
version: string;
|
|
52
|
+
profileDir: string;
|
|
53
|
+
cwd: string;
|
|
54
|
+
}): PendingAuthConfig;
|
|
55
|
+
/** Finalize exactly one source policy after the official listener reports its bound port. */
|
|
56
|
+
export declare function finalizeAuthConfig(pending: PendingAuthConfig, actual: {
|
|
57
|
+
host: string;
|
|
58
|
+
port: number;
|
|
59
|
+
protocol: OriginProtocol;
|
|
60
|
+
}): ResolvedAuthConfig;
|
|
27
61
|
//# sourceMappingURL=config.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,CAAC,MAAM,0BAA0B,CAAA;AAGxC,OAAO,EAAqC,KAAK,aAAa,EAAE,MAAM,8BAA8B,CAAA;AACpG,OAAO,EAIL,KAAK,mBAAmB,EACxB,KAAK,oBAAoB,EAC1B,MAAM,wCAAwC,CAAA;AAC/C,OAAO,EAAsB,KAAK,YAAY,EAAE,KAAK,cAAc,EAAE,MAAM,yBAAyB,CAAA;AAEpG,MAAM,WAAW,UAAU;IACzB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,cAAc,CAAC,EAAE,MAAM,EAAE,GAAG,SAAS,CAAA;IACrC,WAAW,CAAC,EAAE,OAAO,CAAA;IACrB,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,mBAAmB,CAAC,EAAE,MAAM,EAAE,CAAA;CAC/B;AAED,MAAM,WAAW,kBAAmB,SAAQ,IAAI,CAAC,iBAAiB,EAAE,WAAW,CAAC;IAC9E,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAA;IAC1B,QAAQ,CAAC,WAAW,EAA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F,wBAAgB,oBAAoB,CAClC,KAAK,EAAE,UAAU,EACjB,OAAO,EAAE,gBAAgB,EACzB,OAAO,EAAE;IAAE,OAAO,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAA;CAAE,GAC5D,iBAAiB,CA8EnB;AAED,6FAA6F;AAC7F,wBAAgB,kBAAkB,CAChC,OAAO,EAAE,iBAAiB,EAC1B,MAAM,EAAE;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,cAAc,CAAA;CAAE,GAC/D,kBAAkB,CAkCpB"}
|
|
@@ -8,13 +8,12 @@ import { AuthStateStore } from '../storage/store.js';
|
|
|
8
8
|
import { AuthConnections } from './connections.js';
|
|
9
9
|
/** Validates the public request before rewriting only the admitted business carrier. */
|
|
10
10
|
export declare class AuthGate implements WebGate {
|
|
11
|
-
private readonly serverPort;
|
|
12
11
|
private readonly config;
|
|
13
12
|
private readonly store;
|
|
14
13
|
private readonly auth;
|
|
15
14
|
private readonly readiness;
|
|
16
15
|
private readonly connections;
|
|
17
|
-
constructor(
|
|
16
|
+
constructor(config: ResolvedAuthConfig, store: AuthStateStore, auth: AuthService, readiness: DshReadiness, connections: AuthConnections);
|
|
18
17
|
ready(): boolean;
|
|
19
18
|
http(req: IncomingMessage, res: ServerResponse, next: () => Promise<void>): Promise<void>;
|
|
20
19
|
upgrade(req: IncomingMessage, socket: Duplex, _head: Buffer, next: () => Promise<void>): Promise<void>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gate.d.ts","sourceRoot":"","sources":["../../../src/http/gate.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,WAAW,CAAA;AAChE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AACzC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,8BAA8B,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E,eAAe;IAG/C,KAAK,IAAI,OAAO;IAIV,IAAI,CAAC,GAAG,EAAE,eAAe,EAAE,GAAG,EAAE,cAAc,EAAE,IAAI,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC;IAiDzF,OAAO,CACX,GAAG,EAAE,eAAe,EACpB,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,MAAM,EACb,IAAI,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,GACxB,OAAO,CAAC,IAAI,CAAC;IAuBhB,OAAO,CAAC,IAAI;IAKZ,OAAO,CAAC,MAAM;CASf"}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -6,7 +6,7 @@ import { type AuthConfig } from './config.js';
|
|
|
6
6
|
import { AuthStateStore } from './storage/store.js';
|
|
7
7
|
export type { AuthConfig } from './config.js';
|
|
8
8
|
export { Config, DEFAULT_REQUIRE_TOTP, DEFAULT_SESSION_HOURS } from './config.js';
|
|
9
|
-
export {
|
|
9
|
+
export { resolveStartupConfig, finalizeAuthConfig } from './config.js';
|
|
10
10
|
export { installAuthenticatedHostCapability } from './adapters/dsh/browser-capability.js';
|
|
11
11
|
export { GuardedWebServer, READY_PATH, READY_PROTOCOL_VERSION } from './adapters/dsh/webserver.js';
|
|
12
12
|
export { DshReadiness, watchConnection } from './adapters/dsh/readiness.js';
|
|
@@ -20,10 +20,14 @@ export declare class AuthRemoteWebServer extends GuardedWebServer {
|
|
|
20
20
|
static Config: typeof GuardedWebServer.Config;
|
|
21
21
|
private stateStore;
|
|
22
22
|
private authService;
|
|
23
|
-
private readonly
|
|
23
|
+
private readonly pending;
|
|
24
|
+
private resolvedConfig;
|
|
24
25
|
private readonly switchGate;
|
|
25
26
|
constructor(ctx: Context, input: AuthConfig);
|
|
26
27
|
[Service.init](): Promise<void>;
|
|
28
|
+
private get resolved();
|
|
29
|
+
/** Native WebApp evaluates this only after the authenticated service initializes. */
|
|
30
|
+
get publicUrl(): string;
|
|
27
31
|
get storage(): AuthStateStore;
|
|
28
32
|
get authentication(): AuthService;
|
|
29
33
|
/** Public authorities needed by native Connection for preserved routes. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,4EAA4E;AAC5E,OAAO,EAAE,OAAO,EAAE,KAAK,OAAO,EAAE,MAAM,qBAAqB,CAAA;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,4EAA4E;AAC5E,OAAO,EAAE,OAAO,EAAE,KAAK,OAAO,EAAE,MAAM,qBAAqB,CAAA;AAO3D,OAAO,EAAY,gBAAgB,EAAc,MAAM,6BAA6B,CAAA;AACpF,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAA;AAC/C,OAAO,EAIL,KAAK,UAAU,EAIhB,MAAM,aAAa,CAAA;AAKpB,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAA;AAEnD,YAAY,EAAE,UAAU,EAAE,MAAM,aAAa,CAAA;AAC7C,OAAO,EAAE,MAAM,EAAE,oBAAoB,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAA;AACjF,OAAO,EAAE,oBAAoB,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAA;AACtE,OAAO,EAAE,kCAAkC,EAAE,MAAM,sCAAsC,CAAA;AACzF,OAAO,EAAE,gBAAgB,EAAE,UAAU,EAAE,sBAAsB,EAAE,MAAM,6BAA6B,CAAA;AAClG,OAAO,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,6BAA6B,CAAA;AAC3E,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAA;AAC1D,YAAY,EAAE,UAAU,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAA;AAC/E,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAA;AACnD,OAAO,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAA;AACzC,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAA;AAEvD,eAAO,MAAM,IAAI,gBAAgB,CAAA;AAEjC,qBAAa,mBAAoB,SAAQ,gBAAgB;IACvD,OAAgB,MAAM,EAAwB,OAAO,gBAAgB,CAAC,MAAM,CAAA;IAC5E,OAAO,CAAC,UAAU,CAA4B;IAC9C,OAAO,CAAC,WAAW,CAAyB;IAC5C,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAmB;IAC3C,OAAO,CAAC,cAAc,CAAgC;IACtD,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAY;gBAE3B,GAAG,EAAE,OAAO,EAAE,KAAK,EAAE,UAAU;IAmB5B,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,OAAO,CAAC,IAAI,CAAC;IA+F9C,OAAO,KAAK,QAAQ,GAGnB;IAED,qFAAqF;IACrF,IAAI,SAAS,IAAI,MAAM,CAEtB;IAED,IAAI,OAAO,IAAI,cAAc,CAG5B;IAED,IAAI,cAAc,IAAI,WAAW,CAGhC;IAED,2EAA2E;IAC3E,IAAI,sBAAsB,IAAI,SAAS,MAAM,EAAE,CAG9C;CACF;AAED,eAAe,mBAAmB,CAAA"}
|
package/docs/deployment.md
CHANGED
|
@@ -2,9 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
[简体中文](deployment.zh-CN.md)
|
|
4
4
|
|
|
5
|
-
This guide
|
|
6
|
-
|
|
7
|
-
The npm steps below use plugin `0.1.5`. Before upgrading an existing installation, review [compatibility](../README.md#dsh-compatibility); for source builds, see the [development guide](development.md).
|
|
5
|
+
This guide uses DSH `0.2.1-alpha.2` and its default `~/.dsh` data directory. See the [compatibility matrix](../README.md#dsh-compatibility) for the other five releases and the [development guide](development.md) for isolated source builds. Choose your own hostname, proxy network and service manager.
|
|
8
6
|
|
|
9
7
|
## Minimal installation from npm
|
|
10
8
|
|
|
@@ -12,28 +10,23 @@ Install the published package into the default `web` profile:
|
|
|
12
10
|
|
|
13
11
|
```sh
|
|
14
12
|
dsh --version
|
|
15
|
-
dsh plugin --profile web add dsh-auth-remote@0.1.
|
|
13
|
+
dsh plugin --profile web add dsh-auth-remote@0.1.6
|
|
16
14
|
dsh plugin --profile web list
|
|
17
|
-
```
|
|
18
|
-
|
|
19
|
-
Verify that `dsh --version` prints `0.2.1-alpha.1` and the list includes `dsh-auth-remote@0.1.5`. The bundle supplies an auth listener with `allowedOrigins: []`, which admits only literal loopback hosts. No profile patch is needed for this setup. Start DSH in one terminal:
|
|
20
|
-
|
|
21
|
-
```sh
|
|
22
15
|
dsh web --no-open --port 13090
|
|
23
16
|
```
|
|
24
17
|
|
|
25
|
-
In another terminal, require `/auth-remote/ready` to return `"plugin":"dsh-auth-remote"`, `"protocolVersion":1`, and `"ready":true`, then initialize the account:
|
|
18
|
+
Verify the selected DSH version and plugin list. No profile patch is needed for the default IPv4 HTTP loopback listener. In another terminal, require `/auth-remote/ready` to return `"plugin":"dsh-auth-remote"`, `"protocolVersion":1`, and `"ready":true`, then initialize the account:
|
|
26
19
|
|
|
27
20
|
```sh
|
|
28
21
|
curl -fsS http://127.0.0.1:13090/auth-remote/ready
|
|
29
22
|
dsh plugin --profile web exec dsh-auth-remote init --lang en
|
|
30
23
|
```
|
|
31
24
|
|
|
32
|
-
|
|
25
|
+
Open the printed root `http://127.0.0.1:13090/`. Anonymous navigation redirects to sign-in; anonymous business APIs are denied. The bundle suppresses native token URLs and automatic browser opening. Keep development and test homes separate from this account profile.
|
|
33
26
|
|
|
34
|
-
## Complete public-
|
|
27
|
+
## Complete public-entry configuration
|
|
35
28
|
|
|
36
|
-
For an HTTPS entry
|
|
29
|
+
For an HTTPS proxy entry, merge the following rows into `~/.dsh/profiles/web/cordis.patch.yml`, keeping unrelated model and plugin rows. The reusable [profile example](../examples/web-profile-auth-remote.patch.yml) has the same configuration:
|
|
37
30
|
|
|
38
31
|
```yaml
|
|
39
32
|
- id: webserver
|
|
@@ -41,50 +34,102 @@ For an HTTPS entry such as `https://dsh.example.com`, merge the following rows i
|
|
|
41
34
|
|
|
42
35
|
- id: auth-remote
|
|
43
36
|
config:
|
|
44
|
-
|
|
37
|
+
publicUrl: https://dsh.example.com/
|
|
38
|
+
host: 127.0.0.1
|
|
39
|
+
port: 13090
|
|
45
40
|
requireTotp: true
|
|
46
41
|
sessionHours: 168
|
|
47
42
|
preserveOriginPaths: []
|
|
48
43
|
```
|
|
49
44
|
|
|
50
|
-
Replace the hostname
|
|
45
|
+
Replace the public hostname consistently in the profile and proxy. This example keeps a private HTTP listener behind external TLS. `publicUrl` selects the browser entry; it does not configure a proxy, certificate or listener protocol. The independent `webserver` disable is recommended; the auth bundle already disables that row while active. Remove the independent disable when uninstalling the plugin and returning to the native listener.
|
|
46
|
+
|
|
47
|
+
DSH replaces the entire plugin `config` when a later patch row supplies one. Preserve the full intended authentication configuration in that row. If a home-level patch also defines `auth-remote`, inspect the final composition with `dsh --profile web --dump-config` before opening access.
|
|
48
|
+
|
|
49
|
+
## Configuration priority and path bases
|
|
50
|
+
|
|
51
|
+
All plugin fields below belong directly in `auth-remote.config`; there are no aliases or nested TLS objects.
|
|
52
|
+
|
|
53
|
+
| Field | Effective value |
|
|
54
|
+
| --------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
55
|
+
| `publicUrl` | CLI `--public-url` replaces the whole file URL on alpha.1/2; otherwise file URL, migrated legacy single item, then actual listener root. Accept only absolute HTTP(S) roots with optional final slash, no credentials/path/query/fragment. |
|
|
56
|
+
| `host` | CLI `--host`, then file, then `127.0.0.1`. Require a concrete IPv4 literal; alpha.2 also accepts concrete IPv6, including mapped forms. No DNS names or wildcard binds. |
|
|
57
|
+
| `port` | CLI `--port`, then file, then `3080`, independently of host. `0` derives the entry only after the actual nonzero port is bound. |
|
|
58
|
+
| `tlsCert`, `tlsKey` | Alpha.2 only. Supply both file fields, or both CLI `--tls-cert`/`--tls-key`. A CLI pair replaces the whole file pair; sources are never mixed and unused file certificate paths are not read. Omit TLS for HTTP. |
|
|
59
|
+
| `requireTotp` | Defaults to `true`. With `false`, an unbound account may skip setup; an already bound account still needs its second factor. |
|
|
60
|
+
| `sessionHours` | Fixed default lifetime of 168 hours. Reducing it tightens existing sessions; increasing it does not revive expired sessions. |
|
|
61
|
+
| `preserveOriginPaths` | Optional canonical segment-prefix paths; default `[]`. Matching routes keep the validated public Host and existing Origin after authentication. The final public origin configures native Connection trust automatically. |
|
|
62
|
+
|
|
63
|
+
**Pay particular attention to TLS paths:** relative file values resolve from the selected profile directory, where its `cordis.patch.yml` lives. Relative CLI paths resolve from the process's launch working directory. Neither uses the bundle or another overlay's directory. Absolute paths stay absolute.
|
|
64
|
+
|
|
65
|
+
For an alpha.2 override example, `dsh web --no-open --host ::1 --port 0 --public-url https://dsh.example.com/` replaces file host, port and URL independently. The listener binds an actual free port; the explicit public root stays unchanged. Configure any proxy to reach that actual port. Omit `--host` to keep the file host when overriding only the port.
|
|
66
|
+
|
|
67
|
+
For example, file `tlsCert: ./tls/dsh.crt` means `~/.dsh/profiles/web/tls/dsh.crt` even if you launch from a different directory. The following command uses `./launch-workdir/tls/dsh.crt` and the matching key instead:
|
|
68
|
+
|
|
69
|
+
```sh
|
|
70
|
+
cd ./launch-workdir
|
|
71
|
+
dsh web --no-open --tls-cert ./tls/dsh.crt --tls-key ./tls/dsh.key
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
Supplying only one CLI flag fails even if the file contains the other half. Missing, unreadable, empty, malformed or mismatched certificate/key material fails startup without an HTTP fallback, and releases listener/admin/storage resources. Choose a certificate valid for the browser hostname; the plugin delegates TLS to the official listener.
|
|
75
|
+
|
|
76
|
+
CLI public URL overrides are available only on alpha.1/2. Older DSH rejects that unknown flag; use the plugin file field. Older versions also reject native IPv6/TLS rather than pretending to support them. Their Web prompt and `DSH_WEB_URL` keep the native fixed IPv4 loopback URL with the actual port, while the plugin's admission and printed public root still follow its effective configuration.
|
|
77
|
+
|
|
78
|
+
## Native HTTPS and IPv6
|
|
79
|
+
|
|
80
|
+
On alpha.2, merge this complete auth row for direct IPv6 loopback HTTPS, using your own certificate and key:
|
|
81
|
+
|
|
82
|
+
```yaml
|
|
83
|
+
- id: auth-remote
|
|
84
|
+
config:
|
|
85
|
+
host: ::1
|
|
86
|
+
port: 8443
|
|
87
|
+
tlsCert: ./tls/dsh.crt
|
|
88
|
+
tlsKey: ./tls/dsh.key
|
|
89
|
+
requireTotp: true
|
|
90
|
+
sessionHours: 168
|
|
91
|
+
preserveOriginPaths: []
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
Start with `dsh web --no-open`; the derived root is `https://[::1]:8443/`. IPv6 URL authorities need brackets. HTTP IPv6 is also available with `dsh web --no-open --host ::1 --port 13090` and no TLS fields. Concrete non-loopback documentation addresses such as `192.0.2.10` or `2001:db8::10` must be replaced with addresses actually assigned to your host; binding does not limit client source IPs. Apply source restrictions through your network policy.
|
|
95
|
+
|
|
96
|
+
Do not use `0.0.0.0`, `::`, or mapped IPv4 wildcard binds. A scope/zone selects an interface for a bind and cannot appear in a portable public URL. Redundant loopback scope is normalized; a non-loopback scoped bind requires an explicit portable `publicUrl` such as `https://dsh.example.com/`.
|
|
51
97
|
|
|
52
|
-
##
|
|
98
|
+
## Migrate old allowedOrigins
|
|
53
99
|
|
|
54
|
-
|
|
55
|
-
| --------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
56
|
-
| `webserver: disabled` | Recommended in the profile for an independent native-listener disable; the auth bundle disables it while active. |
|
|
57
|
-
| `dsh web --port` | Sets the authenticated listener port; the example uses `127.0.0.1:13090`. The plugin reads DSH web startup, so no listener setting is repeated in its config. |
|
|
58
|
-
| `allowedOrigins` | List exact HTTP(S) origins, including nondefault ports. The example has `https://dsh.example.com`. An empty list allows only literal loopback. No wildcard, inferred forwarded host, or CORS fallback exists. |
|
|
59
|
-
| `requireTotp` | Defaults to `true`. With `false`, an account without TOTP can skip setup; an already bound account still needs its second factor. |
|
|
60
|
-
| `sessionHours` | Defaults to a fixed 168-hour lifetime. Reducing it tightens existing sessions; increasing it does not resurrect expired ones. |
|
|
61
|
-
| `preserveOriginPaths` | Optional segment-prefix paths whose validated public Host and existing Origin are passed to DSH. The default `[]` rewrites authenticated requests to the internal authority. The bundle configures Connection for preserved paths. |
|
|
100
|
+
The old field remains a plugin migration contract, independently of DSH version support. Each activation warns once and converts in memory, without rewriting the profile or account state.
|
|
62
101
|
|
|
63
|
-
|
|
102
|
+
| Old input | Upgrade behavior |
|
|
103
|
+
| ------------------------------------------------------------------------------------------------ | ------------------------------------------------------------------------------ |
|
|
104
|
+
| Field absent | Derive one root from the actual listener unless `publicUrl` is supplied. |
|
|
105
|
+
| `allowedOrigins: []` | Warn and derive the actual listener root. |
|
|
106
|
+
| One root URL | Warn and use that root as `publicUrl`. |
|
|
107
|
+
| Two or more items, even duplicates | Fail; manually choose one public entry and replace the array with `publicUrl`. |
|
|
108
|
+
| Any explicit `allowedOrigins` plus file or CLI `publicUrl`, even an empty array or identical URL | Fail; remove the legacy field before using the new one. |
|
|
64
109
|
|
|
65
|
-
|
|
110
|
+
Back up the old patch before upgrading. Replace a single item with `publicUrl: https://dsh.example.com/`; remove an empty array to keep derived behavior. An installation with several public origins needs a deliberate choice of one canonical entry. Route alternate browser hostnames to that entry before they reach the protected upstream. To roll back to 0.1.5, restore its compatible old configuration backup; the new fields are not a 0.1.5 contract.
|
|
66
111
|
|
|
67
|
-
|
|
112
|
+
## Source and bridge contract
|
|
68
113
|
|
|
69
|
-
|
|
114
|
+
Admission is the one effective public origin plus literal loopback authorities. The URL's root path has no deployment prefix. Requests need one valid Host; mutations and WebSocket upgrades require a matching Origin, and cross-site or mismatched Fetch Metadata is rejected. An old public origin is no longer registered after replacement. `Forwarded` and `X-Forwarded-*` never decide admission or Cookie Secure. CLI `--trusted-host` configures native Connection only and does not enlarge this outer policy.
|
|
70
115
|
|
|
71
|
-
|
|
116
|
+
Plugin cookies follow the validated external origin and are host-only, HttpOnly and SameSite; HTTPS sets Secure. Native bridge credentials stay server-side and follow the native listener protocol, including HTTPS cookie audience/Secure when a public HTTP proxy fronts native HTTPS. Ports do not isolate browser cookies.
|
|
72
117
|
|
|
73
|
-
|
|
118
|
+
Standard `/api` routes work with `preserveOriginPaths: []`; there is no need to list `/api`. Add a prefix only when a downstream route needs the original public Host. The plugin forwards an Origin only when the request supplied one, and preflights the selected public authority for preserved paths. No separate Connection row or extra trusted-host flag is needed. Ordinary alpha.2 routes use the normalized native bind authority; older Connection retains its internal HTTP loopback bridge. Both paths still require a full session. Revocation, Connection loss or storage failure closes active uploads, streams and upgrades and withdraws business admission. Readiness does not mean the account is initialized.
|
|
74
119
|
|
|
75
120
|
## Start and verify the public entry
|
|
76
121
|
|
|
77
|
-
1. Verify Linux, Node.js 24+,
|
|
78
|
-
2. Merge
|
|
79
|
-
3. Start
|
|
80
|
-
4. Confirm
|
|
122
|
+
1. Verify Linux, Node.js 24+, the exact compatible DSH version, and the intended profile/package. Keep test and development data separate.
|
|
123
|
+
2. Merge one complete profile configuration and configure a private reachable proxy upstream if needed; see the [proxy guide](reverse-proxy.md).
|
|
124
|
+
3. Start DSH. For the HTTP upstream example, inspect `curl -fsS -H 'Host: dsh.example.com' http://127.0.0.1:13090/auth-remote/ready` and require the expected plugin/protocol and `ready: true`.
|
|
125
|
+
4. Confirm anonymous HTML redirect and API denial, then initialize locally, sign in, bind TOTP and save backup codes. Exercise official settings, workspace, preview, uploads, SSE/WebSocket and revocation through the selected entry.
|
|
81
126
|
|
|
82
|
-
|
|
127
|
+
Startup prints the actual protocol/address/port and one distinct public root, deduplicating identical URLs. It prints no token or login path. Keep access private until readiness and anonymous denial checks pass; failed plugin, TLS, state or Connection initialization must leave business unavailable.
|
|
83
128
|
|
|
84
129
|
## Backup, recovery and changes
|
|
85
130
|
|
|
86
|
-
Stop DSH and verify it
|
|
131
|
+
Stop DSH and verify it released the profile lock before copying `~/.dsh/profiles/web/auth-remote/auth-state.json`. Keep the copy in a private directory (0700) with file mode 0600. It contains password hashes, the TOTP secret, backup-code hashes and sessions. Do not copy an in-progress temporary file, overwrite live locked state or commit it. Back up the corresponding profile patch and package/lock files.
|
|
87
132
|
|
|
88
|
-
For recovery, stop DSH,
|
|
133
|
+
For recovery, stop DSH, check schema/package compatibility, restore with private ownership/mode, then check readiness and CLI `status --json`. Local `reset-password`, `reset-totp` and `revoke-sessions` revoke sessions. A lost management response has an uncertain outcome; inspect status before another mutation.
|
|
89
134
|
|
|
90
|
-
|
|
135
|
+
To change the external entry, replace the one `publicUrl`, update the proxy and restart DSH. Verify the new entry and rejection of the former non-loopback entry, including cookies, redirects, uploads and long connections. Do not temporarily configure both origins in this plugin.
|