Skip to content

Commit 42aa5ef

Browse files
authored
Update to node 24.22.1 as well as bump the deps (#410)
* chore: update Node.js to 24.22.1 and bump dependencies Node.js 24.22.1 fixes the Brotli decoder buffer overflow (Brotli 1.0.3-1.2.0). Node's fetch decodes Content-Encoding: br responses from upstream services automatically. Bump dependencies to the latest versions within their semver ranges. Held back: - better-auth / @better-auth/drizzle-adapter on ~1.6.33: 1.7.0 drops genericOAuthClient from better-auth/client/plugins - tar-stream on 3.2.0: 3.2.1+ ships its own typings that conflict with @types/tar-stream and archive.ts Unpin @smithy/node-http-handler so it dedupes with the AWS SDK's copy. * chore(deps): bump globals from 16.5.0 to 17.13.0 Only breaking change splits audioWorklet globals out of browser; not used here. * chore(deps): bump prettier-plugin-tailwindcss from 0.7.4 to 0.8.1 Requires Prettier >= 3.7 (we have 3.9). No formatting changes. * chore(deps): bump oauth2-mock-server from 8.2.3 to 9.3.0 9.0 drops Node 20 and replaces Express with plain Node HTTP handlers. The E2E mock only reads req.headers, which is unchanged. * chore(deps): bump typescript from 5.9.3 to 6.0.3 TypeScript 7 is not an option yet: it ships no compiler API, and svelte-check, svelte2tsx, typescript-eslint and SvelteKit 2 all cap their peer range at 6. * chore(deps): bump tar-stream from 3.2.0 to 3.2.2 3.2.1 ships its own typings, so drop @types/tar-stream and adapt archive.ts: Header instead of Headers, the entry stream type from ExtractEvents, inferred entry handler parameters, and an explicit Buffer cast for streamx data events. No runtime changes between 3.2.0 and 3.2.2. * chore(deps): bump monaco-editor from 0.55.1 to 0.57.0 0.56 reorganised the package exports, so the deep esm/ imports no longer resolve. Switch the editor worker and German NLS bundle to the public export paths; the NLS bundle now ships types, so drop the ts-expect-error. Monaco 0.57 pins DOMPurify to 3.4.15. Raise the override to ^3.4.17 for the latest sanitisation fixes and correct the stale note. * chore(deps): keep axe-core at 4.13.0 like main * chore(deps): bump better-auth to 1.7.12 better-auth 1.7 turns the generic OAuth plugin into a social provider: - sign in via signIn.social({ provider }) instead of signIn.oauth2 - genericOAuthClient() no longer exists - profile claims are typed unknown, so narrow them before mapping The OAuth callback path moves from /api/auth/oauth2/callback/oidc to /api/auth/callback/oidc. Deployments whose IdP has the exact old redirect URI registered must update it. * chore(deps): update in-range dependencies Bump within existing ranges: - @aws-sdk/client-s3, @aws-sdk/lib-storage 3.1152.0 -> 3.1155.0 - typescript-eslint 8.71.2 -> 8.72.0 - @inlang/paraglide-js 2.29.0 -> 2.29.1 - knip 6.42.0 -> 6.42.1 - eslint-plugin-better-tailwindcss 4.9.1 -> 4.10.0 - @iconify-json/vscode-icons 1.2.91 -> 1.2.92 Also apply npm audit fix for fast-uri 3.1.8 -> 3.1.9. * chore(deps): bump unplugin-icons to 24 * Fix login after better-auth 1.7 upgrade better-auth 1.7 routes generic OAuth callbacks through the shared /callback/:id endpoint, so the trinoUser write guard from #397 rejected every OIDC sign-in. Take the path from the callbackOAuth endpoint.
1 parent 3681a3b commit 42aa5ef

12 files changed

Lines changed: 10717 additions & 10490 deletions

File tree

‎.node-version‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
24.21.0
1+
24.22.1

‎.nvmrc‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
24.21.0
1+
24.22.1

‎package-lock.json‎

Lines changed: 10576 additions & 10339 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

‎package.json‎

Lines changed: 56 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -30,95 +30,94 @@
3030
},
3131
"devDependencies": {
3232
"@axe-core/playwright": "^4.13.0",
33-
"@cyclonedx/cyclonedx-npm": "^6.0.0",
34-
"@eslint/compat": "^2.0.2",
33+
"@cyclonedx/cyclonedx-npm": "^6.0.1",
34+
"@eslint/compat": "^2.1.1",
3535
"@eslint/js": "^9.39.2",
36-
"@faker-js/faker": "^10.4.0",
36+
"@faker-js/faker": "^10.6.0",
3737
"@iconify-json/lsicon": "^1.2.5",
38-
"@iconify-json/material-icon-theme": "^1.2.67",
39-
"@iconify-json/material-symbols": "^1.2.74",
40-
"@iconify-json/vscode-icons": "^1.2.55",
41-
"@inlang/paraglide-js": "^2.12.0",
38+
"@iconify-json/material-icon-theme": "^1.2.72",
39+
"@iconify-json/material-symbols": "^1.2.95",
40+
"@iconify-json/vscode-icons": "^1.2.91",
41+
"@inlang/paraglide-js": "^2.29.0",
4242
"@playwright/test": "1.61.1",
43-
"@sveltejs/adapter-node": "^5.5.3",
43+
"@sveltejs/adapter-node": "^5.5.7",
4444
"@sveltejs/enhanced-img": "^0.11.0",
45-
"@sveltejs/kit": "^2.53.0",
45+
"@sveltejs/kit": "^2.70.3",
4646
"@sveltejs/vite-plugin-svelte": "^6.2.4",
47-
"@tailwindcss/vite": "^4.2.1",
48-
"@testcontainers/postgresql": "^12.0.1",
49-
"@types/node": "^24",
47+
"@tailwindcss/vite": "^4.3.3",
48+
"@testcontainers/postgresql": "^12.2.1",
49+
"@types/node": "^24.19.2",
5050
"@types/papaparse": "^5.5.2",
51-
"@types/pg": "^8.20.0",
52-
"@types/tar-stream": "^3.1.4",
51+
"@types/pg": "^8.23.1",
5352
"@vitest/browser-playwright": "^4.1.11",
5453
"@vitest/coverage-v8": "^4.1.11",
5554
"antlr-ng": "^1.0.10",
56-
"archunit": "^2.3.3",
57-
"daisyui": "^5.5.19",
55+
"archunit": "^2.5.4",
56+
"daisyui": "^5.7.50",
5857
"devalue": "^5.9.4",
59-
"drizzle-kit": "^0.31.10",
60-
"eslint": "^9.39.2",
58+
"drizzle-kit": "^0.31.11",
59+
"eslint": "^9.39.5",
6160
"eslint-config-prettier": "^10.1.8",
6261
"eslint-import-resolver-typescript": "^4.4.5",
63-
"eslint-plugin-better-tailwindcss": "^4.3.0",
62+
"eslint-plugin-better-tailwindcss": "^4.9.1",
6463
"eslint-plugin-check-file": "^3.3.2",
6564
"eslint-plugin-import": "^2.32.0",
66-
"eslint-plugin-security": "^4.0.0",
67-
"eslint-plugin-svelte": "^3.15.0",
68-
"globals": "^16.5.0",
69-
"knip": "^6.37.0",
70-
"oauth2-mock-server": "^8.2.2",
71-
"pino-pretty": "^13.1.3",
72-
"prettier": "^3.8.1",
73-
"prettier-plugin-svelte": "^3.5.0",
74-
"prettier-plugin-tailwindcss": "^0.7.2",
75-
"svelte": "^5.53.3",
76-
"svelte-check": "^4.4.3",
77-
"sveltekit-superforms": "^2.30.0",
65+
"eslint-plugin-security": "^4.2.0",
66+
"eslint-plugin-svelte": "^3.23.1",
67+
"globals": "^17.13.0",
68+
"knip": "^6.42.0",
69+
"oauth2-mock-server": "^9.3.0",
70+
"pino-pretty": "^13.2.0",
71+
"prettier": "^3.9.10",
72+
"prettier-plugin-svelte": "^3.5.2",
73+
"prettier-plugin-tailwindcss": "^0.8.1",
74+
"svelte": "^5.57.2",
75+
"svelte-check": "^4.7.7",
76+
"sveltekit-superforms": "^2.31.0",
7877
"tailwindcss": "^4.2.1",
79-
"testcontainers": "^12.0.1",
80-
"tsx": "^4.23.13",
81-
"typescript": "^5.9.3",
82-
"typescript-eslint": "^8.56.1",
83-
"unplugin-icons": "^23.0.1",
84-
"vite": "^7.3.1",
78+
"testcontainers": "^12.2.1",
79+
"tsx": "^4.23.15",
80+
"typescript": "^6.0.3",
81+
"typescript-eslint": "^8.71.2",
82+
"unplugin-icons": "^24.0.0",
83+
"vite": "^7.3.7",
8584
"vitest": "^4.1.11",
86-
"vitest-browser-svelte": "^2.0.2",
87-
"zod": "^4.3.6"
85+
"vitest-browser-svelte": "^2.2.1",
86+
"zod": "^4.6.7"
8887
},
8988
"dependencies": {
90-
"@aws-sdk/client-s3": "^3.1041.0",
91-
"@aws-sdk/lib-storage": "^3.1045.0",
92-
"@better-auth/drizzle-adapter": "^1.6.20",
89+
"@aws-sdk/client-s3": "^3.1152.0",
90+
"@aws-sdk/lib-storage": "^3.1152.0",
91+
"@better-auth/drizzle-adapter": "^1.7.12",
9392
"@eslint-community/regexpp": "^4.12.2",
94-
"@internationalized/date": "^3.11.0",
95-
"@smithy/node-http-handler": "4.9.1",
93+
"@internationalized/date": "^3.12.4",
94+
"@smithy/node-http-handler": "^4.12.1",
9695
"adm-zip": "^0.6.1",
9796
"antlr4-c3": "^3.4.4",
9897
"antlr4ng": "^3.0.16",
99-
"better-auth": "^1.6.33",
100-
"drizzle-orm": "^0.45.2",
101-
"hyparquet": "^1.25.8",
102-
"hyparquet-compressors": "^1.1.1",
103-
"monaco-editor": "^0.55.1",
104-
"papaparse": "^5.5.3",
105-
"pg": "^8.21.0",
106-
"pino": "^10.3.1",
107-
"pretty-bytes": "^7.1.0",
98+
"better-auth": "^1.7.12",
99+
"drizzle-orm": "^0.45.4",
100+
"hyparquet": "^1.31.5",
101+
"hyparquet-compressors": "^1.1.2",
102+
"monaco-editor": "^0.57.0",
103+
"papaparse": "^5.7.0",
104+
"pg": "^8.23.1",
105+
"pino": "^10.4.0",
106+
"pretty-bytes": "^7.2.0",
108107
"prom-client": "^15.1.3",
109-
"tar-stream": "^3.2.0",
110-
"undici": "^7.24.4"
108+
"tar-stream": "^3.2.2",
109+
"undici": "^7.30.1"
111110
},
112111
"//overrides": {
113112
"@sveltejs/kit > cookie": "SvelteKit requests ^0.6.0, which excludes the cookie validation security fix in 0.7.x. Remove when SvelteKit requires a patched version.",
114-
"monaco-editor > dompurify": "Monaco pins DOMPurify to 3.2.7. Use ^3.4.16 for subsequent sanitisation security fixes; remove when Monaco requires an equally patched or newer version."
113+
"monaco-editor > dompurify": "Monaco pins DOMPurify to 3.4.15. Use ^3.4.17 for subsequent sanitisation security fixes; remove when Monaco requires an equally patched or newer version."
115114
},
116115
"overrides": {
117116
"@sveltejs/kit": {
118117
"cookie": "^0.7.2"
119118
},
120119
"monaco-editor": {
121-
"dompurify": "^3.4.16"
120+
"dompurify": "^3.4.17"
122121
}
123122
}
124123
}

