github-actions[bot] commented on code in PR #69527:
URL: https://github.com/apache/doris/pull/69527#discussion_r4365978318


##########
be/src/io/fs/local_file_system.cpp:
##########
@@ -455,28 +455,89 @@ const std::shared_ptr<LocalFileSystem>& 
global_local_filesystem() {
 Status LocalFileSystem::canonicalize_local_file(const std::string& dir,
                                                 const std::string& file_path,
                                                 std::string* full_path) {
-    const std::string absolute_path = dir + "/" + file_path;
+    // An empty root would turn a relative request into an unrestricted 
absolute path.
+    if (dir.empty()) {
+        return Status::InvalidArgument("user_files_secure_path must not be 
empty");
+    }
+    // Reject embedded NULs before passing paths to filesystem APIs that use C 
strings.
+    if (file_path.empty() || file_path.find('\0') != std::string::npos) {
+        return Status::InvalidArgument("local file path must not be empty or 
contain NUL");
+    }
+    Path local_path;
+    // Convert file: URIs to filesystem paths and reject remote schemes before 
any reader opens them.
+    RETURN_IF_ERROR(convert_to_abs_path(file_path, local_path));

Review Comment:
   [P2] Preserve case-insensitive file URI schemes
   
   With `enable_local_tvf=true`, an ADMIN/OPERATOR reading an existing dataset 
inside `user_files_secure_path=/srv/user_files` can use 
`LOCAL("format"="lance", "backend_id"="1", 
"file_path"="FILE:///srv/user_files/data.lance")`. FE preserves this spelling, 
and Lance previously accepted it because its [URL parser lowercases scheme 
letters](https://github.com/servo/rust-url/blob/v2.5.8/url/src/parser.rs#L374-L384).
 The newly invoked `convert_to_abs_path` instead rejects any scheme other than 
exact lowercase `file`, so schema discovery now fails before opening this valid 
in-root dataset. This is separate from the existing percent-decoding and 
dot-segment findings: no escapes, parents, or symlinks are needed. Recognize 
the scheme case-insensitively in both conversion and the URI-only decoding 
branch, preserve bare-path spelling, and add uppercase/mixed-case URI coverage.



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