Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
boklm
Tor Browser
Commits
7a87069d
Unverified
Commit
7a87069d
authored
May 17, 2021
by
Matthew Finkel
Browse files
Bug 40432: Prevent probing installed applications
parent
291df872
Changes
1
Hide whitespace changes
Inline
Side-by-side
uriloader/exthandler/nsExternalHelperAppService.cpp
View file @
7a87069d
...
...
@@ -1049,8 +1049,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
));
...
...
@@ -1093,11 +1118,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"
;
NS_IMETHODIMP
nsExternalHelperAppService
::
LoadURI
(
nsIURI
*
aURI
,
nsIPrincipal
*
aTriggeringPrincipal
,
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new 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