@checkstack/auth-backend 0.4.9 → 0.4.11
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 +19 -0
- package/package.json +12 -10
- package/src/index.ts +28 -9
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,24 @@
|
|
|
1
1
|
# @checkstack/auth-backend
|
|
2
2
|
|
|
3
|
+
## 0.4.11
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 67158e2: Standardize package metadata, unify AJV versions to 8.18.0, and enforce monorepo architecture rules via updated ESLint configuration. This ensures consistent package discovery and runtime dependency safety across the platform.
|
|
8
|
+
- b839ccb: Security: Hardened production Docker image by upgrading Alpine system libraries, migrating to Drizzle beta (v1.0.0-beta.21), and implementing aggressive binary pruning to eliminate vulnerable build-time tools (esbuild/drizzle-kit).
|
|
9
|
+
- Updated dependencies [67158e2]
|
|
10
|
+
- @checkstack/auth-common@0.5.7
|
|
11
|
+
- @checkstack/backend-api@0.8.2
|
|
12
|
+
- @checkstack/command-backend@0.1.13
|
|
13
|
+
- @checkstack/common@0.6.4
|
|
14
|
+
- @checkstack/notification-common@0.2.7
|
|
15
|
+
|
|
16
|
+
## 0.4.10
|
|
17
|
+
|
|
18
|
+
### Patch Changes
|
|
19
|
+
|
|
20
|
+
- eb353a4: Fix TypeError in better-auth initialization when LDAP or SAML strategies are enabled. Non-social strategies are now correctly filtered out from the socialProviders configuration, and standard social providers (GitHub) are correctly initialized using their respective factory functions.
|
|
21
|
+
|
|
3
22
|
## 0.4.9
|
|
4
23
|
|
|
5
24
|
### Patch Changes
|
package/package.json
CHANGED
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@checkstack/auth-backend",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.11",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "src/index.ts",
|
|
6
|
+
"checkstack": {
|
|
7
|
+
"type": "backend"
|
|
8
|
+
},
|
|
6
9
|
"scripts": {
|
|
7
10
|
"typecheck": "tsc --noEmit",
|
|
8
11
|
"generate": "drizzle-kit generate",
|
|
@@ -11,24 +14,23 @@
|
|
|
11
14
|
"test": "bun test"
|
|
12
15
|
},
|
|
13
16
|
"dependencies": {
|
|
14
|
-
"@checkstack/auth-common": "0.5.
|
|
15
|
-
"@checkstack/backend-api": "0.8.
|
|
16
|
-
"@checkstack/notification-common": "0.2.
|
|
17
|
-
"@checkstack/command-backend": "0.1.
|
|
17
|
+
"@checkstack/auth-common": "0.5.6",
|
|
18
|
+
"@checkstack/backend-api": "0.8.1",
|
|
19
|
+
"@checkstack/notification-common": "0.2.6",
|
|
20
|
+
"@checkstack/command-backend": "0.1.12",
|
|
18
21
|
"better-auth": "^1.4.7",
|
|
19
|
-
"drizzle-orm": "^0.45.
|
|
20
|
-
"hono": "^4.
|
|
22
|
+
"drizzle-orm": "^0.45.0",
|
|
23
|
+
"hono": "^4.12.14",
|
|
21
24
|
"jose": "^6.1.3",
|
|
22
25
|
"zod": "^4.2.1",
|
|
23
|
-
"@checkstack/common": "0.6.
|
|
26
|
+
"@checkstack/common": "0.6.3",
|
|
27
|
+
"@orpc/server": "^1.13.2"
|
|
24
28
|
},
|
|
25
29
|
"devDependencies": {
|
|
26
30
|
"@checkstack/drizzle-helper": "0.0.3",
|
|
27
31
|
"@checkstack/scripts": "0.1.1",
|
|
28
32
|
"@checkstack/tsconfig": "0.0.3",
|
|
29
|
-
"@orpc/server": "^1.13.2",
|
|
30
33
|
"@types/node": "^20.0.0",
|
|
31
|
-
"drizzle-kit": "^0.31.8",
|
|
32
34
|
"typescript": "^5.0.0"
|
|
33
35
|
}
|
|
34
36
|
}
|
package/src/index.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { betterAuth } from "better-auth";
|
|
2
|
+
import * as socialProviderFactories from "better-auth/social-providers";
|
|
2
3
|
import { drizzleAdapter } from "better-auth/adapters/drizzle";
|
|
3
4
|
import { APIError } from "better-auth/api";
|
|
4
5
|
import {
|
|
@@ -19,7 +20,7 @@ import { NotificationApi } from "@checkstack/notification-common";
|
|
|
19
20
|
import * as schema from "./schema";
|
|
20
21
|
import { eq, inArray } from "drizzle-orm";
|
|
21
22
|
import { SafeDatabase } from "@checkstack/backend-api";
|
|
22
|
-
import { User } from "better-auth/types";
|
|
23
|
+
import { BetterAuthOptions, User } from "better-auth/types";
|
|
23
24
|
import { verifyPassword } from "better-auth/crypto";
|
|
24
25
|
import { createExtensionPoint } from "@checkstack/backend-api";
|
|
25
26
|
import { enrichUser } from "./utils/user";
|
|
@@ -515,10 +516,23 @@ export default createBackendPlugin({
|
|
|
515
516
|
strategy.id
|
|
516
517
|
}: ${Object.keys(strategyConfig || {}).join(", ")}`,
|
|
517
518
|
);
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
);
|
|
519
|
+
|
|
520
|
+
const providerFactory = (
|
|
521
|
+
socialProviderFactories as Record<string, unknown>
|
|
522
|
+
)[strategy.id];
|
|
523
|
+
|
|
524
|
+
if (typeof providerFactory === "function") {
|
|
525
|
+
socialProviders[strategy.id] = (
|
|
526
|
+
providerFactory as (options: unknown) => unknown
|
|
527
|
+
)(strategyConfig);
|
|
528
|
+
logger.debug(
|
|
529
|
+
`[auth-backend] -> ✅ Added ${strategy.id} to socialProviders`,
|
|
530
|
+
);
|
|
531
|
+
} else {
|
|
532
|
+
logger.debug(
|
|
533
|
+
`[auth-backend] -> Strategy ${strategy.id} is not a standard social provider, skipping better-auth registration`,
|
|
534
|
+
);
|
|
535
|
+
}
|
|
522
536
|
}
|
|
523
537
|
|
|
524
538
|
// Check if credential strategy is enabled from meta config
|
|
@@ -550,7 +564,7 @@ export default createBackendPlugin({
|
|
|
550
564
|
} social providers: ${Object.keys(socialProviders).join(", ")}`,
|
|
551
565
|
);
|
|
552
566
|
|
|
553
|
-
|
|
567
|
+
const authOptions: BetterAuthOptions = {
|
|
554
568
|
database: drizzleAdapter(database, {
|
|
555
569
|
provider: "pg",
|
|
556
570
|
schema: { ...schema },
|
|
@@ -572,10 +586,13 @@ export default createBackendPlugin({
|
|
|
572
586
|
const resetToken = parsedUrl.searchParams.get("token");
|
|
573
587
|
if (!resetToken) {
|
|
574
588
|
throw new APIError("BAD_REQUEST", {
|
|
575
|
-
message:
|
|
589
|
+
message:
|
|
590
|
+
"Malformed password reset URL: missing token parameter",
|
|
576
591
|
});
|
|
577
592
|
}
|
|
578
|
-
const resetUrl = `${frontendUrl}/auth/reset-password?token=${encodeURIComponent(
|
|
593
|
+
const resetUrl = `${frontendUrl}/auth/reset-password?token=${encodeURIComponent(
|
|
594
|
+
resetToken,
|
|
595
|
+
)}`;
|
|
579
596
|
|
|
580
597
|
void notificationClient.sendTransactional({
|
|
581
598
|
userId: user.id,
|
|
@@ -634,7 +651,9 @@ export default createBackendPlugin({
|
|
|
634
651
|
},
|
|
635
652
|
},
|
|
636
653
|
},
|
|
637
|
-
}
|
|
654
|
+
};
|
|
655
|
+
|
|
656
|
+
return betterAuth(authOptions);
|
|
638
657
|
};
|
|
639
658
|
|
|
640
659
|
// Initialize better-auth
|