@@ -489,16 +489,13 @@ describe("Authentication Client - Custom Proxy Handler", async () => {
489489
490490 // combine single level and multi level subpaths
491491 describe ( "Category 3: URL Path Matching & Transformation" , ( ) => {
492- it ( "3.1 should proxy to root path" , async ( ) => {
492+ it ( "3.1 should reject exact proxy path without subpath (security)" , async ( ) => {
493+ // Security: The My Account and My Org APIs have no endpoints at exactly /me or /my-org
494+ // All real endpoints are like /me/v1/... or /my-org/v1/...
495+ // Accepting exact paths could lead to security issues
493496 const session = createInitialSessionData ( ) ;
494497 const cookie = await createSessionCookie ( session , secret ) ;
495498
496- server . use (
497- http . get ( `${ DEFAULT . upstreamBaseUrl } ` , ( ) => {
498- return HttpResponse . json ( { path : "/" } ) ;
499- } )
500- ) ;
501-
502499 const request = new NextRequest (
503500 new URL ( DEFAULT . proxyPath , DEFAULT . appBaseUrl ) ,
504501 {
@@ -508,10 +505,11 @@ describe("Authentication Client - Custom Proxy Handler", async () => {
508505 ) ;
509506
510507 const response = await authClient . handler ( request ) ;
508+ // Should not proxy - should just touch sessions and return Next response
511509 expect ( response . status ) . toBe ( 200 ) ;
512-
513- const data = await response . json ( ) ;
514- expect ( data . path ) . toBe ( "/" ) ;
510+ // Should not have proxied content
511+ const text = await response . text ( ) ;
512+ expect ( text ) . not . toContain ( '{"path":"/"}' ) ;
515513 } ) ;
516514
517515 it ( "3.2 should proxy to single-level subpath" , async ( ) => {
0 commit comments