Skip to content

Commit b11b645

Browse files
author
Karina Litskevich
committed
[PGPRO-14880] Fix sequrity test due to changes in reporting of errors
See PostgreSQL commit 774171c4 Tags: rum
1 parent 850bb96 commit b11b645

File tree

7 files changed

+68
-40
lines changed

7 files changed

+68
-40
lines changed

expected/int8.out

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
* int8.out - test output for 64-bit systems and
77
* int8_1.out - test output for 32-bit systems.
88
*
9-
* Since c01743aa486 (>=18) EXPLAIN output was changed,
10-
* now it includes the number of disabled nodes
9+
* Since c01743aa486 and 161320b4b96 (>=18) EXPLAIN output was changed,
10+
* now it shows whether nodes are disabled.
1111
*
1212
* int8_2.out - test output for 32-bit systems (>=18)
1313
*

expected/int8_1.out

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
* int8.out - test output for 64-bit systems and
77
* int8_1.out - test output for 32-bit systems.
88
*
9-
* Since c01743aa486 (>=18) EXPLAIN output was changed,
10-
* now it includes the number of disabled nodes
9+
* Since c01743aa486 and 161320b4b96 (>=18) EXPLAIN output was changed,
10+
* now it shows whether nodes are disabled.
1111
*
1212
* int8_2.out - test output for 32-bit systems (>=18)
1313
*

expected/int8_2.out

Lines changed: 15 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
* int8.out - test output for 64-bit systems and
77
* int8_1.out - test output for 32-bit systems.
88
*
9-
* Since c01743aa486 (>=18) EXPLAIN output was changed,
10-
* now it includes the number of disabled nodes
9+
* Since c01743aa486 and 161320b4b96 (>=18) EXPLAIN output was changed,
10+
* now it shows whether nodes are disabled.
1111
*
1212
* int8_2.out - test output for 32-bit systems (>=18)
1313
*
@@ -238,9 +238,8 @@ SELECT count(*) FROM test_int8_a WHERE id < 400::int8;
238238
QUERY PLAN
239239
--------------------------------------
240240
Aggregate
241-
Disabled Nodes: 1
242241
-> Seq Scan on test_int8_a
243-
Disabled Nodes: 1
242+
Disabled: true
244243
Filter: (id < '400'::bigint)
245244
(5 rows)
246245

@@ -255,12 +254,10 @@ SELECT id, id <=> 400 FROM test_int8_a WHERE t @@ 'wr&qh' ORDER BY id <=> 400 LI
255254
QUERY PLAN
256255
---------------------------------------------------------
257256
Limit
258-
Disabled Nodes: 1
259257
-> Sort
260-
Disabled Nodes: 1
261258
Sort Key: ((id <=> '400'::bigint))
262259
-> Seq Scan on test_int8_a
263-
Disabled Nodes: 1
260+
Disabled: true
264261
Filter: (t @@ '''wr'' & ''qh'''::tsquery)
265262
(8 rows)
266263

@@ -279,12 +276,10 @@ SELECT id, id <=| 400 FROM test_int8_a WHERE t @@ 'wr&qh' ORDER BY id <=| 400 LI
279276
QUERY PLAN
280277
---------------------------------------------------------
281278
Limit
282-
Disabled Nodes: 1
283279
-> Sort
284-
Disabled Nodes: 1
285280
Sort Key: ((id <=| '400'::bigint))
286281
-> Seq Scan on test_int8_a
287-
Disabled Nodes: 1
282+
Disabled: true
288283
Filter: (t @@ '''wr'' & ''qh'''::tsquery)
289284
(8 rows)
290285

@@ -303,12 +298,10 @@ SELECT id, id |=> 400 FROM test_int8_a WHERE t @@ 'wr&qh' ORDER BY id |=> 400 LI
303298
QUERY PLAN
304299
---------------------------------------------------------
305300
Limit
306-
Disabled Nodes: 1
307301
-> Sort
308-
Disabled Nodes: 1
309302
Sort Key: ((id |=> '400'::bigint))
310303
-> Seq Scan on test_int8_a
311-
Disabled Nodes: 1
304+
Disabled: true
312305
Filter: (t @@ '''wr'' & ''qh'''::tsquery)
313306
(8 rows)
314307

