Skip to content

createHonoApp's default prefix: '/api' does not compose with AuthPlugin's default basePath: '/api/v1/auth' — the documented embed answers 200 {} to sign-in #16025

Description

@os-warren

Measured, on a real boot through the adapter

Found while measuring #15928; out of that card's scope (that card is about which 404 the /auth/* mount may yield, this is about the mount never reaching better-auth at all). Filed unassigned.

Boot: a real ObjectKernel with AuthPlugin (@objectstack/verify's bootStack), then the documented embed shape from skills/objectstack-platform/SKILL.mdcreateHonoApp({ kernel }), i.e. prefix defaulting to /api — with requests injected through the returned app.

POST /api/auth/sign-in/email   (valid shape, wrong password)  ->  200  {}
GET  /api/auth/get-session                                    ->  200  {}
POST /api/auth/sign-up/email                                  ->  200  {}

A failed sign-in answering 200 {} is the silent-success shape.

Why

packages/adapters/hono/src/index.ts mounts app.all(FIELD_PREFIX + '/auth/*') and forwards the request unchanged to the kernel's auth service. AuthManager hands it to better-auth, which matches against its own configured basePath, defaulting to /api/v1/auth (packages/plugins/plugin-auth/src/auth-plugin.ts line 327, auth-manager.ts line 1254). With the adapter's default prefix the wire path is /api/auth/..., which is not under that base, so better-auth routes nothing:

authService.handleRequest(POST /api/auth/delete-user)      ->  404, zero-length body, no content-type
authService.handleRequest(POST /api/v1/auth/delete-user)   ->  401 {"message":"Unauthorized","code":"UNAUTHORIZED"}

Every one of those 404s is then yielded to the adapter's own terminal FIELD_PREFIX + '/*' dispatcher catch-all, which answers 200 {} for paths under /auth/ (see the sibling finding on that). The same measurement confirms the two do line up when the prefix is set to /api/v1: there ownsRoute('POST', '/api/v1/auth/delete-user') is true and the real auth surface answers.

What is NOT measured here

Note

A loud refusal is worth considering over a silent default change: the failure mode today is not "auth 404s", which someone would notice, but "auth answers 200 {}", which reads as success on every call.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions