Symbolic links are resolved when passed on the command line
Reported by
pa...@cloudflare.com,
Jul 19 2016
|
||||||||||||
Issue descriptionHello! Chrome Version : Version 51.0.2704.103 (64-bit) OS version : 10.11.5 (15F34) Behavior in Safari 3.x/4.x (if applicable): Behavior in Firefox 3.x (if applicable): Behavior in Chrome for Windows: What steps will reproduce the problem? (1) Create folder with example file: mkdir ~/myapp_original_path echo "hello world" > ~/myapp_original_path/index.txt (2) Create folder which symlinked to original folder: mkdir ~/myapp_symlinked_path ln -s ~/myapp_original_path ~/myapp_symlinked_path/myproject (3) At this step we have two names for index.txt: ~/myapp_original_path/index.txt ~/myapp_symlinked_path/myproject/index.txt Then I tried to open this file with second name (with symlink part) with Chrome: /Applications/Google\ Chrome.app/Contents/MacOS/Google\ Chrome ~/myapp_symlinked_path/myproject/index.txt What is the expected result? I want to see path with symlinked component "~/myapp_symlinked_path/myproject/index.txt". What happens instead? I'm getting original path in address bar "file:///Users/pavel/myapp_original_path/index.txt".
,
Jul 20 2016
Also reproducible on Linux.
,
Jul 20 2016
Hello! Safari handles this task correctly as I've expected. FireFox is doing this in same way as Chrome.
,
Jul 20 2016
,
Jul 20 2016
Thank you for providing more feedback. Adding requester "karandeepb@chromium.org" for another review and adding "Needs-Review" label for tracking. For more details visit https://www.chromium.org/issue-tracking/autotriage - Your friendly Sheriffbot
,
Jul 20 2016
,
Jul 29 2016
Hi, guys! May I ask about status? That's really mandatory for any Atom IDE users who want to develop in Go language. This feature broke all black magic for GOPATH.
,
Jul 29 2016
+people who might have an opinion on this.
,
Jul 29 2016
Would there be a command line flag to choose between these, or would we default to always showing the symlink? I can't think of a particular security concern with the latter, but I haven't thought it thoroughly either.
,
Jul 29 2016
Sounds like a URL canonicalization issue. brettw@ or pkasting@ may have thoughts on whether it can be fixed.
,
Jul 30 2016
I don't know enough about canonicalization to know where this would be offhand, and lack a Linux box to set up true symlinks to test.
,
Jul 30 2016
URl parsing and canonicalization doesn't touch disk. If any code is doing this, it's in the net component.
,
Aug 1 2016
mmenke@: Do you know any network folks who might be familiar with this (per comment 12)?
,
Aug 1 2016
net/ doesn't actually support symlinked paths. You can verify this by going to file:///Users/pavel/myapp_symlinked_path/index.txt (Modified as appropriate). I'd guess that this behavior is handled by the code that handles processing/validating of URLs passed to Chrome on the command line. This code does not live in net/. Presumably if we wanted to remove that logic, we'd want to add support in net/ for using symlinked paths, first. Note that this raises potential security questions for any code that does security checks on file URLs (We do this on Android, not sure if we do it elsewhere).
,
Aug 10 2016
I looked into this. This doesn't happen if you type in the URL bar, it only happens from the command-line. This is happening in the code that interprets the command line. The command-line handling is special because you can type "google.com" to go to Google (despite this not being a real URL), or relative file names. As part of this, url_fixer.cc's ValidPathForFile calls base::MakeAbsoluteFilePath to get the absolute path to the input. This function ends up calling (on Posix) realpath(). This resulting path is then used to construct the final file URL. realpath() is doing a bunch of work for us in terms of resolving ".." stuff and probably handles a bunch of weird edge cases that I can't even think of. If you want to work around this, you can always supply a real file URL on the command line, or type the URL you want in the URL bar.
,
Aug 10 2016
Is it even possible to avoid having ValidPathForFile() call MakeAbsoluteFilePath()? In other words, if we left relative paths as relative, could we successfully open them? I'm wondering if the "resolving .. stuff" etc. is fixup that we truly need to do.
,
Aug 10 2016
file URLs don't support relative paths. If you prefixed relative paths with the current directory, though, and then just wrapped them in a file GURL, that would work.
,
Aug 10 2016
Brett, do you think converting MakeAbsoluteFilePath() to do the dumber implementation in comment 17 would break things?
,
Aug 10 2016
I can't think of what comment 17 would break offhand. It would need to be implemented carefully. The obvious way is to do FilePathToFileURL(GetCurrentDirectory() + "/").ResolveRelative(input) but if there are special characters in the input like # or ? they won't be escaped properly for file URLs.
,
Aug 17 2016
,
Aug 24 2016
Removing Internals>Network based on c#14/15; it sounds like the locus of this problem isn't in net/ |
||||||||||||
►
Sign in to add a comment |
||||||||||||
Comment 1 by thestig@chromium.org
, Jul 19 2016