@softure-ai/auth 0.1.12 → 0.2.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.
Files changed (51) hide show
  1. package/CHANGELOG.md +23 -0
  2. package/README.md +40 -8
  3. package/dist/index.js +2 -2
  4. package/dist/index.js.map +1 -1
  5. package/dist/mailing/reset-mail.d.ts.map +1 -1
  6. package/dist/mailing/reset-mail.js +2 -2
  7. package/dist/mailing/reset-mail.js.map +1 -1
  8. package/dist/messages/index.d.ts +1 -97
  9. package/dist/messages/index.d.ts.map +1 -1
  10. package/dist/messages/index.js +2 -3
  11. package/dist/messages/index.js.map +1 -1
  12. package/dist/next/messages.d.ts +1 -1
  13. package/dist/next/messages.d.ts.map +1 -1
  14. package/dist/next/messages.js +2 -1
  15. package/dist/next/messages.js.map +1 -1
  16. package/dist/proxy/index.d.ts +5 -3
  17. package/dist/proxy/index.d.ts.map +1 -1
  18. package/dist/proxy/index.js +23 -3
  19. package/dist/proxy/index.js.map +1 -1
  20. package/dist/scripts/index.d.ts +1 -0
  21. package/dist/scripts/index.d.ts.map +1 -1
  22. package/dist/scripts/index.js +4 -2
  23. package/dist/scripts/index.js.map +1 -1
  24. package/dist/scripts/seed-account.d.ts +19 -0
  25. package/dist/scripts/seed-account.d.ts.map +1 -0
  26. package/dist/scripts/seed-account.js +95 -0
  27. package/dist/scripts/seed-account.js.map +1 -0
  28. package/dist/server/index.d.ts +1 -0
  29. package/dist/server/index.d.ts.map +1 -1
  30. package/dist/server/index.js +1 -0
  31. package/dist/server/index.js.map +1 -1
  32. package/dist/server/only-account.d.ts +21 -0
  33. package/dist/server/only-account.d.ts.map +1 -0
  34. package/dist/server/only-account.js +34 -0
  35. package/dist/server/only-account.js.map +1 -0
  36. package/module.json +2 -2
  37. package/package.json +7 -7
  38. package/src/index.ts +2 -2
  39. package/src/mailing/reset-mail.ts +2 -2
  40. package/src/messages/index.ts +2 -3
  41. package/src/next/messages.ts +2 -2
  42. package/src/proxy/index.ts +30 -6
  43. package/src/scripts/index.ts +4 -2
  44. package/src/scripts/seed-account.ts +108 -0
  45. package/src/server/index.ts +7 -0
  46. package/src/server/only-account.ts +50 -0
  47. package/dist/messages/pl.d.ts +0 -3
  48. package/dist/messages/pl.d.ts.map +0 -1
  49. package/dist/messages/pl.js +0 -92
  50. package/dist/messages/pl.js.map +0 -1
  51. package/src/messages/pl.ts +0 -93
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/server/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,cAAc,EAAE,KAAK,uBAAuB,EAAE,KAAK,mBAAmB,EAAE,KAAK,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AACzI,OAAO,EAAE,SAAS,EAAE,KAAK,UAAU,EAAE,KAAK,WAAW,EAAE,MAAM,YAAY,CAAC;AAC1E,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,KAAK,UAAU,EAAE,MAAM,cAAc,CAAC;AAC9E,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,aAAa,EAAE,mBAAmB,EAAE,WAAW,EAAE,cAAc,EAAE,KAAK,aAAa,EAAE,MAAM,eAAe,CAAC;AAClJ,OAAO,EACL,oBAAoB,EACpB,qBAAqB,EACrB,oBAAoB,EACpB,sBAAsB,EACtB,kBAAkB,EAClB,mBAAmB,EACnB,oBAAoB,EACpB,aAAa,EACb,iBAAiB,EACjB,KAAK,yBAAyB,EAC9B,KAAK,0BAA0B,EAC/B,KAAK,sBAAsB,EAC3B,KAAK,kBAAkB,EACvB,KAAK,mBAAmB,GACzB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACL,kBAAkB,EAClB,aAAa,EACb,gBAAgB,EAChB,SAAS,EACT,iBAAiB,EACjB,cAAc,EACd,UAAU,EACV,KAAK,UAAU,EACf,KAAK,aAAa,GACnB,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,sBAAsB,EAAE,kBAAkB,EAAE,kBAAkB,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K,yBAAyB,EAC9B,KAAK,0BAA0B,EAC/B,KAAK,sBAAsB,EAC3B,KAAK,kBAAkB,EACvB,KAAK,mBAAmB,GACzB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACL,kBAAkB,EAClB,aAAa,EACb,gBAAgB,EAChB,SAAS,EACT,iBAAiB,EACjB,cAAc,EACd,UAAU,EACV,KAAK,UAAU,EACf,KAAK,aAAa,GACnB,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,sBAAsB,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,KAAK,YAAY,EAAE,MAAM,cAAc,CAAC;AACjH,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,YAAY,EAAE,KAAK,iBAAiB,EAAE,KAAK,aAAa,EAAE,KAAK,cAAc,EAAE,MAAM,eAAe,CAAC;AAC9G,OAAO,EACL,aAAa,EACb,eAAe,EACf,aAAa,EACb,aAAa,EACb,kBAAkB,EAClB,KAAK,WAAW,EAChB,KAAK,yBAAyB,GAC/B,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC;AACrD,OAAO,EAAE,uBAAuB,EAAE,0BAA0B,EAAE,KAAK,wBAAwB,EAAE,MAAM,yBAAyB,CAAC"}
@@ -2,6 +2,7 @@
2
2
  // (`{ db, clock, config }`) and never reads request scope; tokens and client keys come in as values.
