fix: resolve TypeScript errors for CI
- Fix Uint8Array type in password.ts for Node 22 compatibility - Add missing TextStyle import in security-tests.ts - Update Zod 4 API: .errors -> .issues in login handler
- commit
- 497fca5a15e80883a1e6cf43909fa9121459b037
- author
- Kit · · 2025-12-15 06:36 UTC
- parent
- 2d69752
- signature
- SSH Unverified
SHA256:3RGv7q1rcg0JUU2CjMAhwZcyGvcCDmFuxQQT8Z18wLA· arch-ssh This key is not trusted for the committer email
3 files · +3 -3
M src/lib/utils/password.ts +1 -1
| @@ -43,7 +43,7 @@ async function derivePasswordHash(password: string, salt: Uint8Array): Promise<s | |||
| 43 | 43 | const derivedBits = await crypto.subtle.deriveBits( | |
| 44 | 44 | { | |
| 45 | 45 | name: "PBKDF2", | |
| 46 | - | salt: salt, | |
| 46 | + | salt: salt.buffer as ArrayBuffer, | |
| 47 | 47 | iterations: 100000, | |
| 48 | 48 | hash: "SHA-512" | |
| 49 | 49 | }, | |
| @@ -43,7 +43,7 @@ async function derivePasswordHash(password: string, salt: Uint8Array): Promise<s | |||||
| 43 | const derivedBits = await crypto.subtle.deriveBits( | 43 | const derivedBits = await crypto.subtle.deriveBits( | ||
| 44 | { | 44 | { | ||
| 45 | name: "PBKDF2", | 45 | name: "PBKDF2", | ||
| 46 | - | salt: salt, | 46 | + | salt: salt.buffer as ArrayBuffer, |
| 47 | iterations: 100000, | 47 | iterations: 100000, | ||
| 48 | hash: "SHA-512" | 48 | hash: "SHA-512" | ||
| 49 | }, | 49 | }, | ||
M src/lib/utils/security-tests.ts +1 -1
| @@ -1,5 +1,5 @@ | |||
| 1 | 1 | import { formatText, validateMessageContent, createGradientText } from './text-formatter'; | |
| 2 | - | import { validateTextStyle, DEFAULT_TEXT_STYLE } from '../types/text-formatting'; | |
| 2 | + | import { validateTextStyle, DEFAULT_TEXT_STYLE, type TextStyle } from '../types/text-formatting'; | |
| 3 | 3 | ||
| 4 | 4 | // XSS Test Vectors | |
| 5 | 5 | const XSS_TEST_VECTORS = [ | |
| @@ -1,5 +1,5 @@ | |||||
| 1 | import { formatText, validateMessageContent, createGradientText } from './text-formatter'; | 1 | import { formatText, validateMessageContent, createGradientText } from './text-formatter'; | ||
| 2 | - | import { validateTextStyle, DEFAULT_TEXT_STYLE } from '../types/text-formatting'; | 2 | + | import { validateTextStyle, DEFAULT_TEXT_STYLE, type TextStyle } from '../types/text-formatting'; |
| 3 | 3 | ||||
| 4 | // XSS Test Vectors | 4 | // XSS Test Vectors | ||
| 5 | const XSS_TEST_VECTORS = [ | 5 | const XSS_TEST_VECTORS = [ | ||
M src/routes/api/session/login/+server.ts +1 -1
| @@ -74,7 +74,7 @@ export const POST: RequestHandler = async ({ request, cookies }) => { | |||
| 74 | 74 | loginSchema.parse({ username, password }); | |
| 75 | 75 | } catch (err) { | |
| 76 | 76 | const zodError = err as z.ZodError; | |
| 77 | - | const errorMessage = zodError.errors?.[0]?.message || 'Invalid input data'; | |
| 77 | + | const errorMessage = zodError.issues?.[0]?.message || 'Invalid input data'; | |
| 78 | 78 | log.warn('Login validation failed', { error: errorMessage }); | |
| 79 | 79 | return new Response( | |
| 80 | 80 | JSON.stringify({ error: errorMessage } as LoginResponseError), | |
| @@ -74,7 +74,7 @@ export const POST: RequestHandler = async ({ request, cookies }) => { | |||||
| 74 | loginSchema.parse({ username, password }); | 74 | loginSchema.parse({ username, password }); | ||
| 75 | } catch (err) { | 75 | } catch (err) { | ||
| 76 | const zodError = err as z.ZodError; | 76 | const zodError = err as z.ZodError; | ||
| 77 | - | const errorMessage = zodError.errors?.[0]?.message || 'Invalid input data'; | 77 | + | const errorMessage = zodError.issues?.[0]?.message || 'Invalid input data'; |
| 78 | log.warn('Login validation failed', { error: errorMessage }); | 78 | log.warn('Login validation failed', { error: errorMessage }); | ||
| 79 | return new Response( | 79 | return new Response( | ||
| 80 | JSON.stringify({ error: errorMessage } as LoginResponseError), | 80 | JSON.stringify({ error: errorMessage } as LoginResponseError), | ||