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
d373bb13
Commit
d373bb13
authored
Jul 28, 2015
by
Dylan William Hardison
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Bug 1179856 - Increase length of logincookie value for greater security
r=gerv,a=sgreen
parent
19a2ebac
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
14 additions
and
3 deletions
+14
-3
Schema.pm
Bugzilla/DB/Schema.pm
+2
-2
DB.pm
Bugzilla/Install/DB.pm
+6
-0
Token.pm
Bugzilla/Token.pm
+6
-1
No files found.
Bugzilla/DB/Schema.pm
View file @
d373bb13
...
@@ -1148,7 +1148,7 @@ use constant ABSTRACT_SCHEMA => {
...
@@ -1148,7 +1148,7 @@ use constant ABSTRACT_SCHEMA => {
logincookies
=>
{
logincookies
=>
{
FIELDS
=>
[
FIELDS
=>
[
cookie
=>
{
TYPE
=>
'varchar(
16
)'
,
NOTNULL
=>
1
,
cookie
=>
{
TYPE
=>
'varchar(
22
)'
,
NOTNULL
=>
1
,
PRIMARYKEY
=>
1
},
PRIMARYKEY
=>
1
},
userid
=>
{
TYPE
=>
'INT3'
,
NOTNULL
=>
1
,
userid
=>
{
TYPE
=>
'INT3'
,
NOTNULL
=>
1
,
REFERENCES
=>
{
TABLE
=>
'profiles'
,
REFERENCES
=>
{
TABLE
=>
'profiles'
,
...
@@ -1190,7 +1190,7 @@ use constant ABSTRACT_SCHEMA => {
...
@@ -1190,7 +1190,7 @@ use constant ABSTRACT_SCHEMA => {
COLUMN
=>
'userid'
,
COLUMN
=>
'userid'
,
DELETE
=>
'CASCADE'
}},
DELETE
=>
'CASCADE'
}},
issuedate
=>
{
TYPE
=>
'DATETIME'
,
NOTNULL
=>
1
}
,
issuedate
=>
{
TYPE
=>
'DATETIME'
,
NOTNULL
=>
1
}
,
token
=>
{
TYPE
=>
'varchar(
16
)'
,
NOTNULL
=>
1
,
token
=>
{
TYPE
=>
'varchar(
22
)'
,
NOTNULL
=>
1
,
PRIMARYKEY
=>
1
},
PRIMARYKEY
=>
1
},
tokentype
=>
{
TYPE
=>
'varchar(16)'
,
NOTNULL
=>
1
}
,
tokentype
=>
{
TYPE
=>
'varchar(16)'
,
NOTNULL
=>
1
}
,
eventdata
=>
{
TYPE
=>
'TINYTEXT'
},
eventdata
=>
{
TYPE
=>
'TINYTEXT'
},
...
...
Bugzilla/Install/DB.pm
View file @
d373bb13
...
@@ -739,6 +739,12 @@ sub update_table_definitions {
...
@@ -739,6 +739,12 @@ sub update_table_definitions {
$dbh
->
bz_add_column
(
'keyworddefs'
,
'is_active'
,
$dbh
->
bz_add_column
(
'keyworddefs'
,
'is_active'
,
{
TYPE
=>
'BOOLEAN'
,
NOTNULL
=>
1
,
DEFAULT
=>
'TRUE'
});
{
TYPE
=>
'BOOLEAN'
,
NOTNULL
=>
1
,
DEFAULT
=>
'TRUE'
});
# 2015-07-25 dylan@mozilla.com - Bug 1179856
$dbh
->
bz_alter_column
(
'tokens'
,
'token'
,
{
TYPE
=>
'varchar(22)'
,
NOTNULL
=>
1
,
PRIMARYKEY
=>
1
});
$dbh
->
bz_alter_column
(
'logincookies'
,
'cookie'
,
{
TYPE
=>
'varchar(22)'
,
NOTNULL
=>
1
,
PRIMARYKEY
=>
1
});
################################################################
################################################################
# New --TABLE-- changes should go *** A B O V E *** this point #
# New --TABLE-- changes should go *** A B O V E *** this point #
################################################################
################################################################
...
...
Bugzilla/Token.pm
View file @
d373bb13
...
@@ -29,6 +29,11 @@ use parent qw(Exporter);
...
@@ -29,6 +29,11 @@ use parent qw(Exporter);
check_token_data delete_token
check_token_data delete_token
issue_hash_token check_hash_token)
;
issue_hash_token check_hash_token)
;
# 128 bits password:
# 128 * log10(2) / log10(62) = 21.49, round up to 22.
# 62 = 0-9, a-z, A-Z.
use
constant
TOKEN_LENGTH
=>
22
;
################################################################################
################################################################################
# Public Functions
# Public Functions
################################################################################
################################################################################
...
@@ -289,7 +294,7 @@ sub GenerateUniqueToken {
...
@@ -289,7 +294,7 @@ sub GenerateUniqueToken {
if
(
$tries
>
100
)
{
if
(
$tries
>
100
)
{
ThrowCodeError
(
"token_generation_error"
);
ThrowCodeError
(
"token_generation_error"
);
}
}
$token
=
generate_random_password
();
$token
=
generate_random_password
(
TOKEN_LENGTH
);
$sth
->
execute
(
$token
);
$sth
->
execute
(
$token
);
$duplicate
=
$sth
->
fetchrow_array
;
$duplicate
=
$sth
->
fetchrow_array
;
}
}
...
...
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