smith1000 opened a new pull request, #61741: URL: https://github.com/apache/doris/pull/61741
### What problem does this PR solve? Issue Number: close #61631 Problem Summary: When a CTE (WITH ... AS) is referenced multiple times in a JOIN query and is not inlined (due to inlineCTEReferencedThreshold), the CheckPrivileges rule only runs once per statement because the privChecked flag is stored on StatementContext which is shared across all CascadesContext subtrees. After the outer query's CascadesContext marks privChecked=true, the CTE producer subtree's CascadesContext skips privilege checking entirely, allowing users without column-level access to bypass Ranger authorization. The fix moves the privChecked flag from StatementContext to CascadesContext, ensuring each subtree (including CTE producer subtrees) performs its own independent privilege check. ### Release note Fixed a security issue where Ranger column-level privileges could be bypassed when using CTE (WITH ... AS) combined with JOIN queries. Users without proper column access permissions could read restricted columns through CTE+JOIN patterns. ### Check List (For Author) - Test: Manual test (verified with Ranger 2.7.0 + Doris 4.0.3 environment) - Behavior changed: No - Does this need documentation: No -- 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]
