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

   ### Background
   
   Doris masks credentials when displaying external-data properties. Besides 
secret property names, the common display policy recognizes credentials 
embedded in URL values. FE SQL logs preserve the submitted statement's layout 
when applying masking.
   
   ### What problem does this PR solve?
   
   Issue Number: None
   Related PR: #69467 (introduced formatted SQL logging), #70366 (established 
code-point view rewriting)
   PR Type: Bugfix
   
   Problem Summary:
   
   Formatted SQL logs can retain credentials in ordinary URL properties such as 
`driver_url`, although the existing property display policy masks those values. 
Reuse that policy for individual value tokens while preserving surrounding SQL 
and literal quoting. Also consume the parser's UTF-16 ranges directly so 
supplementary Unicode characters cannot shift replacements.
   
   ### Details
   
   - **Frequency:** Always for eligible FE log entries containing credentials 
in a URL under a non-secret property name. Request INFO logging requires 
`enable_print_request_before_execution=true` (default false); DEBUG and 
command-failure logging have their existing level gates.
   - **Root cause:** Preserve-format property masking checked only property 
names, while the value-aware map formatter was disabled in that mode. Its 
rewrite consumer also interpreted already normalized UTF-16 positions as code 
points a second time.
   - **Why existing tests missed it:** `EncryptSQLTest` and `StmtExecutorTest` 
cover secret property names and layout. `DatasourcePropertyMaskingTest` covers 
URL values through the non-preserving formatter, and 
`test_external_catalog_credential_masking` checks audit records rather than 
formatted FE logs. New tests join value-aware masking with the actual 
INFO/DEBUG paths; the existing parser-range test is aligned with its UTF-16 
consumer.
   - **Fix:** Redact decoded values through 
`DatasourcePrintableMap.redactProperty`, replace only values that change, and 
render them using their original quote style and current SQL escape mode. Apply 
normalized ranges without converting them again. Keep view rewriting on its 
code-point contract.
   - **Other paths and branches:** Shared property visitors cover CREATE/ALTER 
commands and TVF properties; shared SQL masking serves FE logs and audit 
formatting. The formatted-log path was introduced on master by #69467. Static 
source inspection finds no calls to the formatted `maskSql` interface in 
branch-3.1, branch-4.0, branch-4.1 or branch-4.2; 4.2 uses `geneEncryptionSQL`. 
No release-branch runtime validation was performed.
   
   ### Testing
   
   - Local SQL baseline reproduction: both actual INFO and DEBUG entries retain 
fixture URL credentials; the new `test_sql_log_url_masking` fails after a valid 
ALTER reaches the missing-catalog error, before any connector can consume a URL.
   - Local FE unit tests: 108 passed (25 parser masking, 61 executor, 22 shared 
property-policy tests). The baseline fails 11 newly added credential cases, 
plus existing Unicode masking cases. Candidate tests cover both SQL escape 
modes, single/double quotes, unchanged escapes, CREATE/ALTER, URL 
userinfo/query credentials, encoded query names, signed/SAS URLs, JDBC values 
and malformed URLs.
   - Local SQL/log regression: `test_sql_log_url_masking` passed all four 
mode/prefix combinations on the rebuilt FE, checking both INFO and DEBUG 
records with unique markers, exact masked layout and explicit absence of six 
fixture credentials. The baseline fails the same log assertions.
   
   ### Notes for Reviewers
   
   - Regression fixtures use synthetic URLs and deliberately nonexistent 
catalogs; they never download or load a driver. The same log assertions run 
with Docker or an explicitly configured owned local FE log. Checked-in PR 
pipelines default to skipping Docker suites; automatic Docker execution is 
unverified. The actual INFO/DEBUG execution path is also covered by the regular 
FE unit test.
   
   ### Release note
   
   None
   
   ### Check List (For Author)
   
   - Behavior changed: No
   - Does this need documentation: No
   - Pre-submission status: Partially verified: Docker deployment and automatic 
Docker CI execution are unverified; the same SQL/log assertions passed on an 
owned local cluster
   
   ### AI Disclosure
   
   - Tool: Codex (GPT-6)
   - Generated: Code, unit tests, regression tests and this description
   - Human review: not stated
   


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