Native messaging manifests no longer allow relative paths contaning a `..` component
Categories
(WebExtensions :: Compatibility, defect, P1)
Tracking
(firefox-esr102 unaffected, firefox114 fixed, firefox115 fixed, firefox116 fixed)
Tracking | Status | |
---|---|---|
firefox-esr102 | --- | unaffected |
firefox114 | --- | fixed |
firefox115 | --- | fixed |
firefox116 | --- | fixed |
People
(Reporter: emk, Assigned: robwu)
References
(Regression, )
Details
(Keywords: regression, Whiteboard: [addons-jira])
Attachments
(1 file, 1 obsolete file)
48 bytes,
text/x-phabricator-request
|
dmeehan
:
approval-mozilla-beta+
pascalc
:
approval-mozilla-release+
|
Details | Review |
I do not use this site myself, but according to the announcement, it stopped working since Firefox 114 for Windows:
https://myna.go.jp/html/info/index.html#Login (Japanese)
Reporter | ||
Comment 1•2 years ago
|
||
Regression range:
https://hg.mozilla.org/integration/autoland/pushloghtml?fromchange=6d838112fbd5b0dbc4b260e63abea99748e91587&tochange=cff507e2b180811754fda1c13649195b6d438f82
Reporter | ||
Comment 2•2 years ago
|
||
I got this error with broken build:
OperationError: PathUtils.joinRelative: Could not append to path: NS_ERROR_FILE_UNRECOGNIZED_PATH NativeMessaging.jsm:98:33
startupPromise resource://gre/modules/NativeMessaging.jsm:98
Corresponding source location:
https://searchfox.org/mozilla-central/rev/aa7b0c53b36a74f7b1fc65b9f3c29320ad51cc0a/toolkit/components/extensions/NativeMessaging.sys.mjs#84
Comment 3•2 years ago
|
||
Set release status flags based on info from the regressing bug 1772932
:barret, since you are the author of the regressor, bug 1772932, could you take a look? Also, could you set the severity field?
For more information, please visit BugBot documentation.
Reporter | ||
Comment 4•2 years ago
|
||
PathUtils.joinRelative
throws with the following parameters:
PathUtils.joinRelative("C:\\Users\\xxxx\\AppData\\Local\\MPA\\Firefox\\extension", "..\\bin\\MPA_Wrapper.exe");
On the other hand, OS.Path.join
works:
OS.Path.join("C:\\Users\\xxxx\\AppData\\Local\\MPA\\Firefox\\extension", "..\\bin\\MPA_Wrapper.exe");
Apparently PathUtils.joinRelative
rejects ..
segments. Is this change intentional?
Reporter | ||
Comment 5•2 years ago
•
|
||
According to the Native messaging manifests spec, path
may be relative to the manifest itself on Windows. So I think this is a bug.
Reporter | ||
Updated•2 years ago
|
Reporter | ||
Updated•2 years ago
|
Reporter | ||
Comment 6•2 years ago
|
||
To be more compatible with OS.File.join.
Updated•2 years ago
|
Comment 7•2 years ago
|
||
Due to this bug, in Firefox 114, personal authentication using IC card reader / writer device does not work on various sites that provide Japanese government services.
I think this bug will have a big impact on the reliability of Firefox, so I think it should be set as a high priority.
Assignee | ||
Updated•2 years ago
|
Assignee | ||
Comment 8•2 years ago
|
||
(In reply to Masatoshi Kimura [:emk] from comment #4)
Apparently
PathUtils.joinRelative
rejects..
segments. Is this change intentional?
This change is not intentional. This is already the 4th unique regression caused by the changes associated with the osfile refactor. I'm going to take a thorough look at the desired path forward to minimize further compatibility risk.
I'm going to author patches to fast-track a reliable fix here (not just the bug reported here, but potentially others).
Reporter | ||
Comment 10•2 years ago
|
||
(In reply to Rob Wu [:robwu] from comment #8)
I'm going to author patches to fast-track a reliable fix here (not just the bug reported here, but potentially others).
Should I transfer the ownership of this bug?
Assignee | ||
Comment 11•2 years ago
|
||
I'll do that. And thanks for your helpful report and regression range!
Updated•2 years ago
|
Assignee | ||
Comment 12•2 years ago
|
||
NativeMessaging manifests on Windows are permitted to have relative
paths, including .. to traverse directories.
The original logic using OS.Path did not ".." in a special way, but the
replacement (PathUtils.joinRelative) from bug 1772932 does, by throwing.
To avoid the issue, we join these paths by string concatenation instead.
This is safe because:
-
The left side of the path is already an absolute path, to the
directory of the native manifest. -
The right side of the path is the command from the manifest. The path
joining logic is only entered when the command is not an absolute
path, which implies that the path is relative. -
Directory traversal "attacks" are not a concern here, because the
"path" field is already specified to be an arbitrary path to an
arbitrary binary, as part of the NativeMessaging API.
For completeness, this patch does not only add a test case for ".." in
relative paths (=the bug being fixed on Windows), but also ".." and "."
in absolute paths (=no change in behavior, already working on every OS).
Updated•2 years ago
|
Comment 13•2 years ago
|
||
Comment 14•2 years ago
|
||
bugherder |
Reporter | ||
Comment 15•2 years ago
|
||
Please consider uplifting this to 115 and (hopefully) a dot release of 114.
Assignee | ||
Comment 16•2 years ago
|
||
Comment on attachment 9338762 [details]
Bug 1837830 - Allow ".." relative path in NativeMessaging on Windows
Beta/Release Uplift Approval Request
- User impact if declined: Extensions cannot communicate with native messaging hosts that have been registered with a relative path containing ".." (on Windows). This includes an authentication mechanism for a Japanese government website (https://myna.go.jp) and the Adobe Acrobat extension.
- Is this code covered by automated tests?: Yes
- Has the fix been verified in Nightly?: No
- Needs manual test from QE?: No
- If yes, steps to reproduce:
- List of other uplifts needed: None
- Risk to taking this patch: Low
- Why is the change risky/not risky? (and alternatives if risky): Targeted change in NativeMessaging implementation, fully covered by unit tests.
- String changes made/needed: none
- Is Android affected?: No
Comment 17•2 years ago
|
||
Comment on attachment 9338762 [details]
Bug 1837830 - Allow ".." relative path in NativeMessaging on Windows
Approved for 115.0b6.
Comment 18•2 years ago
|
||
bugherder uplift |
Comment 21•2 years ago
|
||
Comment on attachment 9338762 [details]
Bug 1837830 - Allow ".." relative path in NativeMessaging on Windows
Approved for 104.0.2 next week, thanks.
Comment 22•2 years ago
|
||
bugherder uplift |
Description
•