Scan your whole stack
Are you using @procedures/better-auth?
Find out what’s in your code.
Scan your apps free in minutes (opens in a new tab)Latest version: v0.68.17
@procedures/better-auth was last scanned on 29 Nov 2026 at version 0.68.17. Risk score 0 of 100. No malicious behavior was detected.
| Version | Published | Status |
|---|---|---|
| 0.68.17 LATEST | 29 Nov 2026 | No rules fired |
| 0.68.16 | 29 Nov 2026 | No rules fired |
| 0.68.15 | 28 Nov 2026 | No rules fired |
| 0.68.14 | 26 Nov 2026 | Not shown |
| 0.68.13 | 26 Nov 2026 | Not shown |
Findings for v0.68.17. The score is a capped sum of the weights of the rules that fired — not CVSS, not exploitability, and not a probability. It is not comparable across packages with different scan coverage.
The score describes 0.68.17; other versions have their own rules, not their own score.
The publisher’s own README, as collected from the registry.
npm install @procedures/better-auth @procedures/client mongodb
The sign-in of a procedures server with Better Auth over MongoDB, and the request hook that gives the principal of each request.
httpOnly cookies, and does the OAuth state, PKCE and the CSRF checks.The package has no procedures. The package root registers nothing.
betterAuthConfig reads the environment. createBetterAuth makes the server. Give Better Auth its own database: its user collection must not mix with the data of the app.
import { betterAuthConfig, betterAuthHandler, createBetterAuth } from "@procedures/better-auth";
const origins = ["https://app.example.com"];
const config = betterAuthConfig(process.env, { port: 9091, trustedOrigins: origins, appName: "Example" });
if (typeof config === "string") throw new Error(config);
const auth = createBetterAuth(client.db("example-auth"), client, config);
app.use(betterAuthHandler(auth, { allowedOrigins: origins }).middleware); // the routes belong to the app
| Variable | Use |
|---|---|
BETTER_AUTH_SECRET |
The secret that signs the session cookies, with 16 characters or more. It is necessary. |
AUTH_BASE_URL |
The public origin of the server. The default is http://localhost:<port>. |
GITHUB_CLIENT_ID, GITHUB_CLIENT_SECRET |
The sign-in with GitHub. |
GOOGLE_CLIENT_ID, GOOGLE_CLIENT_SECRET |
The sign-in with Google. |
PASSKEY_RP_ID |
The domain of the passkeys. The default is the host of the first trusted origin. |
AUTH_TEST_ACCOUNTS=1 |
Accounts with an email and a password, for the tests. Their email counts as verified. Production refuses it. |
AUTH_CROSS_SITE_COOKIES=1 |
The cookies get SameSite=None and Secure, for a page on another site. Refer to A page on another origin. |
The handler of Better Auth sends no CORS headers. betterAuthHandler(auth, options) gives the Node handler of the auth routes with credentialed CORS. Use the allowedOrigins of the host, the list of the browser checks of procedureHandler. Thus one list of trusted origins drives the procedures and the auth routes.
Access-Control-Allow-Credentials: true and Vary: Origin.OPTIONS) with 204. For a trusted origin, it names the methods (GET, POST) and the headers (Content-Type, Authorization).Vary: Origin, also a response without CORS headers. Thus a shared cache keeps one answer for each origin."*", because each site could then send the cookies of the user (CSRF).cors changes the methods, the headers, the exposed headers and maxAge. The option basePath is /auth by default.handler.middleware to the app.betterAuthFace(auth) gives the same handler as a face of a procedures host (createProcedureHost() of @procedures/peer). The face takes browser.allowedOrigins of the policy of the host. Each request of the routes goes through the request tracking of the host, on the route pattern of the face (auth *):
controller.requires can name the database of Better Auth.const policy = hostPolicy({ browser: { allowedOrigins: origins } });
const host = createProcedureHost({ registry, policy, faces: { http: true, auth: betterAuthFace(auth) }, listen });
The cookies need more for a page on another site, for example https://app.example.com and https://api.other.example:
SameSite=None. It keeps such a cookie only when it is Secure, so the server needs HTTPS (or localhost).AUTH_CROSS_SITE_COOKIES=1, or give crossSiteCookies: true in the configuration. The cookies then get SameSite=None; Secure.localhost:5173 and localhost:9091. They need CORS, but not SameSite=None.@procedures/better-auth/browser gives the calls of a page to the auth routes of the server. It has no framework and no global state. Each function gives data, and the app decides what the page does next.
import { createBrowserAuth } from "@procedures/better-auth/browser";
// The page and the server have one origin (or a proxy gives the server under the origin of the page)
const auth = createBrowserAuth({ baseURL: "" });
const user = await auth.session(); // undefined when signed out
const out = await auth.signInSocial("github", location.href);
if ("url" in out) location.assign(out.url);
| Function | What it does |
|---|---|
session() |
The signed-in user of this browser: id, name and email. A server that does not answer in time gives undefined. |
signInSocial(provider, callbackURL) |
The page of the provider. The provider comes back to callbackURL. |
signOut() |
This function ends the session. |
addPasskey(name) |
This function makes a passkey of this device for the signed-in user. |
signInWithPasskey() |
This function signs in with a passkey of this device. |
signInWithPassword(input) |
A test server only (AUTH_TEST_ACCOUNTS): a sign-in, or a sign-up with signUp: true. |
httpOnly, so a script of the page cannot read it.Access-Control-Allow-Credentials: true. betterAuthHandler sends these headers. Without them, session() gives undefined and the other calls fail. Refer to A page on another origin.SameSite=None and Secure (AUTH_CROSS_SITE_COOKIES=1).{ error }. The functions do not throw for an answer of the server.@simplewebauthn/browser, which loads only when a passkey function operates.SessionPrincipals gives the user of a session cookie: the id, the verified email, the name and the groups. A short memo keeps the boot of a page to one session lookup.
betterAuthPrincipalOf gives the request hook (principalOf) of a procedures server. The app maps each kind of principal to a capability:
import { betterAuthPrincipalOf, SessionPrincipals, VIA } from "@procedures/better-auth";
const READ_ONLY = { effects: { writes: [] } };
const principals = new SessionPrincipals({ auth, db: client.db("example-auth") });
const server = createProcedureServer({
// No `token`: the hook checks the agent token, and a cookie session has no bearer token
principalOf: betterAuthPrincipalOf({
principals,
agentToken: process.env.AGENT_TOKEN,
// The agent acts only for users who own no group
actAs: (user) => !user.groups.some((group) => group.role === "owner"),
// A visitor without a session can read, and change nothing
anonymous: READ_ONLY,
}),
capability: (request) => (request.principal?.via === VIA.anonymous ? READ_ONLY : {}),
});
| The request has | The principal |
|---|---|
| The agent token as the bearer token | { id: "agent", via: "agent-token" } |
The agent token and the header x-act-as: <user id> |
The user, with via: "agent-as" and the claims agent: true and actAs. The actAs policy must permit the user. Without the policy, the hook refuses the request. |
| A session cookie | The user, with via: "better-auth" and the claims email, name and groups |
| Nothing of the above | With anonymous: { id: "anonymous", via: "anonymous" } and that narrowing. Without it (the default): no principal, and the server refuses the request. |
via: "anonymous"), or a refusal without anonymous. A refused act-as gets no principal. It does not get the principal of the agent.token with this hook. The token check of the server operates after the hook, and a cookie session has no bearer token.ctx.principal. The rights of the app stay in the app.tokenMatches of @procedures/client.Find threats in your stack.
OX Radar can check high-priority threats, like critical package CVEs, against your context.
Each incident is marked Detected or Not Detected with a remediation plan and proof all tracked in the Response Center.
The probe returned only these fields for this server — auth requirement, protocol and tool list weren’t observed, so they’re not shown (never guessed).
The publisher’s own links, as the registry reports them. These are not sources for the assessment on this page.