@gadicc/loom 1.26.1 → 1.28.0
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/README.md +7 -3
- package/esm/src/cli/mod.d.ts.map +1 -1
- package/esm/src/cli/mod.js +81 -15
- package/esm/src/next/auth/localTestLogin.d.ts +75 -0
- package/esm/src/next/auth/localTestLogin.d.ts.map +1 -0
- package/esm/src/next/auth/localTestLogin.js +284 -0
- package/esm/src/next/auth/mod.d.ts +1 -0
- package/esm/src/next/auth/mod.d.ts.map +1 -1
- package/esm/src/next/auth/mod.js +1 -0
- package/package.json +2 -2
- package/script/src/cli/mod.d.ts.map +1 -1
- package/script/src/cli/mod.js +81 -15
- package/script/src/next/auth/localTestLogin.d.ts +75 -0
- package/script/src/next/auth/localTestLogin.d.ts.map +1 -0
- package/script/src/next/auth/localTestLogin.js +291 -0
- package/script/src/next/auth/mod.d.ts +1 -0
- package/script/src/next/auth/mod.d.ts.map +1 -1
- package/script/src/next/auth/mod.js +1 -0
- package/skills/loom-auth/SKILL.md +57 -0
- package/skills/modernize-app/SKILL.md +90 -0
- package/skills/modernize-app/agents/openai.yaml +4 -0
- package/skills/modernize-app/references/architecture-and-characterization.md +205 -0
- package/skills/modernize-app/references/identity-and-data.md +251 -0
- package/skills/modernize-app/references/offline-and-media.md +403 -0
- package/skills/modernize-app/references/rollout-and-shared-work.md +400 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../../../src/src/cli/mod.ts"],"names":[],"mappings":"AAgCA,OAAO,EAEL,KAAK,uBAAuB,EAC7B,MAAM,yBAAyB,CAAC;AAuBjC,OAAO,EAUL,KAAK,cAAc,EAMpB,MAAM,qBAAqB,CAAC;AAE7B,eAAO,MAAM,kBAAkB,WAAW,CAAC;AAC3C,eAAO,MAAM,eAAe,iBAAiB,CAAC;AAC9C,eAAO,MAAM,oBAAoB,2DACyB,CAAC;AAC3D,eAAO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E,aAAa,CAAC;CAC1B,mBAiBP;AAopBD,wBAAsB,MAAM,CAC1B,IAAI,MAAwB,EAC5B,EAAE,GAAE,SAGH,mBA6KF"}
|
package/script/src/cli/mod.js
CHANGED
|
@@ -166,6 +166,11 @@ const managedSkills = [
|
|
|
166
166
|
relativePackagePath: "skills/upgrade-deps",
|
|
167
167
|
skillName: "upgrade-deps",
|
|
168
168
|
},
|
|
169
|
+
{
|
|
170
|
+
label: "legacy app modernization skill",
|
|
171
|
+
relativePackagePath: "skills/modernize-app",
|
|
172
|
+
skillName: "modernize-app",
|
|
173
|
+
},
|
|
169
174
|
{
|
|
170
175
|
featureKey: "db",
|
|
171
176
|
label: "loom db skill",
|
|
@@ -1227,6 +1232,10 @@ async function mergeAuthConfig(cwd, framework, featureConfig) {
|
|
|
1227
1232
|
...defaults.modules,
|
|
1228
1233
|
...featureConfig?.modules,
|
|
1229
1234
|
},
|
|
1235
|
+
// Recorded by the app; Loom never infers or rewrites this choice.
|
|
1236
|
+
...(featureConfig?.requestSessionReaders
|
|
1237
|
+
? { requestSessionReaders: featureConfig.requestSessionReaders }
|
|
1238
|
+
: {}),
|
|
1230
1239
|
};
|
|
1231
1240
|
}
|
|
1232
1241
|
function dependencyExecutable(tooling, executable) {
|
|
@@ -4006,15 +4015,35 @@ function matchesAuthRouteWrapper(text, expectedSources, expectedExportName) {
|
|
|
4006
4015
|
if (!matchesImportSource(normalized, expectedSources)) {
|
|
4007
4016
|
return false;
|
|
4008
4017
|
}
|
|
4009
|
-
|
|
4010
|
-
|
|
4018
|
+
// Exactly one handler set, so every exported method is traceable to it.
|
|
4019
|
+
const calls = [
|
|
4020
|
+
...normalized.matchAll(/toNextJsHandler\(\s*([A-Za-z_$][\w$]*)\s*\)/g),
|
|
4021
|
+
];
|
|
4022
|
+
if (calls.length !== 1) {
|
|
4011
4023
|
return false;
|
|
4012
4024
|
}
|
|
4013
|
-
const
|
|
4014
|
-
if (
|
|
4025
|
+
const instanceName = calls[0][1];
|
|
4026
|
+
if (expectedExportName && instanceName !== expectedExportName) {
|
|
4015
4027
|
return false;
|
|
4016
4028
|
}
|
|
4017
|
-
|
|
4029
|
+
const match = normalized.match(/export\s+const\s+\{\s*([^}]+)\s*\}\s*=\s*toNextJsHandler\(/);
|
|
4030
|
+
if (match) {
|
|
4031
|
+
const actualSpecifiers = new Set(match[1].split(",").map((specifier) => specifier.trim()).filter(Boolean));
|
|
4032
|
+
return actualSpecifiers.has("GET") && actualSpecifiers.has("POST");
|
|
4033
|
+
}
|
|
4034
|
+
// An app may wrap the handlers, for example to fail closed until a
|
|
4035
|
+
// migration completes. Each exported method must still come from the
|
|
4036
|
+
// handlers that call returned.
|
|
4037
|
+
const handlers = normalized.match(/(?:const|let|var)\s+([A-Za-z_$][\w$]*)\s*=\s*toNextJsHandler\(/);
|
|
4038
|
+
if (!handlers) {
|
|
4039
|
+
return false;
|
|
4040
|
+
}
|
|
4041
|
+
const handlersName = handlers[1];
|
|
4042
|
+
return ["GET", "POST"].every((method) => {
|
|
4043
|
+
const exported = normalized.match(new RegExp(`export\\s+const\\s+${method}\\s*=([^;]*);`));
|
|
4044
|
+
return Boolean(exported &&
|
|
4045
|
+
new RegExp(`\\b${escapeRegExp(handlersName)}\\.${method}\\b`).test(exported[1]));
|
|
4046
|
+
});
|
|
4018
4047
|
}
|
|
4019
4048
|
function authClientTemplate(config, authExportName) {
|
|
4020
4049
|
return `"use client";
|
|
@@ -8900,7 +8929,10 @@ async function checkFilesFeature(cwd, framework, manifest, options) {
|
|
|
8900
8929
|
}
|
|
8901
8930
|
else {
|
|
8902
8931
|
const repositorySchemaImportCandidates = getImportSpecifierCandidates(config.modules.repositoryModule, schema.module);
|
|
8903
|
-
const repositoryDbImportCandidates =
|
|
8932
|
+
const repositoryDbImportCandidates = [
|
|
8933
|
+
...getImportSpecifierCandidates(config.modules.repositoryModule, dbConfig.modules.neonModule),
|
|
8934
|
+
...getImportSpecifierCandidates(config.modules.repositoryModule, dbConfig.modules.neonFullModule),
|
|
8935
|
+
];
|
|
8904
8936
|
const schemaExportName = schema.exports[0] ?? FILES_SCHEMA_DEFAULT_EXPORT;
|
|
8905
8937
|
if (!matchesImportSource(repositoryText, ["@gadicc/loom/files"])) {
|
|
8906
8938
|
issues.push(`Files repository is not typed against @gadicc/loom/files: ${config.modules.repositoryModule}`);
|
|
@@ -8915,7 +8947,7 @@ async function checkFilesFeature(cwd, framework, manifest, options) {
|
|
|
8915
8947
|
}
|
|
8916
8948
|
if (!matchesImportSource(repositoryText, repositoryDbImportCandidates)) {
|
|
8917
8949
|
issues.push(`Files repository does not import the configured DB module: ${config.modules.repositoryModule}`);
|
|
8918
|
-
suggestions.add(`Import the app DB client from ${dbConfig.modules.neonModule} in the files repository adapter.`);
|
|
8950
|
+
suggestions.add(`Import the app DB client from ${dbConfig.modules.neonModule} or ${dbConfig.modules.neonFullModule} in the files repository adapter.`);
|
|
8919
8951
|
}
|
|
8920
8952
|
if (!repositoryText.includes("filesRepository")) {
|
|
8921
8953
|
issues.push(`Files repository does not export \`filesRepository\`: ${config.modules.repositoryModule}`);
|
|
@@ -9325,6 +9357,7 @@ async function checkAuthFeature(cwd, framework, manifest) {
|
|
|
9325
9357
|
const config = await mergeAuthConfig(cwd, framework, feature.config);
|
|
9326
9358
|
const requiredFiles = [
|
|
9327
9359
|
config.modules.authModule,
|
|
9360
|
+
config.modules.authRuntimeModule,
|
|
9328
9361
|
config.modules.authClientModule,
|
|
9329
9362
|
config.entrypoints.routeHandler,
|
|
9330
9363
|
config.modules.authServerModule,
|
|
@@ -9340,6 +9373,37 @@ async function checkAuthFeature(cwd, framework, manifest) {
|
|
|
9340
9373
|
const authExportName = authModuleText
|
|
9341
9374
|
? detectBetterAuthExportName(authModuleText)
|
|
9342
9375
|
: null;
|
|
9376
|
+
// An app may build its instance in a separate runtime module, so the shared
|
|
9377
|
+
// helpers can be split across the two. Only a runtime module that imports
|
|
9378
|
+
// the auth module counts: otherwise its text proves nothing about the
|
|
9379
|
+
// instance this feature checks.
|
|
9380
|
+
const authRuntimeModule = config.modules.authRuntimeModule;
|
|
9381
|
+
const authRuntimeText = authRuntimeModule
|
|
9382
|
+
? await readTextIfExists((0, node_path_1.join)(cwd, authRuntimeModule))
|
|
9383
|
+
: null;
|
|
9384
|
+
let creditedRuntimeText = null;
|
|
9385
|
+
if (authRuntimeModule && authRuntimeText) {
|
|
9386
|
+
if (matchesImportSource(authRuntimeText, getImportSpecifierCandidates(authRuntimeModule, config.modules.authModule))) {
|
|
9387
|
+
creditedRuntimeText = authRuntimeText;
|
|
9388
|
+
}
|
|
9389
|
+
else {
|
|
9390
|
+
issues.push(`Auth runtime module does not import the configured auth module: ${authRuntimeModule}`);
|
|
9391
|
+
suggestions.add("Point modules.authRuntimeModule at the module that builds the configured auth instance, or remove it from loom.json.");
|
|
9392
|
+
}
|
|
9393
|
+
}
|
|
9394
|
+
const authWiringSources = [
|
|
9395
|
+
{ path: config.modules.authModule, text: authModuleText },
|
|
9396
|
+
...(creditedRuntimeText
|
|
9397
|
+
? [{ path: authRuntimeModule, text: creditedRuntimeText }]
|
|
9398
|
+
: []),
|
|
9399
|
+
].filter((source) => source.text);
|
|
9400
|
+
// Modules reach the instance through whichever of the two exports it.
|
|
9401
|
+
const authImportCandidates = (fromPath) => [
|
|
9402
|
+
...getImportSpecifierCandidates(fromPath, config.modules.authModule),
|
|
9403
|
+
...(creditedRuntimeText && authRuntimeModule
|
|
9404
|
+
? getImportSpecifierCandidates(fromPath, authRuntimeModule)
|
|
9405
|
+
: []),
|
|
9406
|
+
];
|
|
9343
9407
|
if (authModuleText) {
|
|
9344
9408
|
const authModuleChecks = [
|
|
9345
9409
|
[
|
|
@@ -9352,8 +9416,8 @@ async function checkAuthFeature(cwd, framework, manifest) {
|
|
|
9352
9416
|
],
|
|
9353
9417
|
];
|
|
9354
9418
|
for (const [pattern, message] of authModuleChecks) {
|
|
9355
|
-
if (!pattern.test(
|
|
9356
|
-
issues.push(`${message}: ${
|
|
9419
|
+
if (!authWiringSources.some((source) => pattern.test(source.text))) {
|
|
9420
|
+
issues.push(`${message}: ${authWiringSources.map((source) => source.path).join(", ")}`);
|
|
9357
9421
|
suggestions.add("Update the auth module to use the shared Loom Better Auth helpers, or rerun `loom add auth` and reapply any app-local customizations.");
|
|
9358
9422
|
}
|
|
9359
9423
|
}
|
|
@@ -9362,15 +9426,16 @@ async function checkAuthFeature(cwd, framework, manifest) {
|
|
|
9362
9426
|
warnings.push(`Auth module uses a dynamic Better Auth baseURL without trusted proxy headers; trusted reverse proxies such as \`vercel dev\` can leak an internal callback host: ${config.modules.authModule}`);
|
|
9363
9427
|
suggestions.add("Use createBetterAuthLocalDevelopmentConfig for loopback development behind a trusted proxy, or explicitly enable Better Auth trustedProxyHeaders only where that proxy boundary is trusted.");
|
|
9364
9428
|
}
|
|
9365
|
-
if (
|
|
9429
|
+
if (config.requestSessionReaders !== "app-owned" &&
|
|
9430
|
+
!config.modules.authServerModule &&
|
|
9366
9431
|
!authModuleText.includes("createRequestAuthSessionReaders")) {
|
|
9367
9432
|
issues.push(`Auth module is missing Loom request-scoped session readers: ${config.modules.authModule}`);
|
|
9368
|
-
suggestions.add(
|
|
9433
|
+
suggestions.add('Either wire createRequestAuthSessionReaders into the auth module, add an auth server helper module and record it in loom.json, or record requestSessionReaders: "app-owned" when the app must read sessions its own way.');
|
|
9369
9434
|
}
|
|
9370
9435
|
}
|
|
9371
9436
|
const authClientText = await readTextIfExists((0, node_path_1.join)(cwd, config.modules.authClientModule));
|
|
9372
9437
|
if (authClientText) {
|
|
9373
|
-
const authClientImportCandidates =
|
|
9438
|
+
const authClientImportCandidates = authImportCandidates(config.modules.authClientModule);
|
|
9374
9439
|
const authClientChecks = [
|
|
9375
9440
|
[
|
|
9376
9441
|
authClientText.includes("createAuthClient"),
|
|
@@ -9394,7 +9459,7 @@ async function checkAuthFeature(cwd, framework, manifest) {
|
|
|
9394
9459
|
}
|
|
9395
9460
|
const routeHandlerText = await readTextIfExists((0, node_path_1.join)(cwd, config.entrypoints.routeHandler));
|
|
9396
9461
|
if (routeHandlerText) {
|
|
9397
|
-
const routeImportCandidates =
|
|
9462
|
+
const routeImportCandidates = authImportCandidates(config.entrypoints.routeHandler);
|
|
9398
9463
|
if (!matchesAuthRouteWrapper(routeHandlerText, routeImportCandidates, authExportName)) {
|
|
9399
9464
|
issues.push(`Auth route-handler wrapper does not match loom manifest config: ${config.entrypoints.routeHandler}`);
|
|
9400
9465
|
suggestions.add("Run `loom add auth` to restore the thin auth route wrapper, or update loom.json if the app intentionally uses different auth paths.");
|
|
@@ -9403,10 +9468,11 @@ async function checkAuthFeature(cwd, framework, manifest) {
|
|
|
9403
9468
|
if (config.modules.authServerModule) {
|
|
9404
9469
|
const authServerText = await readTextIfExists((0, node_path_1.join)(cwd, config.modules.authServerModule));
|
|
9405
9470
|
if (authServerText) {
|
|
9406
|
-
const authServerImportCandidates =
|
|
9471
|
+
const authServerImportCandidates = authImportCandidates(config.modules.authServerModule);
|
|
9407
9472
|
const authServerChecks = [
|
|
9408
9473
|
[
|
|
9409
|
-
|
|
9474
|
+
config.requestSessionReaders === "app-owned" ||
|
|
9475
|
+
authServerText.includes("createRequestAuthSessionReaders"),
|
|
9410
9476
|
"Auth server module is not wired to Loom request-scoped session readers",
|
|
9411
9477
|
],
|
|
9412
9478
|
[
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
export declare const DEFAULT_BETTER_AUTH_LOCAL_TEST_LOGIN_ENV = "LOOM_LOCAL_TEST_LOGIN";
|
|
2
|
+
export declare const DEFAULT_BETTER_AUTH_LOCAL_TEST_LOGIN_MAX_BODY_BYTES: number;
|
|
3
|
+
type BetterAuthLocalTestLoginEnv = Record<string, string | undefined>;
|
|
4
|
+
type BetterAuthLocalTestLoginContext = {
|
|
5
|
+
password: {
|
|
6
|
+
hash(password: string): Promise<string>;
|
|
7
|
+
};
|
|
8
|
+
};
|
|
9
|
+
type BetterAuthLocalTestLoginAuth = {
|
|
10
|
+
$context: Promise<BetterAuthLocalTestLoginContext>;
|
|
11
|
+
handler(request: Request): Promise<Response>;
|
|
12
|
+
};
|
|
13
|
+
/** A fixed local identity selected by an opaque form value. */
|
|
14
|
+
export type BetterAuthLocalTestLoginIdentity = {
|
|
15
|
+
/** Same-origin application path used when the submitted callback is unsafe. */
|
|
16
|
+
defaultCallbackURL: string;
|
|
17
|
+
/** Dedicated identity email. Never populate this from request data. */
|
|
18
|
+
email: string;
|
|
19
|
+
/** Dedicated identity display name. Never populate this from request data. */
|
|
20
|
+
name: string;
|
|
21
|
+
/** Optional fixed local password. A process-local random value is the default. */
|
|
22
|
+
password?: string;
|
|
23
|
+
};
|
|
24
|
+
export type BetterAuthLocalTestLoginProvisionContext<TKey extends string, TIdentity extends BetterAuthLocalTestLoginIdentity = BetterAuthLocalTestLoginIdentity> = {
|
|
25
|
+
/** Fixed identity configuration selected from the app-owned allowlist. */
|
|
26
|
+
identity: TIdentity;
|
|
27
|
+
/** Exact allowlisted selector submitted by the local form. */
|
|
28
|
+
key: TKey;
|
|
29
|
+
/** Better Auth-compatible hash for the generated or configured password. */
|
|
30
|
+
passwordHash: string;
|
|
31
|
+
/** Generated or configured password used only for the internal sign-in call. */
|
|
32
|
+
password: string;
|
|
33
|
+
};
|
|
34
|
+
export type CreateBetterAuthLocalTestLoginHandlerOptions<TIdentities extends Record<string, BetterAuthLocalTestLoginIdentity>> = {
|
|
35
|
+
/** Better Auth instance whose email sign-in handler creates the session. */
|
|
36
|
+
auth: BetterAuthLocalTestLoginAuth;
|
|
37
|
+
/** Fixed application-owned identity map. Request data selects only its keys. */
|
|
38
|
+
identities: TIdentities;
|
|
39
|
+
/** Runtime environment used for the explicit local-only enablement gate. */
|
|
40
|
+
env: BetterAuthLocalTestLoginEnv;
|
|
41
|
+
/**
|
|
42
|
+
* Idempotently provision the fixed identity and credential account.
|
|
43
|
+
*
|
|
44
|
+
* App-specific grants and fixtures remain in this callback or in a separate
|
|
45
|
+
* explicit fixture; Loom never infers authorization from an identity key.
|
|
46
|
+
*/
|
|
47
|
+
provisionIdentity(context: BetterAuthLocalTestLoginProvisionContext<Extract<keyof TIdentities, string>, TIdentities[Extract<keyof TIdentities, string>]>): Promise<void>;
|
|
48
|
+
/** Better Auth base path. Defaults to `/api/auth`. */
|
|
49
|
+
authBasePath?: string;
|
|
50
|
+
/** Maximum accepted URL-encoded request body size. */
|
|
51
|
+
maxBodyBytes?: number;
|
|
52
|
+
/** Server-only opt-in environment name. */
|
|
53
|
+
optInEnvName?: string;
|
|
54
|
+
};
|
|
55
|
+
/**
|
|
56
|
+
* Returns whether developer UI login is explicitly enabled for this process.
|
|
57
|
+
*
|
|
58
|
+
* The helper deliberately rejects production/test modes and every Vercel
|
|
59
|
+
* runtime. Tests should pass an explicit development-shaped environment and
|
|
60
|
+
* exercise the handler with loopback requests.
|
|
61
|
+
*/
|
|
62
|
+
export declare function isBetterAuthLocalTestLoginEnabled(env: BetterAuthLocalTestLoginEnv, optInEnvName?: string): boolean;
|
|
63
|
+
/** Keep a callback on an application page of the current origin. */
|
|
64
|
+
export declare function safeBetterAuthLocalTestCallbackURL(value: unknown, fallback?: string): string;
|
|
65
|
+
/** Return a safe same-origin application callback path, or null. */
|
|
66
|
+
export declare function normalizeBetterAuthLocalTestCallbackURL(value: unknown): string | null;
|
|
67
|
+
/**
|
|
68
|
+
* Creates a POST-only, loopback-only Better Auth developer-login handler.
|
|
69
|
+
*
|
|
70
|
+
* All request/deployment guards run before the body is read, Better Auth hashes
|
|
71
|
+
* a credential, or the app provisioning callback can reach its database.
|
|
72
|
+
*/
|
|
73
|
+
export declare function createBetterAuthLocalTestLoginHandler<TIdentities extends Record<string, BetterAuthLocalTestLoginIdentity>>(options: CreateBetterAuthLocalTestLoginHandlerOptions<TIdentities>): (request: Request) => Promise<Response>;
|
|
74
|
+
export {};
|
|
75
|
+
//# sourceMappingURL=localTestLogin.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"localTestLogin.d.ts","sourceRoot":"","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AAC;IACxB,4EAA4E;IAC5E,GAAG,EAAE,2BAA2B,CAAC;IACjC;;;;;OAKG;IACH,iBAAiB,CACf,OAAO,EAAE,wCAAwC,CAC/C,OAAO,CAAC,MAAM,WAAW,EAAE,MAAM,CAAC,EAClC,WAAW,CAAC,OAAO,CAAC,MAAM,WAAW,EAAE,MAAM,CAAC,CAAC,CAChD,GACA,OAAO,CAAC,IAAI,CAAC,CAAC;IACjB,sDAAsD;IACtD,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,sDAAsD;IACtD,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,2CAA2C;IAC3C,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB,CAAC;AAEF;;;;;;GAMG;AACH,wBAAgB,iCAAiC,CAC/C,GAAG,EAAE,2BAA2B,EAChC,YAAY,SAA2C,GACtD,OAAO,CAMT;AA6FD,oEAAoE;AACpE,wBAAgB,kCAAkC,CAChD,KAAK,EAAE,OAAO,EACd,QAAQ,SAAM,GACb,MAAM,CAMR;AAED,oEAAoE;AACpE,wBAAgB,uCAAuC,CACrD,KAAK,EAAE,OAAO,GACb,MAAM,GAAG,IAAI,CA2Bf;AAyED;;;;;GAKG;AACH,wBAAgB,qCAAqC,CACnD,WAAW,SAAS,MAAM,CAAC,MAAM,EAAE,gCAAgC,CAAC,EAEpE,OAAO,EAAE,4CAA4C,CAAC,WAAW,CAAC,GACjE,CAAC,OAAO,EAAE,OAAO,KAAK,OAAO,CAAC,QAAQ,CAAC,CAkGzC"}
|
|
@@ -0,0 +1,291 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DEFAULT_BETTER_AUTH_LOCAL_TEST_LOGIN_MAX_BODY_BYTES = exports.DEFAULT_BETTER_AUTH_LOCAL_TEST_LOGIN_ENV = void 0;
|
|
4
|
+
exports.isBetterAuthLocalTestLoginEnabled = isBetterAuthLocalTestLoginEnabled;
|
|
5
|
+
exports.safeBetterAuthLocalTestCallbackURL = safeBetterAuthLocalTestCallbackURL;
|
|
6
|
+
exports.normalizeBetterAuthLocalTestCallbackURL = normalizeBetterAuthLocalTestCallbackURL;
|
|
7
|
+
exports.createBetterAuthLocalTestLoginHandler = createBetterAuthLocalTestLoginHandler;
|
|
8
|
+
exports.DEFAULT_BETTER_AUTH_LOCAL_TEST_LOGIN_ENV = "LOOM_LOCAL_TEST_LOGIN";
|
|
9
|
+
exports.DEFAULT_BETTER_AUTH_LOCAL_TEST_LOGIN_MAX_BODY_BYTES = 8 * 1024;
|
|
10
|
+
/**
|
|
11
|
+
* Returns whether developer UI login is explicitly enabled for this process.
|
|
12
|
+
*
|
|
13
|
+
* The helper deliberately rejects production/test modes and every Vercel
|
|
14
|
+
* runtime. Tests should pass an explicit development-shaped environment and
|
|
15
|
+
* exercise the handler with loopback requests.
|
|
16
|
+
*/
|
|
17
|
+
function isBetterAuthLocalTestLoginEnabled(env, optInEnvName = exports.DEFAULT_BETTER_AUTH_LOCAL_TEST_LOGIN_ENV) {
|
|
18
|
+
return env.NODE_ENV === "development" &&
|
|
19
|
+
env[optInEnvName] === "1" &&
|
|
20
|
+
!Object.entries(env).some(([name, value]) => name.startsWith("VERCEL") && Boolean(value));
|
|
21
|
+
}
|
|
22
|
+
function randomLocalPassword() {
|
|
23
|
+
return `${crypto.randomUUID()}${crypto.randomUUID()}`;
|
|
24
|
+
}
|
|
25
|
+
function isLoopbackHostname(hostname) {
|
|
26
|
+
const normalized = hostname.toLowerCase();
|
|
27
|
+
return normalized === "localhost" ||
|
|
28
|
+
normalized === "127.0.0.1" ||
|
|
29
|
+
normalized === "[::1]" ||
|
|
30
|
+
normalized === "::1";
|
|
31
|
+
}
|
|
32
|
+
function hasControlCharacters(value) {
|
|
33
|
+
return [...value].some((character) => {
|
|
34
|
+
const code = character.charCodeAt(0);
|
|
35
|
+
return code <= 0x1f || code === 0x7f;
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
function parseHttpOrigin(value) {
|
|
39
|
+
try {
|
|
40
|
+
const origin = new URL(value);
|
|
41
|
+
if (origin.protocol !== "http:" ||
|
|
42
|
+
origin.origin !== value ||
|
|
43
|
+
!isLoopbackHostname(origin.hostname)) {
|
|
44
|
+
return null;
|
|
45
|
+
}
|
|
46
|
+
return origin;
|
|
47
|
+
}
|
|
48
|
+
catch {
|
|
49
|
+
return null;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
function parseLoopbackHost(value) {
|
|
53
|
+
if (!value || /[\\/?#@]/.test(value) || hasControlCharacters(value)) {
|
|
54
|
+
return null;
|
|
55
|
+
}
|
|
56
|
+
try {
|
|
57
|
+
const parsed = new URL(`http://${value}`);
|
|
58
|
+
if (!isLoopbackHostname(parsed.hostname))
|
|
59
|
+
return null;
|
|
60
|
+
return parsed.host;
|
|
61
|
+
}
|
|
62
|
+
catch {
|
|
63
|
+
return null;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
function commaSeparatedValues(value) {
|
|
67
|
+
if (value === null)
|
|
68
|
+
return [];
|
|
69
|
+
const values = value.split(",").map((entry) => entry.trim());
|
|
70
|
+
return values.every(Boolean) ? values : [];
|
|
71
|
+
}
|
|
72
|
+
function requestLoopbackOrigin(request) {
|
|
73
|
+
const requestOrigin = parseHttpOrigin(new URL(request.url).origin);
|
|
74
|
+
const origin = request.headers.get("origin");
|
|
75
|
+
const parsedOrigin = origin ? parseHttpOrigin(origin) : null;
|
|
76
|
+
const host = request.headers.get("host");
|
|
77
|
+
const parsedHost = host ? parseLoopbackHost(host) : null;
|
|
78
|
+
if (!requestOrigin || !parsedOrigin || !parsedHost)
|
|
79
|
+
return null;
|
|
80
|
+
const forwardedHosts = commaSeparatedValues(request.headers.get("x-forwarded-host"));
|
|
81
|
+
if (request.headers.has("x-forwarded-host") &&
|
|
82
|
+
(forwardedHosts.length !== 1 || !parseLoopbackHost(forwardedHosts[0]))) {
|
|
83
|
+
return null;
|
|
84
|
+
}
|
|
85
|
+
const forwardedProtocols = commaSeparatedValues(request.headers.get("x-forwarded-proto"));
|
|
86
|
+
if (request.headers.has("x-forwarded-proto") &&
|
|
87
|
+
(forwardedProtocols.length !== 1 ||
|
|
88
|
+
forwardedProtocols[0].toLowerCase() !== "http")) {
|
|
89
|
+
return null;
|
|
90
|
+
}
|
|
91
|
+
const effectivePublicHost = forwardedHosts.length
|
|
92
|
+
? parseLoopbackHost(forwardedHosts[0])
|
|
93
|
+
: parsedHost;
|
|
94
|
+
if (parsedOrigin.host !== effectivePublicHost)
|
|
95
|
+
return null;
|
|
96
|
+
return parsedOrigin;
|
|
97
|
+
}
|
|
98
|
+
/** Keep a callback on an application page of the current origin. */
|
|
99
|
+
function safeBetterAuthLocalTestCallbackURL(value, fallback = "/") {
|
|
100
|
+
const safeFallback = normalizeBetterAuthLocalTestCallbackURL(fallback);
|
|
101
|
+
if (!safeFallback) {
|
|
102
|
+
throw new Error("Invalid local test login fallback callback URL");
|
|
103
|
+
}
|
|
104
|
+
return normalizeBetterAuthLocalTestCallbackURL(value) ?? safeFallback;
|
|
105
|
+
}
|
|
106
|
+
/** Return a safe same-origin application callback path, or null. */
|
|
107
|
+
function normalizeBetterAuthLocalTestCallbackURL(value) {
|
|
108
|
+
if (typeof value !== "string" ||
|
|
109
|
+
!value.startsWith("/") ||
|
|
110
|
+
value.length > 4096) {
|
|
111
|
+
return null;
|
|
112
|
+
}
|
|
113
|
+
try {
|
|
114
|
+
const decoded = decodeURIComponent(value);
|
|
115
|
+
if (decoded.startsWith("//") || decoded.includes("\\") ||
|
|
116
|
+
hasControlCharacters(decoded)) {
|
|
117
|
+
return null;
|
|
118
|
+
}
|
|
119
|
+
const url = new URL(value, "https://local-test.invalid");
|
|
120
|
+
if (url.origin !== "https://local-test.invalid" ||
|
|
121
|
+
/^\/api(?:\/|$)/.test(decodeURIComponent(url.pathname))) {
|
|
122
|
+
return null;
|
|
123
|
+
}
|
|
124
|
+
return url.pathname + url.search + url.hash;
|
|
125
|
+
}
|
|
126
|
+
catch {
|
|
127
|
+
return null;
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
function contentLengthIsAllowed(request, maxBodyBytes) {
|
|
131
|
+
const value = request.headers.get("content-length");
|
|
132
|
+
if (value === null)
|
|
133
|
+
return true;
|
|
134
|
+
if (!/^(0|[1-9]\d*)$/.test(value))
|
|
135
|
+
return false;
|
|
136
|
+
return Number(value) <= maxBodyBytes;
|
|
137
|
+
}
|
|
138
|
+
async function readBoundedBody(request, maxBodyBytes) {
|
|
139
|
+
if (!request.body)
|
|
140
|
+
return "";
|
|
141
|
+
const reader = request.body.getReader();
|
|
142
|
+
const chunks = [];
|
|
143
|
+
let size = 0;
|
|
144
|
+
try {
|
|
145
|
+
while (true) {
|
|
146
|
+
const { done, value } = await reader.read();
|
|
147
|
+
if (done)
|
|
148
|
+
break;
|
|
149
|
+
size += value.byteLength;
|
|
150
|
+
if (size > maxBodyBytes) {
|
|
151
|
+
try {
|
|
152
|
+
await reader.cancel();
|
|
153
|
+
}
|
|
154
|
+
catch {
|
|
155
|
+
// The request is already rejected; a broken producer cannot escape.
|
|
156
|
+
}
|
|
157
|
+
return null;
|
|
158
|
+
}
|
|
159
|
+
chunks.push(value);
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
catch {
|
|
163
|
+
try {
|
|
164
|
+
await reader.cancel();
|
|
165
|
+
}
|
|
166
|
+
catch {
|
|
167
|
+
// The request is already rejected; a broken producer cannot escape.
|
|
168
|
+
}
|
|
169
|
+
return null;
|
|
170
|
+
}
|
|
171
|
+
finally {
|
|
172
|
+
try {
|
|
173
|
+
reader.releaseLock();
|
|
174
|
+
}
|
|
175
|
+
catch {
|
|
176
|
+
// A failed stream read is handled as invalid input below.
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
const body = new Uint8Array(size);
|
|
180
|
+
let offset = 0;
|
|
181
|
+
for (const chunk of chunks) {
|
|
182
|
+
body.set(chunk, offset);
|
|
183
|
+
offset += chunk.byteLength;
|
|
184
|
+
}
|
|
185
|
+
try {
|
|
186
|
+
return new TextDecoder("utf-8", { fatal: true }).decode(body);
|
|
187
|
+
}
|
|
188
|
+
catch {
|
|
189
|
+
return null;
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
function notFoundResponse() {
|
|
193
|
+
return new Response("Not found", { status: 404 });
|
|
194
|
+
}
|
|
195
|
+
function getSetCookieValues(headers) {
|
|
196
|
+
const getSetCookie = headers.getSetCookie;
|
|
197
|
+
if (getSetCookie)
|
|
198
|
+
return getSetCookie.call(headers);
|
|
199
|
+
const value = headers.get("set-cookie");
|
|
200
|
+
return value ? [value] : [];
|
|
201
|
+
}
|
|
202
|
+
/**
|
|
203
|
+
* Creates a POST-only, loopback-only Better Auth developer-login handler.
|
|
204
|
+
*
|
|
205
|
+
* All request/deployment guards run before the body is read, Better Auth hashes
|
|
206
|
+
* a credential, or the app provisioning callback can reach its database.
|
|
207
|
+
*/
|
|
208
|
+
function createBetterAuthLocalTestLoginHandler(options) {
|
|
209
|
+
const enabled = isBetterAuthLocalTestLoginEnabled(options.env, options.optInEnvName);
|
|
210
|
+
const authBasePath = options.authBasePath ?? "/api/auth";
|
|
211
|
+
const maxBodyBytes = options.maxBodyBytes ??
|
|
212
|
+
exports.DEFAULT_BETTER_AUTH_LOCAL_TEST_LOGIN_MAX_BODY_BYTES;
|
|
213
|
+
if (!/^\/[A-Za-z0-9_-]+(?:\/[A-Za-z0-9_-]+)*$/.test(authBasePath)) {
|
|
214
|
+
throw new Error("Invalid Better Auth base path");
|
|
215
|
+
}
|
|
216
|
+
if (!Number.isSafeInteger(maxBodyBytes) || maxBodyBytes < 1) {
|
|
217
|
+
throw new Error("Invalid local test login body limit");
|
|
218
|
+
}
|
|
219
|
+
const passwords = new Map();
|
|
220
|
+
return async function localTestLogin(request) {
|
|
221
|
+
if (!enabled || request.method !== "POST")
|
|
222
|
+
return notFoundResponse();
|
|
223
|
+
const publicOrigin = requestLoopbackOrigin(request);
|
|
224
|
+
if (!publicOrigin)
|
|
225
|
+
return notFoundResponse();
|
|
226
|
+
const contentType = request.headers.get("content-type")?.split(";", 1)[0]
|
|
227
|
+
.trim().toLowerCase();
|
|
228
|
+
if (contentType !== "application/x-www-form-urlencoded" ||
|
|
229
|
+
!contentLengthIsAllowed(request, maxBodyBytes)) {
|
|
230
|
+
return new Response("Invalid request", { status: 400 });
|
|
231
|
+
}
|
|
232
|
+
const body = await readBoundedBody(request, maxBodyBytes);
|
|
233
|
+
if (body === null)
|
|
234
|
+
return new Response("Invalid request", { status: 400 });
|
|
235
|
+
const fields = new URLSearchParams(body);
|
|
236
|
+
const allowedFields = new Set(["identity", "callbackURL"]);
|
|
237
|
+
if ([...fields.keys()].some((key) => !allowedFields.has(key))) {
|
|
238
|
+
return new Response("Invalid request", { status: 400 });
|
|
239
|
+
}
|
|
240
|
+
const identityKeys = fields.getAll("identity");
|
|
241
|
+
const callbackValues = fields.getAll("callbackURL");
|
|
242
|
+
if (identityKeys.length !== 1 || callbackValues.length > 1) {
|
|
243
|
+
return new Response("Invalid request", { status: 400 });
|
|
244
|
+
}
|
|
245
|
+
const key = identityKeys[0];
|
|
246
|
+
if (!Object.prototype.hasOwnProperty.call(options.identities, key)) {
|
|
247
|
+
return new Response("Invalid request", { status: 400 });
|
|
248
|
+
}
|
|
249
|
+
const identity = options.identities[key];
|
|
250
|
+
const callbackURL = safeBetterAuthLocalTestCallbackURL(callbackValues[0], identity.defaultCallbackURL);
|
|
251
|
+
let password = passwords.get(key);
|
|
252
|
+
if (!password) {
|
|
253
|
+
password = identity.password?.trim() || randomLocalPassword();
|
|
254
|
+
passwords.set(key, password);
|
|
255
|
+
}
|
|
256
|
+
const context = await options.auth.$context;
|
|
257
|
+
const passwordHash = await context.password.hash(password);
|
|
258
|
+
await options.provisionIdentity({
|
|
259
|
+
identity,
|
|
260
|
+
key,
|
|
261
|
+
password,
|
|
262
|
+
passwordHash,
|
|
263
|
+
});
|
|
264
|
+
const signInHeaders = new Headers({
|
|
265
|
+
"content-type": "application/json",
|
|
266
|
+
origin: publicOrigin.origin,
|
|
267
|
+
});
|
|
268
|
+
const userAgent = request.headers.get("user-agent");
|
|
269
|
+
if (userAgent)
|
|
270
|
+
signInHeaders.set("user-agent", userAgent);
|
|
271
|
+
const signInResponse = await options.auth.handler(new Request(new URL(`${authBasePath}/sign-in/email`, publicOrigin), {
|
|
272
|
+
body: JSON.stringify({
|
|
273
|
+
email: identity.email,
|
|
274
|
+
password,
|
|
275
|
+
rememberMe: true,
|
|
276
|
+
}),
|
|
277
|
+
headers: signInHeaders,
|
|
278
|
+
method: "POST",
|
|
279
|
+
}));
|
|
280
|
+
if (!signInResponse.ok)
|
|
281
|
+
return signInResponse;
|
|
282
|
+
const responseHeaders = new Headers({ location: callbackURL });
|
|
283
|
+
for (const cookie of getSetCookieValues(signInResponse.headers)) {
|
|
284
|
+
responseHeaders.append("set-cookie", cookie);
|
|
285
|
+
}
|
|
286
|
+
return new Response(null, {
|
|
287
|
+
headers: responseHeaders,
|
|
288
|
+
status: 303,
|
|
289
|
+
});
|
|
290
|
+
};
|
|
291
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../../../../src/src/next/auth/mod.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC"}
|
|
1
|
+
{"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../../../../src/src/next/auth/mod.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,qBAAqB,CAAC;AACpC,cAAc,aAAa,CAAC"}
|
|
@@ -15,4 +15,5 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./config.js"), exports);
|
|
18
|
+
__exportStar(require("./localTestLogin.js"), exports);
|
|
18
19
|
__exportStar(require("./server.js"), exports);
|