3
3
  export { changePassword } from "./change-password.js";
4
4
  export { loginUser } from "./login.js";
5
+ export { resolveOnlyAccount, } from "./only-account.js";
5
6
  export { getAuthOptions, getAuthRoutes } from "./options.js";
6
7
  export { hashPassword, isPasswordHash, matchPassword, MAX_PASSWORD_LENGTH, needsRehash, verifyPassword } from "./password.js";
7
8
  export { deliverPasswordReset, findPasswordResetUser, getPasswordResetLink, isPasswordResetEnabled, issuePasswordReset, prunePasswordResets, requestPasswordReset, resetPassword, RESET_TOKEN_PARAM, } from "./password-reset.js";
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/server/index.ts"],"names":[],"mappings":"AAAA,kFAAkF;AAClF,qGAAqG;AACrG,OAAO,EAAE,cAAc,EAAqF,MAAM,sBAAsB,CAAC;AACzI,OAAO,EAAE,SAAS,EAAqC,MAAM,YAAY,CAAC;AAC1E,OAAO,EAAE,cAAc,EAAE,aAAa,EAAmB,MAAM,cAAc,CAAC;AAC9E,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,aAAa,EAAE,mBAAmB,EAAE,WAAW,EAAE,cAAc,EAAsB,MAAM,eAAe,CAAC;AAClJ,OAAO,EACL,oBAAoB,EACpB,qBAAqB,EACrB,oBAAoB,EACpB,sBAAsB,EACtB,kBAAkB,EAClB,mBAAmB,EACnB,oBAAoB,EACpB,aAAa,EACb,iBAAiB,GAMlB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACL,kBAAkB,EAClB,aAAa,EACb,gBAAgB,EAChB,SAAS,EACT,iBAAiB,EACjB,cAAc,EACd,UAAU,GAGX,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,sBAAsB,EAAE,kBAAkB,EAAE,kBAAkB,EAAqB,MAAM,cAAc,CAAC;AACjH,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,YAAY,EAAmE,MAAM,eAAe,CAAC;AAC9G,OAAO,EACL,aAAa,EACb,eAAe,EACf,aAAa,EACb,aAAa,EACb,kBAAkB,GAGnB,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC;AACrD,OAAO,EAAE,uBAAuB,EAAE,0BAA0B,EAAiC,MAAM,yBAAyB,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/server/index.ts"],"names":[],"mappings":"AAAA,kFAAkF;AAClF,qGAAqG;AACrG,OAAO,EAAE,cAAc,EAAqF,MAAM,sBAAsB,CAAC;AACzI,OAAO,EAAE,SAAS,EAAqC,MAAM,YAAY,CAAC;AAC1E,OAAO,EACL,kBAAkB,GAKnB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,cAAc,EAAE,aAAa,EAAmB,MAAM,cAAc,CAAC;AAC9E,OAAO,EAAE,YAAY,EAAE,cAAc,EAAE,aAAa,EAAE,mBAAmB,EAAE,WAAW,EAAE,cAAc,EAAsB,MAAM,eAAe,CAAC;AAClJ,OAAO,EACL,oBAAoB,EACpB,qBAAqB,EACrB,oBAAoB,EACpB,sBAAsB,EACtB,kBAAkB,EAClB,mBAAmB,EACnB,oBAAoB,EACpB,aAAa,EACb,iBAAiB,GAMlB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EACL,kBAAkB,EAClB,aAAa,EACb,gBAAgB,EAChB,SAAS,EACT,iBAAiB,EACjB,cAAc,EACd,UAAU,GAGX,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,sBAAsB,EAAE,kBAAkB,EAAE,kBAAkB,EAAqB,MAAM,cAAc,CAAC;AACjH,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,YAAY,EAAmE,MAAM,eAAe,CAAC;AAC9G,OAAO,EACL,aAAa,EACb,eAAe,EACf,aAAa,EACb,aAAa,EACb,kBAAkB,GAGnB,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,oBAAoB,EAAE,MAAM,eAAe,CAAC;AACrD,OAAO,EAAE,uBAAuB,EAAE,0BAA0B,EAAiC,MAAM,yBAAyB,CAAC"}
@@ -0,0 +1,21 @@
1
+ import { type Err, type Ok } from "@softure-ai/core";
2
+ import type { Queryable } from "@softure-ai/db";
3
+ export type OnlyAccountErrorCode = "auth.account_unknown" | "auth.no_account" | "auth.account_ambiguous";
4
+ /** Why there is no account to use, with a line for the person running the tool. */
5
+ export type OnlyAccountError = Err<OnlyAccountErrorCode> & {
6
+ readonly message: string;
7
+ };
8
+ export type OnlyAccountResult = Ok<string> | OnlyAccountError;
9
+ export interface ResolveOnlyAccountOptions {
10
+ readonly db: Queryable;
11
+ /** The variable that may name the account's id, e.g. `MCP_USER_ID`. */
12
+ readonly envName: string;
13
+ /** Default: `process.env`. */
14
+ readonly env?: Readonly<Record<string, string | undefined>>;
15
+ }
16
+ /**
17
+ * The id of the account `envName` names (it must exist), or, when the variable is empty or unset,
18
+ * of the only account. Refuses an unknown id, an empty database and several accounts with none named.
19
+ */
20
+ export declare function resolveOnlyAccount(options: ResolveOnlyAccountOptions): Promise<OnlyAccountResult>;
21
+ //# sourceMappingURL=only-account.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"only-account.d.ts","sourceRoot":"","sources":["../../src/server/only-account.ts"],"names":[],"mappings":"AAGA,OAAO,EAAW,KAAK,GAAG,EAAE,KAAK,EAAE,EAAE,MAAM,kBAAkB,CAAC;AAC9D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAMhD,MAAM,MAAM,oBAAoB,GAAG,sBAAsB,GAAG,iBAAiB,GAAG,wBAAwB,CAAC;AAEzG,mFAAmF;AACnF,MAAM,MAAM,gBAAgB,GAAG,GAAG,CAAC,oBAAoB,CAAC,GAAG;IAAE,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAAC;AAExF,MAAM,MAAM,iBAAiB,GAAG,EAAE,CAAC,MAAM,CAAC,GAAG,gBAAgB,CAAC;AAE9D,MAAM,WAAW,yBAAyB;IACxC,QAAQ,CAAC,EAAE,EAAE,SAAS,CAAC;IACvB,uEAAuE;IACvE,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,8BAA8B;IAC9B,QAAQ,CAAC,GAAG,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAAC,CAAC;CAC7D;AAED;;;GAGG;AACH,wBAAsB,kBAAkB,CAAC,OAAO,EAAE,yBAAyB,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAgBvG"}
@@ -0,0 +1,34 @@
1
+ // The one account a local tool acts for (a stdio MCP server, a measurement or seed script): the
2
+ // account an environment variable names, else the only account in the database. Never the first of
3
+ // several: that could be another person's data.
4
+ import { err, ok } from "@softure-ai/core";
5
+ import { eq } from "drizzle-orm";
6
+ import { users } from "../schema.js";
7
+ const UUID_SHAPE = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
8
+ /**
9
+ * The id of the account `envName` names (it must exist), or, when the variable is empty or unset,
10
+ * of the only account. Refuses an unknown id, an empty database and several accounts with none named.
11
+ */
12
+ export async function resolveOnlyAccount(options) {
13
+ const { db, envName } = options;
14
+ const requested = (options.env ?? process.env)[envName]?.trim() ?? "";
15
+ if (requested !== "") {
16
+ const unknown = refuse("auth.account_unknown", `${envName} names no account`);
17
+ // Checked before the query: Postgres rejects a malformed uuid with an error, not an empty result.
18
+ if (!UUID_SHAPE.test(requested))
19
+ return unknown;
20
+ const [found] = await db.select({ id: users.id }).from(users).where(eq(users.id, requested)).limit(1);
21
+ return found === undefined ? unknown : ok(found.id);
22
+ }
23
+ const [only, second] = await db.select({ id: users.id }).from(users).limit(2);
24
+ if (only === undefined)
25
+ return refuse("auth.no_account", "the database has no account");
26
+ if (second !== undefined) {
27
+ return refuse("auth.account_ambiguous", `the database has several accounts; set ${envName} to the id of the one to use`);
28
+ }
29
+ return ok(only.id);
30
+ }
31
+ function refuse(code, message) {
32
+ return { ...err(code), message };
33
+ }
34
+ //# sourceMappingURL=only-account.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"only-account.js","sourceRoot":"","sources":["../../src/server/only-account.ts"],"names":[],"mappings":"AAAA,gGAAgG;AAChG,mGAAmG;AACnG,gDAAgD;AAChD,OAAO,EAAE,GAAG,EAAE,EAAE,EAAqB,MAAM,kBAAkB,CAAC;AAE9D,OAAO,EAAE,EAAE,EAAE,MAAM,aAAa,CAAC;AACjC,OAAO,EAAE,KAAK,EAAE,MAAM,cAAc,CA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AO,MAAM,CAAC,wBAAwB,EAAE,0CAA0C,OAAO,8BAA8B,CAAC,CAAC;IAC3H,CAAC;IACD,OAAO,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;AACrB,CAAC;AAED,SAAS,MAAM,CAAC,IAA0B,EAAE,OAAe;IACzD,OAAO,EAAE,GAAG,GAAG,CAAC,IAAI,CAAC,EAAE,OAAO,EAAE,CAAC;AACnC,CAAC"}
package/module.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "id": "auth",
3
- "version": "0.1.12",
4
- "dependsOn": { "security": "^0.1.0", "mailing": "^0.1.0?", "ops": "^0.1.0?" },
3
+ "version": "0.2.0",
4
+ "dependsOn": { "security": "^0.2.0", "mailing": "^0.2.0?", "ops": "^0.2.0?" },
5
5
  "dbSchema": "auth",