@@ -327,10 +320,9 @@ SELECT id FROM test_int8_a WHERE t @@ 'wr&qh' AND id <= 400::int8 ORDER BY id;
327320
QUERY PLAN
328321
-------------------------------------------------------------------------------
329322
Sort
330-
Disabled Nodes: 1
331323
Sort Key: id
332324
-> Seq Scan on test_int8_a
333-
Disabled Nodes: 1
325+
Disabled: true
334326
Filter: ((t @@ '''wr'' & ''qh'''::tsquery) AND (id <= '400'::bigint))
335327
(6 rows)
336328

@@ -354,10 +346,9 @@ SELECT id FROM test_int8_a WHERE t @@ 'wr&qh' AND id >= 400::int8 ORDER BY id;
354346
QUERY PLAN
355347
-------------------------------------------------------------------------------
356348
Sort
357-
Disabled Nodes: 1
358349
Sort Key: id
359350
-> Seq Scan on test_int8_a
360-
Disabled Nodes: 1
351+
Disabled: true
361352
Filter: ((t @@ '''wr'' & ''qh'''::tsquery) AND (id >= '400'::bigint))
362353
(6 rows)
363354

@@ -534,9 +525,8 @@ SELECT count(*) FROM test_int8_h_a WHERE id < 400::int8;
534525
QUERY PLAN
535526
--------------------------------------
536527
Aggregate
537-
Disabled Nodes: 1
538528
-> Seq Scan on test_int8_h_a
539-
Disabled Nodes: 1
529+
Disabled: true
540530
Filter: (id < '400'::bigint)
541531
(5 rows)
542532

@@ -551,12 +541,10 @@ SELECT id, id <=> 400 FROM test_int8_h_a WHERE t @@ 'wr&qh' ORDER BY id <=> 400
551541
QUERY PLAN
552542
---------------------------------------------------------
553543
Limit
554-
Disabled Nodes: 1
555544
-> Sort
556-
Disabled Nodes: 1
557545
Sort Key: ((id <=> '400'::bigint))
558546
-> Seq Scan on test_int8_h_a
559-
Disabled Nodes: 1
547+
Disabled: true
560548
Filter: (t @@ '''wr'' & ''qh'''::tsquery)
561549
(8 rows)
562550

@@ -575,12 +563,10 @@ SELECT id, id <=| 400 FROM test_int8_h_a WHERE t @@ 'wr&qh' ORDER BY id <=| 400
575563
QUERY PLAN
576564
---------------------------------------------------------
577565
Limit
578-
Disabled Nodes: 1
579566
-> Sort
580-
Disabled Nodes: 1
581567
Sort Key: ((id <=| '400'::bigint))
582568
-> Seq Scan on test_int8_h_a
583-
Disabled Nodes: 1
569+
Disabled: true
584570
Filter: (t @@ '''wr'' & ''qh'''::tsquery)
585571
(8 rows)
586572

@@ -599,12 +585,10 @@ SELECT id, id |=> 400 FROM test_int8_h_a WHERE t @@ 'wr&qh' ORDER BY id |=> 400
599585
QUERY PLAN
600586
---------------------------------------------------------
601587
Limit
602-
Disabled Nodes: 1
603588
-> Sort
604-
Disabled Nodes: 1
605589
Sort Key: ((id |=> '400'::bigint))
606590
-> Seq Scan on test_int8_h_a
607-
Disabled Nodes: 1
591+
Disabled: true
608592
Filter: (t @@ '''wr'' & ''qh'''::tsquery)
609593
(8 rows)
610594

@@ -623,10 +607,9 @@ SELECT id FROM test_int8_h_a WHERE t @@ 'wr&qh' AND id <= 400::int8 ORDER BY id
623607
QUERY PLAN
624608
-------------------------------------------------------------------------------
625609
Sort
626-
Disabled Nodes: 1
627610
Sort Key: id
628611
-> Seq Scan on test_int8_h_a
629-
Disabled Nodes: 1
612+
Disabled: true
630613
Filter: ((t @@ '''wr'' & ''qh'''::tsquery) AND (id <= '400'::bigint))
631614
(6 rows)
632615

