attilapiros opened a new pull request, #7748: URL: https://github.com/apache/kyuubi/pull/7748
### Why are the changes needed? `CREATE OR REPLACE TABLE` are authorized as pure creates today: the `ReplaceTable` / `ReplaceTableAsSelect` logical plans map only to `CREATETABLE` / `CREATETABLE_AS_SELECT`, which require just the `CREATE` privilege on the target table. But these commands atomically drop and recreate the table - when the target already exists, its schema and all its data are destroyed. That means a user who was granted `CREATE` but deliberately not `DROP` on a table can still wipe it out with `REPLACE TABLE`, bypassing the very privilege an admin withheld to prevent destruction. This PR makes `REPLACE TABLE` / `CREATE OR REPLACE TABLE` require both `CREATE` and `DROP` on the target table, so the privilege model reflects what the operation can actually do. To express this, a table command spec can now declare more than one operation type (`opTypes`) instead of a single `opType`. `RuleAuthorization` resolves each operation type of a command's output through the existing `opType` → `AccessType` mapping - so `CREATETABLE` yields `CREATE` and `DROPTABLE` yields `DROP`, with no special-casing. ### How was this patch tested? The unit test was extended. ### Was this patch assisted by generative AI tooling? Assisted-by: Claude Opus 4.8 -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
