@@ -149,8 +149,27 @@ describe('login handler - query parameter sanitization', () => {
149149 } ;
150150
151151 describe ( 'OAuth protocol parameter blocklist' , ( ) => {
152- // These params are completely absent from the authorization URL because the SDK does not include them
153- test . each ( [ 'state' , 'nonce' ] ) ( 'strips %s from the authorization URL' , async ( param ) => {
152+ // These params are completely absent from the authorization URL because the SDK does not
153+ // include them. Assert full absence (stronger than `!== 'evil'`): a regression that forwarded
154+ // the param with any other value would still be caught.
155+ test . each ( [
156+ 'state' ,
157+ 'nonce' ,
158+ // Target-API family — the SDK routes the target via the typed `audience` only.
159+ 'audience' ,
160+ 'aud' ,
161+ 'resource' ,
162+ 'resources' ,
163+ 'resource_indicator' ,
164+ // Request-Object and related params must not be user-forwardable.
165+ 'request' ,
166+ 'request_uri' ,
167+ 'id_token_hint' ,
168+ 'claims' ,
169+ 'response_mode' ,
170+ // Rich Authorization Requests grant details.
171+ 'authorization_details' ,
172+ ] ) ( 'strips %s from the authorization URL' , async ( param ) => {
154173 const app = createConfiguredApp ( appConfig ) ;
155174
156175 const res = await request ( app ) . get ( '/auth/login' ) . query ( { [ param ] : 'evil' } ) ;
@@ -176,6 +195,15 @@ describe('login handler - query parameter sanitization', () => {
176195 } ) ;
177196
178197 describe ( 'safe parameters still pass through' , ( ) => {
198+ test ( 'still forwards prompt and login_hint (intentionally not reserved)' , async ( ) => {
199+ const app = createConfiguredApp ( appConfig ) ;
200+ const res = await request ( app ) . get ( '/auth/login' ) . query ( { prompt : 'none' , login_hint : 'a@b.com' } ) ;
201+ expect ( res . status ) . toBe ( 302 ) ;
202+ const url = new URL ( res . headers [ 'location' ] ?. toString ( ) ?? '' ) ;
203+ expect ( url . searchParams . get ( 'prompt' ) ) . toBe ( 'none' ) ;
204+ expect ( url . searchParams . get ( 'login_hint' ) ) . toBe ( 'a@b.com' ) ;
205+ } ) ;
206+
179207 test ( 'allows safe params when mixed with dangerous ones' , async ( ) => {
180208 const app = createConfiguredApp ( appConfig ) ;
181209
0 commit comments