@@ -222,6 +222,13 @@ describe('a shared subBlock id means the same thing everywhere', () => {
222222 'appId' ,
223223 'bucketName' ,
224224 'rulesetId' ,
225+ 'recordId' ,
226+ 'policyId' ,
227+ 'serviceTokenId' ,
228+ 'groupId' ,
229+ 'routeId' ,
230+ 'scriptName' ,
231+ 'tunnelId' ,
225232 ] )
226233
227234 /**
@@ -848,21 +855,18 @@ describe('zone settings are read through the endpoints Cloudflare still supports
848855 ] )
849856 } )
850857
851- it ( 'keeps a crafted zone ID inside the zone path segment ' , async ( ) => {
858+ it ( 'rejects a crafted zone ID before making a provider request ' , async ( ) => {
852859 const fetchMock = vi
853860 . spyOn ( globalThis , 'fetch' )
854861 . mockImplementation ( async ( input ) => settingEnvelope ( String ( input ) . split ( '/' ) . pop ( ) ! , 'on' ) )
855862
856- await executeGetZoneSettingsOperation ( {
863+ const result = await executeGetZoneSettingsOperation ( {
857864 zoneId : '../accounts' ,
858865 apiKey,
859866 settingIds : 'ssl' ,
860867 } as never )
861-
862- expect ( fetchMock ) . toHaveBeenCalledWith (
863- 'https://api.cloudflare.com/client/v4/zones/..%2Faccounts/settings/ssl' ,
864- expect . any ( Object )
865- )
868+ expect ( result . success ) . toBe ( false )
869+ expect ( fetchMock ) . not . toHaveBeenCalled ( )
866870 } )
867871
868872 it ( 'does not let a dot-segment setting ID escape the settings endpoint' , async ( ) => {
@@ -875,7 +879,7 @@ describe('zone settings are read through the endpoints Cloudflare still supports
875879 } as never ) ) as { success : boolean ; error ?: string }
876880
877881 expect ( out . success ) . toBe ( false )
878- expect ( out . error ) . toMatch ( / s e t t i n g I D m u s t i d e n t i f y a r e s o u r c e / )
882+ expect ( out . error ) . toMatch ( / s e t t i n g I d / )
879883 expect ( fetchMock ) . not . toHaveBeenCalled ( )
880884 } )
881885
@@ -968,6 +972,21 @@ describe('zone settings are read through the endpoints Cloudflare still supports
968972 expect ( out . error ) . toBe ( 'Invalid zone identifier' )
969973 } )
970974
975+ it ( 'rejects a setting response whose declared size exceeds the per-setting cap' , async ( ) => {
976+ vi . spyOn ( globalThis , 'fetch' ) . mockResolvedValue (
977+ new Response ( JSON . stringify ( { success : true , result : { id : 'ssl' , value : 'full' } } ) , {
978+ headers : { 'Content-Length' : String ( 1024 * 1024 + 1 ) } ,
979+ } )
980+ )
981+ const result = await executeGetZoneSettingsOperation ( {
982+ zoneId : 'z1' ,
983+ apiKey,
984+ settingIds : 'ssl' ,
985+ } as never )
986+ expect ( result . success ) . toBe ( false )
987+ expect ( result . error ) . toMatch ( / e x c e e d | l i m i t | l a r g e / i)
988+ } )
989+
971990 it ( 'refuses an unbounded fan-out instead of issuing the requests' , async ( ) => {
972991 const fetchMock = vi . spyOn ( globalThis , 'fetch' )
973992
0 commit comments