Commit c18cb33
authored
fix(query): prevent modification of columns with security policies (#18896)
* fix(query): prevent modification of columns with security policies
This patch addresses two critical security policy enforcement issues:
Bug-1: Prevent dropping or modifying columns with attached policies
Columns that have masking policies or serve as row access policy
parameters must not be dropped or modified, as this would break
security policy enforcement. Added validation in:
- interpreter_table_drop_column: Blocks DROP COLUMN operations
- interpreter_table_modify_column: Blocks data type changes
Bug-2: Prevent duplicate policy assignment on columns
A column cannot have multiple security policies attached
simultaneously. Added checks in:
- interpreter_table_modify_column: Validates before SET MASKING POLICY
- interpreter_table_row_access_add: Validates before SET ROW ACCESS POLICY
Implementation:
- Created check_column_has_policy() utility in interpreters/util.rs
- Validates against both masking and row access policies
- Returns descriptive error messages to prevent security violations
This ensures policy integrity and prevents accidental security
configuration corruption during table schema alterations.
* optimize1 parent 69269a0 commit c18cb33
File tree
5 files changed
+68
-9
lines changed- src
- meta/app/src/schema/table
- query/service/src/interpreters
- tests/sqllogictests/suites/ee/05_ee_ddl
5 files changed
+68
-9
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
| 21 | + | |
21 | 22 | | |
22 | 23 | | |
23 | 24 | | |
| |||
83 | 84 | | |
84 | 85 | | |
85 | 86 | | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
86 | 97 | | |
87 | 98 | | |
88 | 99 | | |
| |||
Lines changed: 6 additions & 7 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
85 | 85 | | |
86 | 86 | | |
87 | 87 | | |
88 | | - | |
89 | | - | |
90 | | - | |
91 | | - | |
92 | | - | |
93 | | - | |
94 | | - | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
95 | 94 | | |
96 | 95 | | |
97 | 96 | | |
| |||
Lines changed: 20 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
146 | 146 | | |
147 | 147 | | |
148 | 148 | | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
149 | 159 | | |
150 | 160 | | |
151 | 161 | | |
| |||
241 | 251 | | |
242 | 252 | | |
243 | 253 | | |
| 254 | + | |
| 255 | + | |
| 256 | + | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
244 | 264 | | |
245 | 265 | | |
246 | 266 | | |
| |||
Lines changed: 10 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
120 | 120 | | |
121 | 121 | | |
122 | 122 | | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
123 | 133 | | |
124 | 134 | | |
125 | 135 | | |
| |||
Lines changed: 21 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
136 | 136 | | |
137 | 137 | | |
138 | 138 | | |
139 | | - | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
140 | 143 | | |
141 | 144 | | |
142 | 145 | | |
| |||
301 | 304 | | |
302 | 305 | | |
303 | 306 | | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
304 | 313 | | |
305 | 314 | | |
306 | 315 | | |
| |||
309 | 318 | | |
310 | 319 | | |
311 | 320 | | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
312 | 324 | | |
313 | 325 | | |
314 | 326 | | |
| |||
394 | 406 | | |
395 | 407 | | |
396 | 408 | | |
| 409 | + | |
| 410 | + | |
| 411 | + | |
| 412 | + | |
397 | 413 | | |
398 | 414 | | |
399 | 415 | | |
| |||
464 | 480 | | |
465 | 481 | | |
466 | 482 | | |
467 | | - | |
| 483 | + | |
468 | 484 | | |
469 | 485 | | |
470 | 486 | | |
| |||
810 | 826 | | |
811 | 827 | | |
812 | 828 | | |
| 829 | + | |
| 830 | + | |
| 831 | + | |
813 | 832 | | |
814 | 833 | | |
815 | 834 | | |
| |||
0 commit comments