better-auth

Warn

Audited by Runlayer on Feb 24, 2026

Risk Level: MEDIUM
Scan Summary
Max Score
89%
Files
22
Flagged
13
Chunks
27
Flagged Files (13)
references/PLUGINS.mdHIGH
89.5%

Malicious tool definition detected

```bash npm install better-auth ``` ### Backend Configuration ```typescript import { betterAuth } from 'better-auth'; import { twoFactor } from 'better-auth/plugins'; export const auth = betterAuth({ appName: 'My App', plugins: [ twoFactor({ issuer: 'My App', otpOptions: { async sendOTP({ user, otp }, ctx) { // Required: Send OTP to user via email, SMS, etc.

Description: Example ```typescript import { betterAuth } from 'better-auth'; import { twoFactor, organization, magicLink, passkey } from 'better-auth/plugins'; export const auth = betterAuth({ database: drizzleAdapter(schema, { provider: 'postgresql', }), emailAndPassword: { enabled: true, requireEmailVerification: true, }, socialProviders: { github: { clientId: process.env.AUTH_GITHUB_CLIENT_ID!, clientSecret: process.env.AUTH_GITHUB_CLIENT_SECRET!, enabled: true, }, }, plugins: [ twoFactor({ t

references/nextjs-setup.mdHIGH
80.3%

Tool passed security scan

Malicious tool definition detected

Description: await response.json(); setSession(data); } catch { setSession(null); } finally { setLoading(false); } } loadSession(); }, []); return { session, loading }; } ``` ## Step 8: Server Actions for Auth ```typescript // app/actions.ts 'use server'; import { auth } from '@/lib/auth'; import { headers } from 'next/headers'; export async function getSession() { return auth.api.getSession({ headers: await headers(), }); } export async function signOut() { return auth.api.signOut({ headers: aw

SKILL.mdHIGH
78.3%

Malicious tool definition detected

assets/env.exampleHIGH
78.3%

Malicious tool definition detected

assets/nestjs/auth.controller.tsHIGH
78.3%

Malicious tool definition detected

references/passkey.mdHIGH
77.9%

Tool passed security scan

Malicious tool definition detected

**Security**: Enforce HTTPS in production 6.

assets/nextjs/auth-client.tsHIGH
75.3%

Malicious tool definition detected

Tool: assets/nextjs/auth-client.ts Description: // Better Auth client configuration import { createAuthClient } from 'better-auth/react'; export const authClient = createAuthClient({ baseURL: process.env.NEXT_PUBLIC_BETTER_AUTH_URL || 'http://localhost:3000', });

references/social-providers.mdHIGH
70.3%

Malicious tool definition detected

import jwt from 'jsonwebtoken'; import fs from 'fs'; function generateAppleClientSecret() { const privateKey = fs.readFileSync('./AuthKey.p8'); const token = jwt.sign({}, privateKey, { algorithm: 'ES256', keyid: process.env.AUTH_APPLE_KEY_ID, issuer: process.env.AUTH_APPLE_TEAM_ID, audience: 'https://appleid.apple.com', subject: process.env.AUTH_APPLE_CLIENT_ID, expiresIn: '180d', }); return token; } ``` ## Discord OAuth Setup ### 1.

assets/nextjs/auth-route.tsMEDIUM
49.8%

Tool passed security scan

references/mfa-2fa.mdMEDIUM
41.4%

Tool passed security scan

assets/nestjs/database.module.tsMEDIUM
41.3%

Tool passed security scan

assets/nestjs/auth.module.tsLOW
33.4%

Tool passed security scan

references/nestjs-setup.mdLOW
30.6%

Tool passed security scan

Passed Files (9)Click to expand
assets/nestjs/database.service.tsOK
27.7%

Tool passed security scan

assets/nextjs/middleware.tsOK
26.6%

Tool passed security scan

assets/nestjs/auth.service.tsOK
25.8%

Tool passed security scan

assets/nestjs/auth.schema.tsOK
19.4%

Tool passed security scan

assets/nestjs/auth.guard.tsOK
13.9%

Tool passed security scan

references/SCHEMA.mdOK
13.5%

Tool passed security scan

assets/nextjs/sign-in-page.tsxOK
11.1%

Tool passed security scan

assets/nextjs/dashboard-page.tsxOK
4.9%

Tool passed security scan

assets/nextjs/use-session.tsOK
3.2%

Tool passed security scan

Audit Metadata
Max File Score
89%
Classification
KNOWN_SERVER_KNOWN_TOOL_LIST
Files Scanned
22
Files Flagged
13
Chunks Analyzed
27
Analyzed
Feb 24, 2026, 02:59 AM
Security Audit — runlayer — better-auth