‎src/lib/auth-client.ts‎

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,3 @@
11
import { createAuthClient } from 'better-auth/svelte';
2-
import { genericOAuthClient } from 'better-auth/client/plugins';
32

4-
export const authClient = createAuthClient({
5-
plugins: [genericOAuthClient()]
6-
});
3+
export const authClient = createAuthClient();

‎src/lib/components/editor/MonacoEditor.svelte‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@
131131
132132
// Start loading in parallel with the rest of the page — not deferred to onMount.
133133
// Guarded by `browser` because SvelteKit evaluates component scripts on the server too.
134-
const workerImport = browser ? import('monaco-editor/esm/vs/editor/editor.worker?worker') : null;
134+
const workerImport = browser ? import('monaco-editor/editor/editor.worker?worker') : null;
135135
// The Trino SQL language pulls in the ANTLR parser (~1 MB); load it lazily alongside Monaco.
136136
// It has no runtime dependency on monaco-editor, so starting it early does not
137137
// load Monaco before the locale's NLS bundle below.
@@ -151,8 +151,7 @@
151151
// Load Monaco's NLS bundle for the active locale. Static import strings are
152152
// required — Vite cannot bundle bare-specifier template literals at build time.
153153
if (getLocale() === 'de') {
154-
// @ts-expect-error — Monaco ESM nls bundle has no types
155-
await import('monaco-editor/esm/nls.messages.de.js');
154+
await import('monaco-editor/nls/lang/de.js');
156155
}
157156
158157
// By the time onMount fires the imports are likely already resolved.

