Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
The Tor Project
Applications
Tor Browser
Commits
4eecc98f
Verified
Commit
4eecc98f
authored
May 17, 2021
by
Matthew Finkel
Committed by
Richard Pospesel
Apr 27, 2022
Browse files
Bug 40432: Prevent probing installed applications
parent
37314312
Changes
1
Hide whitespace changes
Inline
Side-by-side
uriloader/exthandler/nsExternalHelperAppService.cpp
View file @
4eecc98f
...
...
@@ -1050,8 +1050,33 @@ nsresult nsExternalHelperAppService::GetFileTokenForPath(
//////////////////////////////////////////////////////////////////////////////////////////////////////
// begin external protocol service default implementation...
//////////////////////////////////////////////////////////////////////////////////////////////////////
static
const
char
kExternalProtocolPrefPrefix
[]
=
"network.protocol-handler.external."
;
static
const
char
kExternalProtocolDefaultPref
[]
=
"network.protocol-handler.external-default"
;
NS_IMETHODIMP
nsExternalHelperAppService
::
ExternalProtocolHandlerExists
(
const
char
*
aProtocolScheme
,
bool
*
aHandlerExists
)
{
// Replicate the same check performed in LoadURI.
// Deny load if the prefs say to do so
nsAutoCString
externalPref
(
kExternalProtocolPrefPrefix
);
externalPref
+=
aProtocolScheme
;
bool
allowLoad
=
false
;
*
aHandlerExists
=
false
;
if
(
NS_FAILED
(
Preferences
::
GetBool
(
externalPref
.
get
(),
&
allowLoad
)))
{
// no scheme-specific value, check the default
if
(
NS_FAILED
(
Preferences
::
GetBool
(
kExternalProtocolDefaultPref
,
&
allowLoad
)))
{
return
NS_OK
;
// missing default pref
}
}
if
(
!
allowLoad
)
{
return
NS_OK
;
// explicitly denied
}
nsCOMPtr
<
nsIHandlerInfo
>
handlerInfo
;
nsresult
rv
=
GetProtocolHandlerInfo
(
nsDependentCString
(
aProtocolScheme
),
getter_AddRefs
(
handlerInfo
));
...
...
@@ -1094,11 +1119,6 @@ NS_IMETHODIMP nsExternalHelperAppService::IsExposedProtocol(
return
NS_OK
;
}
static
const
char
kExternalProtocolPrefPrefix
[]
=
"network.protocol-handler.external."
;
static
const
char
kExternalProtocolDefaultPref
[]
=
"network.protocol-handler.external-default"
;
// static
nsresult
nsExternalHelperAppService
::
EscapeURI
(
nsIURI
*
aURI
,
nsIURI
**
aResult
)
{
MOZ_ASSERT
(
aURI
);
...
...
Pier Angelo Vendrame
@pierov
mentioned in issue
#40789
·
May 12, 2022
mentioned in issue
#40789
mentioned in issue #40789
Toggle commit list
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment