- Notifications
You must be signed in to change notification settings - Fork28
Commitd525fbc
committed
Fix mishandling of column-level SELECT privileges for join aliases.
scanNSItemForColumn, expandNSItemAttrs, and ExpandSingleTable wouldpass the wrong RTE to markVarForSelectPriv when dealing with a joinParseNamespaceItem: they'd pass the join RTE, when what we need tomark is the base table that the join column came from. The endresult was to not fill the base table's selectedCols bitmap correctly,resulting in an understatement of the set of columns that are readby the query. The executor would still insist on there being atleast one selectable column; but with a correctly crafted query,a user having SELECT privilege on just one column of a table wouldnonetheless be allowed to read all its columns.To fix, make markRTEForSelectPriv fetch the correct RTE for itself,ignoring the possibly-mismatched RTE passed by the caller. Later,we'll get rid of some now-unused RTE arguments, but that risksAPI breaks so we won't do it in released branches.This problem was introduced by commit9ce77d7, so back-patchto v13 where that came in. Thanks to Sven Klemm for reportingthe problem.Security:CVE-2021-202291 parent8e56684 commitd525fbc
File tree
4 files changed
+93
-23
lines changed- src
- backend/parser
- test/regress
- expected
- sql
4 files changed
+93
-23
lines changedLines changed: 22 additions & 21 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
68 | 68 |
| |
69 | 69 |
| |
70 | 70 |
| |
71 |
| - | |
| 71 | + | |
72 | 72 |
| |
73 | 73 |
| |
74 | 74 |
| |
| |||
660 | 660 |
| |
661 | 661 |
| |
662 | 662 |
| |
663 |
| - | |
664 |
| - | |
| 663 | + | |
| 664 | + | |
665 | 665 |
| |
666 | 666 |
| |
667 | 667 |
| |
| |||
990 | 990 |
| |
991 | 991 |
| |
992 | 992 |
| |
993 |
| - | |
| 993 | + | |
| 994 | + | |
994 | 995 |
| |
995 | 996 |
| |
996 |
| - | |
997 |
| - | |
998 |
| - | |
999 |
| - | |
1000 |
| - | |
1001 | 997 |
| |
1002 | 998 |
| |
1003 |
| - | |
1004 |
| - | |
| 999 | + | |
1005 | 1000 |
| |
1006 |
| - | |
1007 |
| - | |
| 1001 | + | |
1008 | 1002 |
| |
1009 | 1003 |
| |
1010 | 1004 |
| |
| |||
1036 | 1030 |
| |
1037 | 1031 |
| |
1038 | 1032 |
| |
1039 |
| - | |
| 1033 | + | |
1040 | 1034 |
| |
1041 | 1035 |
| |
1042 | 1036 |
| |
1043 | 1037 |
| |
1044 | 1038 |
| |
1045 |
| - | |
| 1039 | + | |
1046 | 1040 |
| |
1047 | 1041 |
| |
1048 | 1042 |
| |
| |||
1051 | 1045 |
| |
1052 | 1046 |
| |
1053 | 1047 |
| |
1054 |
| - | |
| 1048 | + | |
1055 | 1049 |
| |
1056 | 1050 |
| |
1057 | 1051 |
| |
1058 | 1052 |
| |
1059 | 1053 |
| |
1060 |
| - | |
| 1054 | + | |
1061 | 1055 |
| |
1062 | 1056 |
| |
1063 | 1057 |
| |
| |||
1078 | 1072 |
| |
1079 | 1073 |
| |
1080 | 1074 |
| |
1081 |
| - | |
| 1075 | + | |
| 1076 | + | |
| 1077 | + | |
| 1078 | + | |
1082 | 1079 |
| |
1083 | 1080 |
| |
1084 | 1081 |
| |
| |||
1089 | 1086 |
| |
1090 | 1087 |
| |
1091 | 1088 |
| |
1092 |
| - | |
| 1089 | + | |
1093 | 1090 |
| |
1094 | 1091 |
| |
1095 | 1092 |
| |
| |||
3031 | 3028 |
| |
3032 | 3029 |
| |
3033 | 3030 |
| |
3034 |
| - | |
| 3031 | + | |
| 3032 | + | |
| 3033 | + | |
| 3034 | + | |
3035 | 3035 |
| |
3036 |
| - | |
| 3036 | + | |
| 3037 | + | |
3037 | 3038 |
| |
3038 | 3039 |
| |
3039 | 3040 |
| |
|
Lines changed: 6 additions & 2 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1356 | 1356 |
| |
1357 | 1357 |
| |
1358 | 1358 |
| |
1359 |
| - | |
| 1359 | + | |
| 1360 | + | |
| 1361 | + | |
| 1362 | + | |
1360 | 1363 |
| |
1361 |
| - | |
| 1364 | + | |
| 1365 | + | |
1362 | 1366 |
| |
1363 | 1367 |
| |
1364 | 1368 |
| |
|
Lines changed: 46 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
474 | 474 |
| |
475 | 475 |
| |
476 | 476 |
| |
| 477 | + | |
| 478 | + | |
| 479 | + | |
| 480 | + | |
477 | 481 |
| |
478 | 482 |
| |
| 483 | + | |
| 484 | + | |
| 485 | + | |
| 486 | + | |
| 487 | + | |
| 488 | + | |
| 489 | + | |
| 490 | + | |
| 491 | + | |
| 492 | + | |
| 493 | + | |
| 494 | + | |
| 495 | + | |
| 496 | + | |
| 497 | + | |
| 498 | + | |
| 499 | + | |
| 500 | + | |
| 501 | + | |
| 502 | + | |
| 503 | + | |
| 504 | + | |
| 505 | + | |
| 506 | + | |
| 507 | + | |
| 508 | + | |
| 509 | + | |
| 510 | + | |
| 511 | + | |
| 512 | + | |
| 513 | + | |
| 514 | + | |
| 515 | + | |
| 516 | + | |
| 517 | + | |
| 518 | + | |
| 519 | + | |
| 520 | + | |
| 521 | + | |
| 522 | + | |
| 523 | + | |
| 524 | + | |
479 | 525 |
| |
480 | 526 |
| |
481 | 527 |
| |
|
Lines changed: 19 additions & 0 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
301 | 301 |
| |
302 | 302 |
| |
303 | 303 |
| |
| 304 | + | |
| 305 | + | |
304 | 306 |
| |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
305 | 324 |
| |
306 | 325 |
| |
307 | 326 |
| |
|
0 commit comments
Comments
(0)