Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
bugzilla
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
etersoft
bugzilla
Commits
5c7b0575
Commit
5c7b0575
authored
Feb 24, 2016
by
Matt Tyson
Committed by
Dylan Hardison
Feb 24, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Bug 1250786 - Detainting of params.json
r=dylan,a=dylan
parent
1969f955
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
13 deletions
+4
-13
Config.pm
Bugzilla/Config.pm
+4
-13
No files found.
Bugzilla/Config.pm
View file @
5c7b0575
...
@@ -292,32 +292,23 @@ sub write_params {
...
@@ -292,32 +292,23 @@ sub write_params {
}
}
sub
read_param_file
{
sub
read_param_file
{
my
%
params
;
my
$
params
;
my
$file
=
bz_locations
()
->
{
'datadir'
}
.
'/params.json'
;
my
$file
=
bz_locations
()
->
{
'datadir'
}
.
'/params.json'
;
if
(
-
e
$file
)
{
if
(
-
e
$file
)
{
my
$data
;
my
$data
;
read_file
(
$file
,
binmode
=>
':utf8'
,
buf_ref
=>
\
$data
);
read_file
(
$file
,
binmode
=>
':utf8'
,
buf_ref
=>
\
$data
);
trick_taint
(
$data
);
# If params.json has been manually edited and e.g. some quotes are
# If params.json has been manually edited and e.g. some quotes are
# missing, we don't want JSON::XS to leak the content of the file
# missing, we don't want JSON::XS to leak the content of the file
# to all users in its error message, so we have to eval'uate it.
# to all users in its error message, so we have to eval'uate it.
%
params
=
eval
{
%
{
JSON::
XS
->
new
->
decode
(
$data
)}
};
$params
=
eval
{
JSON::
XS
->
new
->
decode
(
$data
)
};
if
(
$@
)
{
if
(
$@
)
{
my
$error_msg
=
(
basename
(
$0
)
eq
'checksetup.pl'
)
?
my
$error_msg
=
(
basename
(
$0
)
eq
'checksetup.pl'
)
?
$@
:
'run checksetup.pl to see the details.'
;
$@
:
'run checksetup.pl to see the details.'
;
die
"Error parsing $file: $error_msg"
;
die
"Error parsing $file: $error_msg"
;
}
}
# JSON::XS doesn't detaint data for us.
foreach
my
$key
(
keys
%
params
)
{
if
(
ref
(
$params
{
$key
})
eq
"ARRAY"
)
{
foreach
my
$item
(
@
{
$params
{
$key
}})
{
trick_taint
(
$item
);
}
}
else
{
trick_taint
(
$params
{
$key
})
if
defined
$params
{
$key
};
}
}
}
}
elsif
(
$ENV
{
'SERVER_SOFTWARE'
})
{
elsif
(
$ENV
{
'SERVER_SOFTWARE'
})
{
# We're in a CGI, but the params file doesn't exist. We can't
# We're in a CGI, but the params file doesn't exist. We can't
...
@@ -332,7 +323,7 @@ sub read_param_file {
...
@@ -332,7 +323,7 @@ sub read_param_file {
die
"The $file file does not exist."
die
"The $file file does not exist."
.
' You probably need to run checksetup.pl.'
,
.
' You probably need to run checksetup.pl.'
,
}
}
return
\%
params
;
return
$params
//
{}
;
}
}
1
;
1
;
...
...
Write
Preview
Markdown
is supported
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