linrrzqqq opened a new pull request, #70336:
URL: https://github.com/apache/doris/pull/70336

   ### Background
   
   `information_schema.active_queries` lists currently executing queries, 
including their owners and SQL statements. BE requests this information from 
FE, which also gathers query records from other FEs.
   
   ### What problem does this PR solve?
   
   Issue Number: None
   Related PR: None
   PR Type: Bugfix
   
   Problem Summary:
   
   Non-admin users could read other users’ SQL statements through 
`information_schema.active_queries`. This change passes the caller’s identity 
from BE to FE and filters query records by the full user identity, including 
host. Users with ADMIN privilege retain visibility into all queries. Most of 
the diff adds regression coverage.
   
   ### Details
   
   - Frequency: Occurs when a non-admin user queries the table while another 
user has an active query.
   - Root cause: The BE scanner omitted the caller’s identity, and the FE 
metadata handler returned query records without checking ownership.
   - Why existing tests missed it: The existing test exercised table queries 
without checking visibility across different users.
   - Fix: Require the caller’s identity, check ADMIN privilege, and filter 
other callers’ results by full user identity. Requests without an identity 
return an error.
   - Other paths and branches: FE-to-FE forwarding preserves the caller’s 
identity. This PR targets master.
   - Behavior change: Non-admin users can view only queries belonging to their 
authenticated identity, including the host component.
   
   ### Testing
   
   Verified locally on the branch-4.2 base before rebasing onto master:
   
   - Full BE/FE build passed using sh build.sh.
   - ./run-regression-test.sh --run -d auth_p0 -s test_active_queries_auth 
passed.
   - The cross-user visibility assertion failed before the fix and passed 
afterward.
   - Coverage includes own-query visibility, cross-user isolation, ADMIN 
visibility, same-name users with different hosts, and requests without a caller 
identity.
   
   After rebasing, git range-diff confirmed that the code patch was unchanged, 
and git diff --check passed. Compilation and runtime tests have not been 
repeated on the master base.
   
   ### Release note
   
   Non-admin users can view only their own queries through 
information_schema.active_queries. Users with ADMIN privilege retain visibility 
into all active queries.
   
   ### Check List (For Author)
   
   - Behavior changed: Yes (see Details)
   - Does this need documentation: No
   - Pre-submission status: Partially verified: compilation and runtime tests 
on the master base remain pending.
   
   ### AI Disclosure
   
   - Tool: OpenAI Codex (GPT-6-Astra)
   - Generated: Production code, regression test.
   - Human review: reviewed by author.


-- 
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]

Reply via email to