‎src/lib/components/editor/TextEditor.svelte‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@
138138
return extLanguageMap[extension] ?? 'plaintext';
139139
});
140140
141-
const workerImport = browser ? import('monaco-editor/esm/vs/editor/editor.worker?worker') : null;
141+
const workerImport = browser ? import('monaco-editor/editor/editor.worker?worker') : null;
142142
143143
function toMonacoTheme(t: string): string {
144144
return t === 'dark' ? 'vs-dark' : 'vs';
@@ -156,8 +156,7 @@
156156
// Load Monaco's NLS bundle for the active locale. Static import strings are
157157
// required — Vite cannot bundle bare-specifier template literals at build time.
158158
if (getLocale() === 'de') {
159-
// @ts-expect-error — Monaco ESM nls bundle has no types
160-
await import('monaco-editor/esm/nls.messages.de.js');
159+
await import('monaco-editor/nls/lang/de.js');
161160
}
162161
163162
const EditorWorker = (await workerImport!).default;

‎src/lib/components/editor/TextEditor.svelte.spec.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import { getLocale, setLocale } from '$lib/paraglide/runtime.js';
77
// TextEditor registers its save action, not Monaco itself.
88
const addAction = vi.hoisted(() => vi.fn());
99

10-
vi.mock('monaco-editor/esm/vs/editor/editor.worker?worker', () => ({
10+
vi.mock('monaco-editor/editor/editor.worker?worker', () => ({
1111
default: class {}
1212
}));
1313

‎src/lib/server/auth.test.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ describe('user.additionalFields.trinoUser', () => {
1717

1818
it('may be written by the OIDC callback', async () => {
1919
await expect(
20-
create({ email: 'alice@example.com', trinoUser: 'alice' }, '/oauth2/callback/:providerId')
20+
create({ email: 'alice@example.com', trinoUser: 'alice' }, '/callback/:id')
2121
).resolves.toBeUndefined();
2222
});
2323

‎src/lib/server/auth.ts‎

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { betterAuth } from 'better-auth';
2-
import { APIError } from 'better-auth/api';
2+
import { APIError, callbackOAuth } from 'better-auth/api';
33
import { drizzleAdapter } from '@better-auth/drizzle-adapter';
44
import { genericOAuth, openAPI } from 'better-auth/plugins';
55
import { sveltekitCookies } from 'better-auth/svelte-kit';
@@ -19,8 +19,9 @@ const log = loggingModule?.logger.child({ module: 'auth' });
1919
// trinoUser is the Trino user we impersonate, so only the OIDC callback may
2020
// write it. Marking the field `input: false` would also block that: better-auth
2121
// drops such fields from the provider profile on sign-up (see #371). Database
22-
// hooks see the endpoint's route template, not the request path.
23-
const trinoUserWritePath = '/oauth2/callback/:providerId';
22+
// hooks see the endpoint's route template, not the request path. The generic
23+
// OAuth provider shares the social sign-in callback endpoint.
24+
const trinoUserWritePath = callbackOAuth.path;
2425

2526
function guardTrinoUserWrite(data: Record<string, unknown>, context: { path?: string } | null) {
2627
if (!('trinoUser' in data) || context?.path === trinoUserWritePath) return;
@@ -39,6 +40,9 @@ const extraScopes = (env.STACKABLE_COCKPIT_OIDC_EXTRA_SCOPES ?? '')
3940

4041
const oidcScopes = [...new Set([...defaultScopes, ...extraScopes])];
4142

43+
// OIDC profile claims are untyped; only non-empty strings are usable.
44+
const claim = (value: unknown) => (typeof value === 'string' && value ? value : undefined);
45+
4246
// OIDC is enabled only when all required OIDC env vars are present.
4347
export const oidcEnabled = !!(
4448
env.STACKABLE_COCKPIT_OIDC_DISCOVERY_URL &&
@@ -98,10 +102,12 @@ export const auth = betterAuth({
98102
// Trino user claim reach existing users instead of only new ones.
99103
overrideUserInfo: true,
100104
mapProfileToUser: async (profile) => {
101-
const fullName = [profile.given_name, profile.family_name]
105+
const fullName = [claim(profile.given_name), claim(profile.family_name)]
102106
.filter(Boolean)
103107
.join(' ');
104-
const claimedTrinoUser = profile[trinoUserClaim];
108+
const preferredUsername = claim(profile.preferred_username);
109+
const email = claim(profile.email);
110+
const claimedTrinoUser = claim(profile[trinoUserClaim]);
105111
if (claimedTrinoUser) {
106112
log?.debug(
107113
{ trino_user_claim: trinoUserClaim },
@@ -114,13 +120,13 @@ export const auth = betterAuth({
114120
);
115121
}
116122
return {
117-
name: profile.name || fullName || profile.preferred_username || profile.email,
118-
email: profile.email || '',
119-
emailVerified: profile.email_verified ?? false,
120-
image: profile.picture || null,
123+
name: claim(profile.name) || fullName || preferredUsername || email,
124+
email: email ?? '',
125+
emailVerified: profile.email_verified === true,
126+
image: claim(profile.picture),
121127
// No `|| ''`: without an email better-auth rejects the sign-in before
122128
// creating the user, so this never stores an empty Trino user.
123-
trinoUser: claimedTrinoUser || profile.preferred_username || profile.email
129+
trinoUser: claimedTrinoUser || preferredUsername || email
124130
};
125131
}
126132
}

0 commit comments

Comments
 (0)