Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Z
Zope
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
Zope
Commits
fb54f38a
Commit
fb54f38a
authored
Oct 31, 2012
by
Hanno Schlichting
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
LP #1071067: Use a stronger random number generator and a constant time comparison function.
parent
ebddcb13
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
36 additions
and
9 deletions
+36
-9
doc/CHANGES.rst
doc/CHANGES.rst
+5
-2
setup.py
setup.py
+1
-1
src/Products/Sessions/BrowserIdManager.py
src/Products/Sessions/BrowserIdManager.py
+29
-5
versions.cfg
versions.cfg
+1
-1
No files found.
doc/CHANGES.rst
View file @
fb54f38a
...
@@ -5,12 +5,12 @@ This file contains change information for the current Zope release.
...
@@ -5,12 +5,12 @@ This file contains change information for the current Zope release.
Change information for previous versions of Zope can be found at
Change information for previous versions of Zope can be found at
http://docs.zope.org/zope2/releases/.
http://docs.zope.org/zope2/releases/.
2.13.19 (
unreleased
)
2.13.19 (
2012-10-31
)
--------------------
--------------------
- Updated distributions:
- Updated distributions:
- AccessControl = 2.13.1
1
- AccessControl = 2.13.1
2
- distribute = 0.6.29
- distribute = 0.6.29
- mr.developer = 1.22
- mr.developer = 1.22
- pytz = 2012g
- pytz = 2012g
...
@@ -18,6 +18,9 @@ http://docs.zope.org/zope2/releases/.
...
@@ -18,6 +18,9 @@ http://docs.zope.org/zope2/releases/.
- repoze.tm2 = 1.0
- repoze.tm2 = 1.0
- tempstorage = 2.12.2
- tempstorage = 2.12.2
- LP #1071067: Use a stronger random number generator and a constant time
comparison function.
- LP #1061247: Fix ZMI properties edit form for properties named `method`.
- LP #1061247: Fix ZMI properties edit form for properties named `method`.
- LP #1058049: Fix support for zoperunner section in zope.conf.
- LP #1058049: Fix support for zoperunner section in zope.conf.
...
...
setup.py
View file @
fb54f38a
...
@@ -23,7 +23,7 @@ if sys.platform[:3].lower() == "win":
...
@@ -23,7 +23,7 @@ if sys.platform[:3].lower() == "win":
setup
(
name
=
'Zope2'
,
setup
(
name
=
'Zope2'
,
version
=
'2.13.19
dev
'
,
version
=
'2.13.19'
,
url
=
'http://zope2.zope.org'
,
url
=
'http://zope2.zope.org'
,
license
=
'ZPL 2.1'
,
license
=
'ZPL 2.1'
,
description
=
'Zope2 application server / web framework'
,
description
=
'Zope2 application server / web framework'
,
...
...
src/Products/Sessions/BrowserIdManager.py
View file @
fb54f38a
...
@@ -10,10 +10,12 @@
...
@@ -10,10 +10,12 @@
# FOR A PARTICULAR PURPOSE
# FOR A PARTICULAR PURPOSE
#
#
############################################################################
############################################################################
import
binascii
import
binascii
from
cgi
import
escape
from
cgi
import
escape
from
hashlib
import
sha256
import
logging
import
logging
import
random
import
os
import
re
import
re
import
string
import
string
import
sys
import
sys
...
@@ -63,6 +65,29 @@ TRAVERSAL_APPHANDLE = 'BrowserIdManager'
...
@@ -63,6 +65,29 @@ TRAVERSAL_APPHANDLE = 'BrowserIdManager'
LOG = logging.getLogger('
Zope
.
BrowserIdManager
')
LOG = logging.getLogger('
Zope
.
BrowserIdManager
')
# Use the system PRNG if possible
import random
try:
random = random.SystemRandom()
using_sysrandom = True
except NotImplementedError:
using_sysrandom = False
def _randint(start, end):
if not using_sysrandom:
# This is ugly, and a hack, but it makes things better than
# the alternative of predictability. This re-seeds the PRNG
# using a value that is hard for an attacker to predict, every
# time a random string is required. This may change the
# properties of the chosen random sequence slightly, but this
# is better than absolute predictability.
random.seed(sha256(
"%s%s%s" % (random.getstate(), time.time(), os.getpid())
).digest())
return random.randint(start, end)
def constructBrowserIdManager(
def constructBrowserIdManager(
self, id=BROWSERID_MANAGER_NAME, title='', idname='
_ZopeId
',
self, id=BROWSERID_MANAGER_NAME, title='', idname='
_ZopeId
',
location=('
cookies
', '
form
'), cookiepath='
/
', cookiedomain='',
location=('
cookies
', '
form
'), cookiepath='
/
', cookiedomain='',
...
@@ -555,7 +580,7 @@ def isAWellFormedBrowserId(bid, binerr=binascii.Error):
...
@@ -555,7 +580,7 @@ def isAWellFormedBrowserId(bid, binerr=binascii.Error):
return
None
return
None
def
getNewBrowserId
(
randint
=
random
.
randint
,
maxint
=
99999999
):
def
getNewBrowserId
(
randint
=
_
randint
,
maxint
=
99999999
):
""" Returns 19-character string browser id
""" Returns 19-character string browser id
'AAAAAAAABBBBBBBB'
'AAAAAAAABBBBBBBB'
where:
where:
...
@@ -570,5 +595,4 @@ def getNewBrowserId(randint=random.randint, maxint=99999999):
...
@@ -570,5 +595,4 @@ def getNewBrowserId(randint=random.randint, maxint=99999999):
An example is: 89972317A0C3EHnUi90w
An example is: 89972317A0C3EHnUi90w
"""
"""
return
'%08i%s'
%
(
randint
(
0
,
maxint
-
1
),
getB64TStamp
())
return
'%08i%s'
%
(
randint
(
0
,
maxint
-
1
),
getB64TStamp
())
versions.cfg
View file @
fb54f38a
...
@@ -4,7 +4,7 @@ versions = versions
...
@@ -4,7 +4,7 @@ versions = versions
[versions]
[versions]
# Zope2-specific
# Zope2-specific
Zope2 =
Zope2 =
2.13.19
AccessControl = 2.13.11
AccessControl = 2.13.11
Acquisition = 2.13.8
Acquisition = 2.13.8
DateTime = 2.12.7
DateTime = 2.12.7
...
...
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