@@ -81,7 +81,7 @@ afterAll(async () => {
8181// starts from a blank cluster:
8282beforeEach ( ( ) => cluster . reset ( ) ) ;
8383
84- test . each ( [ true , false , undefined ] ) ( "read access covers existing/RLS and future tables without writes (BypassRls : %s)" , async ( bypassRls ) => {
84+ test . each ( [ true , false , undefined ] ) ( "read access covers existing/RLS and future tables without writes (GrantBypassRls : %s)" , async ( grantBypassRls ) => {
8585 const client = await cluster . connectTo ( DB_DEFAULT_DB ) ;
8686 try {
8787 await client . query ( `
@@ -109,7 +109,7 @@ test.each([true, false, undefined])("read access covers existing/RLS and future
109109 } ,
110110 Role : "reader" , Schema : "public" ,
111111 CreatorRoles : [ "app" , DB_MASTER_USERNAME ] ,
112- ...( bypassRls === undefined ? { } : { BypassRls : bypassRls } ) ,
112+ ...( grantBypassRls === undefined ? { } : { GrantBypassRls : grantBypassRls } ) ,
113113 } ,
114114 } as CloudFormationCustomResourceEvent ;
115115 await expect ( handler ( {
@@ -132,16 +132,16 @@ test.each([true, false, undefined])("read access covers existing/RLS and future
132132 ` ) ;
133133 expect ( ( await client . query (
134134 "SELECT rolbypassrls FROM pg_roles WHERE rolname = current_user"
135- ) ) . rows [ 0 ] . rolbypassrls ) . toBe ( bypassRls === true ) ;
136- expect ( ( await client . query ( "SELECT * FROM public.items" ) ) . rowCount ) . toBe ( bypassRls ? 1 : 0 ) ;
135+ ) ) . rows [ 0 ] . rolbypassrls ) . toBe ( grantBypassRls === true ) ;
136+ expect ( ( await client . query ( "SELECT * FROM public.items" ) ) . rowCount ) . toBe ( grantBypassRls ? 1 : 0 ) ;
137137 for ( const table of [ "ordinary" , "from_master" , "from_app" ] ) {
138138 expect ( ( await client . query ( `SELECT * FROM public.${ table } ` ) ) . rowCount ) . toBe ( 1 ) ;
139139 }
140140 await expect ( client . query ( "INSERT INTO public.items VALUES (4)" ) ) . rejects . toThrow ( / p e r m i s s i o n d e n i e d / ) ;
141141 await expect ( client . query ( "UPDATE public.items SET id = 4" ) ) . rejects . toThrow ( / p e r m i s s i o n d e n i e d / ) ;
142142 await expect ( client . query ( "DELETE FROM public.items" ) ) . rejects . toThrow ( / p e r m i s s i o n d e n i e d / ) ;
143143 await handler ( { ...event , RequestType : "Delete" , PhysicalResourceId : "ReadAccess" } ) ;
144- expect ( ( await client . query ( "SELECT * FROM public.items" ) ) . rowCount ) . toBe ( bypassRls ? 1 : 0 ) ;
144+ expect ( ( await client . query ( "SELECT * FROM public.items" ) ) . rowCount ) . toBe ( grantBypassRls ? 1 : 0 ) ;
145145 expect ( ( await client . query ( "SELECT * FROM public.ordinary" ) ) . rowCount ) . toBe ( 1 ) ;
146146 } finally {
147147 await client . end ( ) ;
0 commit comments