6
6
  "tables": ["users", "sessions", "user_roles", "password_resets"],
7
7
  "env": [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@softure-ai/auth",
3
- "version": "0.1.12",
3
+ "version": "0.2.0",
4
4
  "description": "SOFTURE AI auth module: users, scrypt passwords, database sessions, register with consent, login, logout, password change, roles, a proxy route guard, pages and forms for Next.js, and a password reset sender over @softure-ai/mailing.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -72,21 +72,21 @@
72
72
  "build": "tsc -p tsconfig.build.json"
73
73
  },
74
74
  "dependencies": {
75
- "@softure-ai/core": "^0.1.8",
75
+ "@softure-ai/core": "^0.2.0",
76
76
  "@softure-ai/db": "^0.1.0",
77
- "@softure-ai/security": "^0.1.8",
77
+ "@softure-ai/security": "^0.2.0",
78
78
  "zod": "^4.6.5"
79
79
  },
80
80
  "peerDependencies": {
81
- "@softure-ai/mailing": "^0.1.0",
82
- "@softure-ai/ops": "^0.1.0",
83
- "@softure-ai/ui": "^0.1.0",
81
+ "@softure-ai/mailing": "^0.2.0",
82
+ "@softure-ai/ops": "^0.2.0",
83
+ "@softure-ai/ui": "^0.3.0",
84
84
  "drizzle-orm": "^0.45.2",
85
85
  "next": "^16.0.0",
86
86
  "react": "^19.0.0"
87
87
  },