@@ -650,10 +633,9 @@ SELECT id FROM test_int8_h_a WHERE t @@ 'wr&qh' AND id >= 400::int8 ORDER BY id
650633
QUERY PLAN
651634
-------------------------------------------------------------------------------
652635
Sort
653-
Disabled Nodes: 1
654636
Sort Key: id
655637
-> Seq Scan on test_int8_h_a
656-
Disabled Nodes: 1
638+
Disabled: true
657639
Filter: ((t @@ '''wr'' & ''qh'''::tsquery) AND (id >= '400'::bigint))
658640
(6 rows)
659641

@@ -677,10 +659,9 @@ SELECT id FROM test_int8_h_a WHERE t @@ 'wr&qh' AND id <= 400::int8 ORDER BY id
677659
QUERY PLAN
678660
-------------------------------------------------------------------------------
679661
Sort
680-
Disabled Nodes: 1
681662
Sort Key: ((id <=> '400'::bigint))
682663
-> Seq Scan on test_int8_h_a
683-
Disabled Nodes: 1
664+
Disabled: true
684665
Filter: ((t @@ '''wr'' & ''qh'''::tsquery) AND (id <= '400'::bigint))
685666
(6 rows)
686667

expected/security.out

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,15 @@
1+
/*
2+
* ------------------------------------
3+
* NOTE: This test behaves differenly
4+
* ------------------------------------
5+
*
6+
* Since 774171c4f64 (>=18) reporting of errors in extension script files
7+
* is more detailed.
8+
*
9+
* security.out - test output for PostgreSQL (<18)
10+
* security_1.out - test output for PostgreSQL (>=18)
11+
*
12+
*/
113
-- Check security CVE-2020-14350
214
CREATE FUNCTION rum_anyarray_similar(anyarray,anyarray) RETURNS bool AS $$ SELECT false $$ LANGUAGE SQL;
315
CREATE EXTENSION rum;

expected/security_1.out

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
/*
2+
* ------------------------------------
3+
* NOTE: This test behaves differenly
4+
* ------------------------------------
5+
*
6+
* Since 774171c4f64 (>=18) reporting of errors in extension script files
7+
* is more detailed.
8+
*
9+
* security.out - test output for PostgreSQL (<18)
10+
* security_1.out - test output for PostgreSQL (>=18)
11+
*
12+
*/
13+
-- Check security CVE-2020-14350
14+
CREATE FUNCTION rum_anyarray_similar(anyarray,anyarray) RETURNS bool AS $$ SELECT false $$ LANGUAGE SQL;
15+
CREATE EXTENSION rum;
16+
ERROR: function "rum_anyarray_similar" already exists with same argument types
17+
CONTEXT: SQL statement "CREATE FUNCTION rum_anyarray_similar(anyarray,anyarray)
18+
RETURNS bool
19+
AS '$libdir/rum'
20+
LANGUAGE C STRICT STABLE"
21+
extension script file "rum--1.3.sql", near line 1530
22+
DROP FUNCTION rum_anyarray_similar(anyarray,anyarray);

sql/int8.sql

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
* int8.out - test output for 64-bit systems and
77
* int8_1.out - test output for 32-bit systems.
88
*
9-
* Since c01743aa486 (>=18) EXPLAIN output was changed,
10-
* now it includes the number of disabled nodes
9+
* Since c01743aa486 and 161320b4b96 (>=18) EXPLAIN output was changed,
10+
* now it shows whether nodes are disabled.
1111
*
1212
* int8_2.out - test output for 32-bit systems (>=18)
1313
*

sql/security.sql

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,16 @@
1+
/*
2+
* ------------------------------------
3+
* NOTE: This test behaves differenly
4+
* ------------------------------------
5+
*
6+
* Since 774171c4f64 (>=18) reporting of errors in extension script files
7+
* is more detailed.
8+
*
9+
* security.out - test output for PostgreSQL (<18)
10+
* security_1.out - test output for PostgreSQL (>=18)
11+
*
12+
*/
13+
114
-- Check security CVE-2020-14350
215
CREATE FUNCTION rum_anyarray_similar(anyarray,anyarray) RETURNS bool AS $$ SELECT false $$ LANGUAGE SQL;
316
CREATE EXTENSION rum;

0 commit comments

Comments
 (0)