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
f53fede6
Commit
f53fede6
authored
Jul 30, 2012
by
Reed Loden
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Bug 767623 - Use HMAC to generate tokens and sensitive graph filenames
[r=LpSolit a=LpSolit]
parent
4e1e44ea
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
16 deletions
+12
-16
Token.pm
Bugzilla/Token.pm
+6
-8
reports.cgi
reports.cgi
+6
-8
No files found.
Bugzilla/Token.pm
View file @
f53fede6
...
...
@@ -24,7 +24,7 @@ use Bugzilla::User;
use
Date::
Format
;
use
Date::
Parse
;
use
File::
Basename
;
use
Digest::
MD5
qw(md5_hex
)
;
use
Digest::
SHA
qw(hmac_sha256_base64
)
;
use
base
qw(Exporter)
;
...
...
@@ -167,15 +167,13 @@ sub issue_hash_token {
my
$user_id
=
Bugzilla
->
user
->
id
||
remote_ip
();
# The concatenated string is of the form
# token creation time +
site-wide secret +
user ID (either ID or remote IP) + data
my
@args
=
(
$time
,
Bugzilla
->
localconfig
->
{
'site_wide_secret'
},
$user_id
,
@$data
);
# token creation time + user ID (either ID or remote IP) + data
my
@args
=
(
$time
,
$user_id
,
@$data
);
my
$token
=
join
(
'*'
,
@args
);
# Wide characters cause md5_hex() to die.
if
(
Bugzilla
->
params
->
{
'utf8'
})
{
utf8::
encode
(
$token
)
if
utf8::
is_utf8
(
$token
);
}
$token
=
md5_hex
(
$token
);
$token
=
hmac_sha256_base64
(
$token
,
Bugzilla
->
localconfig
->
{
'site_wide_secret'
});
$token
=~
s/\+/-/g
;
$token
=~
s/\//_/g
;
# Prepend the token creation time, unencrypted, so that the token
# lifetime can be validated.
...
...
reports.cgi
View file @
f53fede6
...
...
@@ -17,7 +17,7 @@ use Bugzilla::Error;
use
Bugzilla::
Status
;
use
File::
Basename
;
use
Digest::
MD5
qw(md5_hex
)
;
use
Digest::
SHA
qw(hmac_sha256_base64
)
;
# If we're using bug groups for products, we should apply those restrictions
# to viewing reports, as well. Time to check the login in that case.
...
...
@@ -88,14 +88,12 @@ else {
# Filenames must not be guessable as they can point to products
# you are not allowed to see. Also, different projects can have
# the same product names.
my
$key
=
Bugzilla
->
localconfig
->
{
'site_wide_secret'
};
my
$project
=
bz_locations
()
->
{
'project'
}
||
''
;
my
$image_file
=
join
(
':'
,
(
$key
,
$project
,
$prod_id
,
@datasets
));
# Wide characters cause md5_hex() to die.
if
(
Bugzilla
->
params
->
{
'utf8'
})
{
utf8::
encode
(
$image_file
)
if
utf8::
is_utf8
(
$image_file
);
}
$image_file
=
md5_hex
(
$image_file
)
.
'.png'
;
my
$image_file
=
join
(
':'
,
(
$project
,
$prod_id
,
@datasets
));
my
$key
=
Bugzilla
->
localconfig
->
{
'site_wide_secret'
};
$image_file
=
hmac_sha256_base64
(
$image_file
,
$key
)
.
'.png'
;
$image_file
=~
s/\+/-/g
;
$image_file
=~
s/\//_/g
;
trick_taint
(
$image_file
);
if
(
!
-
e
"$graph_dir/$image_file"
)
{
...
...
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