88
88
  "devDependencies": {
89
- "@softure-ai/ui": "^0.1.7"
89
+ "@softure-ai/ui": "^0.3.0"
90
90
  },
91
91
  "peerDependenciesMeta": {
92
92
  "@softure-ai/mailing": {
package/src/index.ts CHANGED
@@ -42,8 +42,8 @@ export const AUTH_RATE_LIMIT_BUCKETS = {
42
42
  export const auth = defineModule({
43
43
  manifest: {
44
44
  id: MODULE_ID,
45
- version: "0.1.12",
46
- dependsOn: { security: "^0.1.0", mailing: "^0.1.0?", ops: "^0.1.0?" },
45
+ version: "0.2.0",
46
+ dependsOn: { security: "^0.2.0", mailing: "^0.2.0?", ops: "^0.2.0?" },
47
47
  dbSchema: "auth",
48
48
  tables: ["users", "sessions", "user_roles", "password_resets"],
49
49
  env: [
@@ -1,7 +1,7 @@
1
1
  // The password reset mail: rendered from auth's dictionaries in the app's locale and sent through
2
2
  // `@softure-ai/mailing`. A transactional mail: no unsubscribe link, never suppressed. The link is
3
3
  // placed by the code, never by a translatable string, so a copy override cannot drop it.
4
- import { formatMessage, selectPlural, type Locale, type SoftureConfig } from "@softure-ai/core";
4
+ import { formatMessage, type Locale, selectMessages, selectPlural, type SoftureConfig } from "@softure-ai/core";
5
5
  import { getSoftureConfig } from "@softure-ai/core/next";
6
6
  import type { OutgoingMail } from "@softure-ai/mailing";
7
7
  import { sendMail } from "@softure-ai/mailing/server";
@@ -49,7 +49,7 @@ export function renderPasswordResetMail(messages: AuthMessages, locale: Locale,
49
49
  /** The app's auth dictionary for `locale`, with its overrides applied. */
50
50
  function getMessages(config: SoftureConfig, locale: Locale): AuthMessages {
51
51
  // The module factory merged the dictionaries; their shape is the module's own.
52
- return getAuthModule(config).messages[locale] as AuthMessages;
52
+ return selectMessages(getAuthModule(config).messages, locale) as AuthMessages;
53
53
  }
54
54
 
55
55
  /**
@@ -1,9 +1,8 @@
1
1
  import type { AuthFormErrorCode } from "../contract.js";
2
2
  import { en } from "./en.js";
3
- import { pl } from "./pl.js";
4
3
 
5
- /** Complete default dictionaries; apps pass partial overrides per locale. */
6
- export const authMessages = { en, pl };
4
+ /** The built-in English dictionary; an app passes partial overrides or its own translation per locale. */
5
+ export const authMessages = { en };
7
6
 
8
7
  export type AuthMessages = typeof en;
9
8
 
@@ -1,9 +1,9 @@
1
- import type { SoftureConfig } from "@softure-ai/core";
1
+ import { selectMessages, type SoftureConfig } from "@softure-ai/core";
2
2
  import type { AuthMessages } from "../messages/index.js";
3
3
  import { getAuthModule } from "../server/options.js";
4
4
 
5
5
  /** The module's copy in the app's locale, with the app's overrides applied. */
6
6
  export function getAuthMessages(config: SoftureConfig): AuthMessages {
7
7
  // The module factory merged the dictionaries; their shape is the module's own.
8
- return getAuthModule(config).messages[config.locale] as AuthMessages;
8
+ return selectMessages(getAuthModule(config).messages, config.locale) as AuthMessages;
9
9
  }
@@ -32,9 +32,11 @@ export interface AuthGuardOptions {
32
32
  */
33
33
  readonly trustedOrigins?: readonly string[];
34
34
  /**
35
- * `"absolute"` (default): the login URL is built on the resolved origin (above). `"relative"`: the `Location` is
36
- * the path only (`/login?next=…`), so the browser stays on whatever host and port it used; for a stack served on
37
- * ports or hosts the config cannot list (an integration run on a random port).
35
+ * `"absolute"` (default): the login URL is built on the resolved origin (above). `"relative"`: it is built on the
36
+ * request URL's own origin, which Next's proxy sends to the browser as the path only (`/login?next=…`), so the
37
+ * browser stays on whatever host and port it used; for a stack served on ports or hosts the config cannot list (an
38
+ * integration run on a random port). Outside Next the `Location` stays absolute on that origin, which behind a
39
+ * reverse proxy is the internal one: keep the default there.
38
40
  */
39
41
  readonly redirect?: "absolute" | "relative";
40
42
  }
@@ -76,13 +78,35 @@ export function createAuthGuard(config: SoftureConfig, options: AuthGuardOptions
76
78
  // Built on appOrigin, or on the request's public origin when the app trusts it: behind a proxy
77
79
  // the request URL carries an internal host, and request headers alone are never trusted.
78
80
  const login = new URL(routes.login, resolveAppOrigin(config, request, { trustedOrigins }));
79
- login.searchParams.set("next", `${url.pathname}${url.search}`);
81
+ login.searchParams.set("next", getReturnPath(url));
80
82
  if (options.redirect !== "relative") return Response.redirect(login, 307);
81
- // A path-only Location reads no request header at all; `Response.redirect` would need an absolute URL.
82
- return new Response(null, { status: 307, headers: { location: `${login.pathname}${login.search}` } });
83
+ // On the origin the request URL names, reading no request header. Next's proxy needs an absolute Location
84
+ // (a path-only one is a 500) and sends a same-host one to the browser path-only (#452).
85
+ return Response.redirect(new URL(`${login.pathname}${login.search}`, url.origin), 307);
83
86
  };
84
87
  }
85
88
 
89
+ /** Next's client-navigation cache key: meaningless to the page, so it never belongs in a return address. */
90
+ const NEXT_CACHE_KEY = "_rsc";
91
+
92
+ /**
93
+ * The path and query to come back to after sign-in, without Next's `_rsc`. The raw query segments are
94
+ * filtered rather than rebuilt, so every other parameter keeps the spelling the request gave it.
95
+ */
96
+ function getReturnPath(url: URL): string {
97
+ const segments = url.search.slice(1).split("&").filter((segment) => segment !== "" && !isNextCacheKey(segment));
98
+ return segments.length === 0 ? url.pathname : `${url.pathname}?${segments.join("&")}`;
99
+ }
100
+
101
+ function isNextCacheKey(segment: string): boolean {
102
+ const name = segment.split("=", 1)[0] ?? "";
103
+ try {
104
+ return decodeURIComponent(name) === NEXT_CACHE_KEY;
105
+ } catch {
106
+ return false;
107
+ }
108
+ }
109
+
86
110
  function normalizePrefix(prefix: string, kind: "protected" | "excluded"): string {
87
111
  if (!prefix.startsWith("/")) {
88
112
  throw new Error(`createAuthGuard: ${kind} path "${prefix}" must start with /`);
@@ -1,8 +1,10 @@
1
- // `@softure-ai/auth/scripts`: ops scripts that grant and revoke roles and set a temporary password
2
- // (see the README, "Roles" and "Account recovery").
1
+ // `@softure-ai/auth/scripts`: ops scripts that grant and revoke roles and set a temporary password,
2
+ // and the development seed account
3
+ // (see the README, "Roles", "Account recovery" and "Development seed").
3
4
  export { createGrantRoleScript, createRevokeRoleScript, type RoleScriptArgs, type RoleScriptOptions } from "./role-scripts.js";
4
5
  export {
5
6
  createSetTemporaryPasswordScript,
6
7
  type TemporaryPasswordScriptArgs,
7
8
  type TemporaryPasswordScriptOptions,
8
9
  } from "./temporary-password.js";
10
+ export { runSeedAccount, type RunSeedAccountOptions } from "./seed-account.js";
@@ -0,0 +1,108 @@
1
+ // A development login account from `SEED_EMAIL` and `SEED_PASSWORD`, created through the module's
2
+ // registration, so the app's `onRegistered` hook runs as for a real sign-up. Idempotent: an account
3
+ // with that email is left as it is. Not an ops script: it refuses to run with NODE_ENV=production.
4
+ //
5
+ // // scripts/seed.ts, run with `tsx scripts/seed.ts`
6
+ // import { runSeedAccount } from "@softure-ai/auth/scripts";
7
+ // import config from "../softure.config";
8
+ // process.exitCode = await runSeedAccount({ config });
9
+ import { errorLogLabel, safeError, systemClock, type Clock, type SoftureConfig } from "@softure-ai/core";
10
+ import { openCommandDatabase, type Database } from "@softure-ai/db";
11
+ import { EXIT_FAILED, EXIT_OK, EXIT_USAGE, type CliOutput } from "@softure-ai/db/cli";
12
+ import { registerUser, type RegisterErrorCode } from "../server/register.js";
13
+ import { logoutSession, type AuthContext } from "../server/sessions.js";
14
+ import { normalizeEmail } from "../server/validation.js";
15
+
16
+ const NAME = "seed-account";
17
+ /** The rate limit key the seed counts registration attempts under. */
18
+ const SEED_CLIENT_KEY = "script:seed";
19
+
20
+ export interface RunSeedAccountOptions {
21
+ readonly config: SoftureConfig;
22
+ /** Default: `process.env`. Reads `SEED_EMAIL`, `SEED_PASSWORD` and `NODE_ENV`. */
23
+ readonly env?: Readonly<Record<string, string | undefined>>;
24
+ /** An open database to use instead of the config's (tests); it is not closed. */
25
+ readonly database?: Database;
26
+ /** Default: the console. The password is never printed. */
27
+ readonly output?: CliOutput;
28
+ readonly clock?: Clock;
29
+ }
30
+
31
+ const REFUSALS: Readonly<Record<Exclude<RegisterErrorCode, "auth.email_taken">, string>> = {
32
+ "auth.registration_closed": "registration is closed by a switch; open it for the seed run",
33
+ "auth.email_invalid": "SEED_EMAIL is not a valid email",
34
+ "auth.password_too_short": "SEED_PASSWORD is shorter than password.minLength",
35
+ "auth.password_too_long": "SEED_PASSWORD is longer than the module accepts",
36
+ "auth.consent_required": "registration requires consent",
37
+ };
38
+
39
+ const consoleOutput: CliOutput = {
40
+ log: (line) => console.log(line),
41
+ error: (line) => console.error(line),
42
+ };
43
+
44
+ /**
45
+ * Creates the development account and returns the exit code: 0 created or already there, 1 refused
46
+ * or failed (nothing written), 2 `SEED_EMAIL` or `SEED_PASSWORD` missing.
47
+ */
48
+ export async function runSeedAccount(options: RunSeedAccountOptions): Promise<number> {
49
+ const env = options.env ?? process.env;
50
+ const output = options.output ?? consoleOutput;
51
+ const email = env.SEED_EMAIL?.trim() ?? "";
52
+ const password = env.SEED_PASSWORD ?? "";
53
+ if (email === "" || password.trim() === "") {
54
+ output.error(`${NAME}: set SEED_EMAIL and SEED_PASSWORD to the development account's email and password`);
55
+ return EXIT_USAGE;
56
+ }
57
+ if (env.NODE_ENV === "production") {
58
+ output.error(`${NAME}: refused: NODE_ENV is production; the seed account is for development`);
59
+ return EXIT_FAILED;
60
+ }
61
+
62
+ const opened = await openDatabase(options);
63
+ if (!opened.ok) {
64
+ output.error(`${NAME}: ${opened.message}`);
65
+ return EXIT_FAILED;
66
+ }
67
+ try {
68
+ const ctx: AuthContext = { db: opened.db, clock: options.clock ?? systemClock, config: options.config };
69
+ const registered = await registerUser(ctx, { email, password, hasConsented: true, clientKey: SEED_CLIENT_KEY });
70
+ if (registered.ok) {
71
+ // Registration signs the account in; the seed only wants the account.
72
+ await logoutSession(ctx, registered.value.session.token);
73
+ output.log(`${NAME}: created the account ${registered.value.user.email}`);
74
+ return EXIT_OK;
75
+ }
76
+ if (registered.error === "auth.email_taken") {
77
+ output.log(`${NAME}: ${normalizeEmail(email)} is already there; nothing changed`);
78
+ return EXIT_OK;
79
+ }
80
+ const reason = registered.error === "security.rate_limited" ? "too many registrations from the seed; wait and run it again" : REFUSALS[registered.error];
81
+ output.error(`${NAME}: refused: ${reason} (${registered.error})`);
82
+ return EXIT_FAILED;
83
+ } catch (error) {
84
+ output.error(`${NAME}: failed: ${describeFailure(error)}`);
85
+ return EXIT_FAILED;
86
+ } finally {
87
+ await opened.close();
88
+ }
89
+ }
90
+
91
+ type OpenedDatabase = { readonly ok: true; readonly db: Database; readonly close: () => Promise<void> } | { readonly ok: false; readonly message: string };
92
+
93
+ async function openDatabase(options: RunSeedAccountOptions): Promise<OpenedDatabase> {
94
+ if (options.database !== undefined) return { ok: true, db: options.database, close: () => Promise.resolve() };
95
+ if (options.config.database === null) return { ok: false, message: "the config has no database; set database.url in softure.config" };
96
+ try {
97
+ const opened = await openCommandDatabase(options.config.database, { max: 1 });
98
+ return { ok: true, db: opened.handle.db, close: opened.close };
99
+ } catch (error) {
100
+ return { ok: false, message: `could not open the database: ${describeFailure(error)}` };
101
+ }
102
+ }
103
+
104
+ /** The error message, except for database errors, whose message may carry query parameters (the password hash). */
105
+ function describeFailure(error: unknown): string {
106
+ if (safeError(error).error === "core.database_failed") return `database error (${errorLogLabel(error)})`;
107
+ return error instanceof Error ? error.message : String(error);
108
+ }
@@ -2,6 +2,13 @@
2
2
  // (`{ db, clock, config }`) and never reads request scope; tokens and client keys come in as values.
3
3
  export { changePassword, type ChangePasswordErrorCode, type ChangePasswordInput, type ChangePasswordResult } from "./change-password.js";
4
4
  export { loginUser, type LoginInput, type LoginResult } from "./login.js";
5
+ export {
6
+ resolveOnlyAccount,
7
+ type OnlyAccountError,
8
+ type OnlyAccountErrorCode,
9
+ type OnlyAccountResult,
10
+ type ResolveOnlyAccountOptions,
11
+ } from "./only-account.js";
5
12
  export { getAuthOptions, getAuthRoutes, type AuthRoutes } from "./options.js";
6
13
  export { hashPassword, isPasswordHash, matchPassword, MAX_PASSWORD_LENGTH, needsRehash, verifyPassword, type PasswordMatch } from "./password.js";
7
14
  export {
@@ -0,0 +1,50 @@
1
+ // The one account a local tool acts for (a stdio MCP server, a measurement or seed script): the
2
+ // account an environment variable names, else the only account in the database. Never the first of
3
+ // several: that could be another person's data.
4
+ import { err, ok, type Err, type Ok } from "@softure-ai/core";
5
+ import type { Queryable } from "@softure-ai/db";
6
+ import { eq } from "drizzle-orm";
7
+ import { users } from "../schema.js";
8
+
9
+ const UUID_SHAPE = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
10
+
11
+ export type OnlyAccountErrorCode = "auth.account_unknown" | "auth.no_account" | "auth.account_ambiguous";
12
+
13
+ /** Why there is no account to use, with a line for the person running the tool. */
14
+ export type OnlyAccountError = Err<OnlyAccountErrorCode> & { readonly message: string };
15
+
16
+ export type OnlyAccountResult = Ok<string> | OnlyAccountError;
17
+
18
+ export interface ResolveOnlyAccountOptions {
19
+ readonly db: Queryable;
20
+ /** The variable that may name the account's id, e.g. `MCP_USER_ID`. */
21
+ readonly envName: string;
22
+ /** Default: `process.env`. */
23
+ readonly env?: Readonly<Record<string, string | undefined>>;
24
+ }
25
+
26
+ /**
27
+ * The id of the account `envName` names (it must exist), or, when the variable is empty or unset,
28
+ * of the only account. Refuses an unknown id, an empty database and several accounts with none named.
29
+ */
30
+ export async function resolveOnlyAccount(options: ResolveOnlyAccountOptions): Promise<OnlyAccountResult> {
31
+ const { db, envName } = options;
32
+ const requested = (options.env ?? process.env)[envName]?.trim() ?? "";
33
+ if (requested !== "") {
34
+ const unknown = refuse("auth.account_unknown", `${envName} names no account`);
35
+ // Checked before the query: Postgres rejects a malformed uuid with an error, not an empty result.
36
+ if (!UUID_SHAPE.test(requested)) return unknown;
37
+ const [found] = await db.select({ id: users.id }).from(users).where(eq(users.id, requested)).limit(1);
38
+ return found === undefined ? unknown : ok(found.id);
39
+ }
40
+ const [only, second] = await db.select({ id: users.id }).from(users).limit(2);
41
+ if (only === undefined) return refuse("auth.no_account", "the database has no account");
42
+ if (second !== undefined) {
43
+ return refuse("auth.account_ambiguous", `the database has several accounts; set ${envName} to the id of the one to use`);
44
+ }
45
+ return ok(only.id);
46
+ }
47
+
48
+ function refuse(code: OnlyAccountErrorCode, message: string): OnlyAccountError {
49
+ return { ...err(code), message };
50
+ }
@@ -1,3 +0,0 @@
1
- import type { en } from "./en.js";
2
- export declare const pl: typeof en;
3
- //# sourceMappingURL=pl.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"pl.d.ts","sourceRoot":"","sources":["../../src/messages/pl.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,SAAS,CAAC;AAElC,eAAO,MAAM,EAAE,EAAE,OAAO,EA0FvB,CAAC"}
@@ -1,92 +0,0 @@
1
- export const pl = {
2
- fields: {
3
- email: "E-mail",
4
- password: "Hasło",
5
- currentPassword: "Obecne hasło",
6
- newPassword: "Nowe hasło",
7
- newPasswordHint: "Co najmniej {minLength} znaków.",
8
- consent: "Akceptuję regulamin i politykę prywatności.",
9
- },
10
- login: {
11
- title: "Zaloguj się",
12
- lead: "Witaj ponownie.",
13
- submit: "Zaloguj się",
14
- pending: "Logowanie…",
15
- noAccount: "Nie masz jeszcze konta?",
16
- registerLink: "Załóż je",
17
- forgotPassword: "Nie pamiętasz hasła?",
18
- },
19
- register: {
20
- title: "Załóż konto",
21
- lead: "To zajmie chwilę.",
22
- submit: "Załóż konto",
23
- pending: "Zakładanie…",
24
- hasAccount: "Masz już konto?",
25
- loginLink: "Zaloguj się",
26
- closedTitle: "Rejestracja jest zamknięta",
27
- closedBody: "Nie można teraz założyć nowego konta. Spróbuj ponownie później.",
28
- },
29
- changePassword: {
30
- title: "Zmień hasło",
31
- lead: "Wszystkie inne urządzenia, na których jesteś zalogowany, zostaną wylogowane.",
32
- submit: "Zmień hasło",
33
- pending: "Zapisywanie…",
34
- success: "Hasło zostało zmienione.",
35
- },
36
- forgotPassword: {
37
- title: "Zresetuj hasło",
38
- lead: "Podaj e-mail swojego konta, a wyślemy Ci link do ustawienia nowego hasła.",
39
- submit: "Wyślij link",
40
- pending: "Wysyłanie…",
41
- sent: "Jeśli istnieje konto z tym adresem, wysłaliśmy na niego link do zmiany hasła. Link działa przez {ttlMinutes} minut.",
42
- backToLogin: "Wróć do logowania",
43
- },
44
- resetPassword: {
45
- title: "Ustaw nowe hasło",
46
- lead: "Zostaniesz wylogowany na wszystkich urządzeniach.",
47
- submit: "Ustaw hasło",
48
- pending: "Zapisywanie…",
49
- success: "Hasło zostało zmienione. Zaloguj się nowym hasłem.",
50
- invalidTitle: "Ten link nie działa",
51
- invalidBody: "Link wygasł albo został już użyty. Poproś o nowy.",
52
- requestNew: "Wyślij nowy link",
53
- },
54
- resetMail: {
55
- subject: "Zresetuj hasło",
56
- greeting: "Dzień dobry,",
57
- intro: "Otrzymaliśmy prośbę o zresetowanie hasła do Twojego konta. Otwórz ten link, aby ustawić nowe:",
58
- action: "Ustaw nowe hasło",
59
- expiry: "Link działa przez {duration} i tylko raz.",
60
- minutes: { one: "{count} minutę", few: "{count} minuty", many: "{count} minut", other: "{count} minuty" },
61
- ignore: "Jeśli to nie Ty, zignoruj tę wiadomość: Twoje hasło się nie zmieni.",
62
- },
63
- logout: {
64
- submit: "Wyloguj się",
65
- },
66
- errors: {
67
- auth: {
68
- invalid_credentials: "Nieprawidłowy e-mail lub hasło.",
69
- email_invalid: "Podaj prawidłowy adres e-mail.",
70
- email_taken: "Konto z tym adresem e-mail już istnieje.",
71
- password_too_short: "Hasło jest za krótkie.",
72
- password_too_long: "Hasło jest za długie.",
73
- consent_required: "Aby założyć konto, zaakceptuj regulamin.",
74
- registration_closed: "Rejestracja jest zamknięta.",
75
- current_password_invalid: "Obecne hasło jest nieprawidłowe.",
76
- password_unchanged: "Nowe hasło musi różnić się od obecnego.",
77
- unauthenticated: "Sesja wygasła. Zaloguj się ponownie.",
78
- forbidden: "Nie masz dostępu do tej funkcji.",
79
- reset_token_invalid: "Ten link wygasł albo został już użyty. Poproś o nowy.",
80
- password_reset_unavailable: "Reset hasła jest niedostępny.",
81
- },
82
- security: {
83
- rate_limited: "Zbyt wiele prób. Odczekaj kilka minut i spróbuj ponownie.",
84
- client_unidentified: "Nie udało się ustalić, skąd przyszło to żądanie. Spróbuj ponownie później.",
85
- },
86
- core: {
87
- database_failed: "Coś poszło nie tak po naszej stronie. Spróbuj ponownie za chwilę.",
88
- unexpected: "Coś poszło nie tak po naszej stronie. Spróbuj ponownie za chwilę.",
89
- },
90
- },
91
- };
92
- //# sourceMappingURL=pl.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"pl.js","sourceRoot":"","sources":["../../src/messages/pl.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,EAAE,GAAc;IAC3B,MAAM,EAAE;QACN,KAAK,EAAE,QAAQ;QACf,QAAQ,EAAE,OAAO;QACjB,eAAe,EAAE,cAAc;QAC/B,WAAW,EAAE,YAAY;QACzB,eAAe,EAAE,iCAAiC;QAClD,OAAO,EAAE,6CAA6C;KACvD;IACD,KAAK,EAAE;QACL,KAAK,EAAE,aAAa;QACpB,IAAI,EAAE,iBAAiB;QACvB,MAAM,EAAE,aAAa;QACrB,OAAO,EAAE,YAAY;QACrB,SAAS,EAAE,yBAAyB;QACpC,YAAY,EAAE,UAAU;QACxB,cAAc,EAAE,sBAAsB;KACvC;IACD,QAAQ,EAAE;QACR,KAAK,EAAE,aAAa;QACpB,IAAI,EAAE,mBAAmB;QACzB,MAAM,EAAE,aAAa;QACrB,OAAO,EAAE,aAAa;QACtB,UAAU,EAAE,iBAAiB;QAC7B,SAAS,EAAE,aAAa;QACxB,WAAW,EAAE,4BAA4B;QACzC,UAAU,EAAE,iEAAiE;KAC9E;IACD,cAAc,EAAE;QACd,KAAK,EAAE,aAAa;QACpB,IAAI,EAAE,8EAA8E;QACpF,MAAM,EAAE,aAAa;QACrB,OAAO,EAAE,cAAc;QACvB,OAAO,EAAE,0BAA0B;KACpC;IACD,cAAc,EAAE;QACd,KAAK,EAAE,gBAAgB;QACvB,IAAI,EAAE,2EAA2E;QACjF,MAAM,EAAE,aAAa;QAC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