Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
erp5
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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Titouan Soulard
erp5
Commits
c844cb3f
Commit
c844cb3f
authored
Mar 19, 2023
by
Jérome Perrin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
*: fix wrong base64 usage
parent
5b43a962
Changes
11
Show whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
20 additions
and
19 deletions
+20
-19
bt5/erp5_core_test/TestTemplateItem/portal_components/test.erp5.testCookieCrumbler.py
...ateItem/portal_components/test.erp5.testCookieCrumbler.py
+2
-2
bt5/erp5_dms/ExtensionTemplateItem/portal_components/extension.erp5.DocumentManagement.py
...em/portal_components/extension.erp5.DocumentManagement.py
+3
-3
bt5/erp5_officejs/SkinTemplateItem/portal_skins/erp5_officejs_common/StaticWebSite_getRedirectSourceUrlForOfficeJSApplication.py
...aticWebSite_getRedirectSourceUrlForOfficeJSApplication.py
+2
-2
bt5/erp5_payzen_secure_payment/DocumentTemplateItem/portal_components/document.erp5.PayzenService.py
...lateItem/portal_components/document.erp5.PayzenService.py
+2
-2
bt5/erp5_smart_assistant/SkinTemplateItem/portal_skins/erp5_smart_assistant/Query_createExpenseRecord.py
...l_skins/erp5_smart_assistant/Query_createExpenseRecord.py
+2
-2
bt5/erp5_web_shacache/TestTemplateItem/portal_components/test.erp5.ShaCacheMixin.py
...TemplateItem/portal_components/test.erp5.ShaCacheMixin.py
+1
-1
bt5/networkcache_erp5/TestTemplateItem/portal_components/test.erp5.testShaCacheExternal.py
...eItem/portal_components/test.erp5.testShaCacheExternal.py
+2
-2
bt5/networkcache_erp5/TestTemplateItem/portal_components/test.erp5.testShaDirExternal.py
...ateItem/portal_components/test.erp5.testShaDirExternal.py
+2
-2
erp5/util/testbrowser/examples/createERP5User.py
erp5/util/testbrowser/examples/createERP5User.py
+1
-1
product/ERP5/bin/bigfile_client_example.py
product/ERP5/bin/bigfile_client_example.py
+1
-1
product/ERP5Security/__init__.py
product/ERP5Security/__init__.py
+2
-1
No files found.
bt5/erp5_core_test/TestTemplateItem/portal_components/test.erp5.testCookieCrumbler.py
View file @
c844cb3f
...
@@ -73,7 +73,7 @@ class ERP5CookieCrumblerTests (CookieCrumblerTests):
...
@@ -73,7 +73,7 @@ class ERP5CookieCrumblerTests (CookieCrumblerTests):
self
.
req
=
makerequest
(
root
,
self
.
responseOut
)
self
.
req
=
makerequest
(
root
,
self
.
responseOut
)
self
.
credentials
=
quote
(
self
.
credentials
=
quote
(
base64
.
encodebytes
(
'abraham:pass-w'
).
replace
(
'
\
012
'
,
''
))
base64
.
encodebytes
(
b'abraham:pass-w'
).
decode
(
).
replace
(
'
\
012
'
,
''
))
def
testCookieLongLogin
(
self
):
def
testCookieLongLogin
(
self
):
# verify the user and auth cookie get set
# verify the user and auth cookie get set
...
@@ -88,7 +88,7 @@ class ERP5CookieCrumblerTests (CookieCrumblerTests):
...
@@ -88,7 +88,7 @@ class ERP5CookieCrumblerTests (CookieCrumblerTests):
'abrahammmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm'
)
'abrahammmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmmm'
)
resp
=
self
.
req
.
response
resp
=
self
.
req
.
response
self
.
assertIn
(
'__ac'
,
resp
.
cookies
)
self
.
assertIn
(
'__ac'
,
resp
.
cookies
)
self
.
credentials
=
base64
.
encodebytes
(
'%s:%s'
%
(
long_name
,
long_pass
)
).
replace
(
'
\
012
'
,
''
)
self
.
credentials
=
base64
.
encodebytes
(
(
'%s:%s'
%
(
long_name
,
long_pass
)).
encode
()).
decode
(
).
replace
(
'
\
012
'
,
''
)
self
.
assertEqual
(
resp
.
cookies
[
'__ac'
][
'value'
],
self
.
assertEqual
(
resp
.
cookies
[
'__ac'
][
'value'
],
self
.
credentials
)
self
.
credentials
)
self
.
assertEqual
(
resp
.
cookies
[
'__ac'
][
normalizeCookieParameterName
(
'path'
)],
'/'
)
self
.
assertEqual
(
resp
.
cookies
[
'__ac'
][
normalizeCookieParameterName
(
'path'
)],
'/'
)
...
...
bt5/erp5_dms/ExtensionTemplateItem/portal_components/extension.erp5.DocumentManagement.py
View file @
c844cb3f
...
@@ -58,8 +58,8 @@ def convertToOdf(self, name, data):
...
@@ -58,8 +58,8 @@ def convertToOdf(self, name, data):
to work with (and we for example have to figure out portal_type)
to work with (and we for example have to figure out portal_type)
"""
"""
sp
=
mkProxy
(
self
)
sp
=
mkProxy
(
self
)
kw
=
sp
.
run_convert
(
name
,
base64
.
encodebytes
(
data
))
kw
=
sp
.
run_convert
(
name
,
base64
.
encodebytes
(
data
).
decode
(
))
odf
=
base64
.
decodebytes
(
kw
[
'data'
])
odf
=
base64
.
decodebytes
(
kw
[
'data'
]
.
encode
()
)
return
odf
return
odf
def
mkProxy
(
self
):
def
mkProxy
(
self
):
...
@@ -74,7 +74,7 @@ def mkProxy(self):
...
@@ -74,7 +74,7 @@ def mkProxy(self):
def
generateFile
(
self
,
name
,
data
,
format
):
# pylint: disable=redefined-builtin
def
generateFile
(
self
,
name
,
data
,
format
):
# pylint: disable=redefined-builtin
sp
=
mkProxy
(
self
)
sp
=
mkProxy
(
self
)
kw
=
sp
.
run_generate
(
name
,
data
,
None
,
format
)
kw
=
sp
.
run_generate
(
name
,
data
,
None
,
format
)
res
=
base64
.
decodebytes
(
kw
[
'data'
])
res
=
base64
.
decodebytes
(
kw
[
'data'
]
.
encode
()
)
return
res
return
res
def
getAttrFromFilename
(
self
,
fname
):
def
getAttrFromFilename
(
self
,
fname
):
...
...
bt5/erp5_officejs/SkinTemplateItem/portal_skins/erp5_officejs_common/StaticWebSite_getRedirectSourceUrlForOfficeJSApplication.py
View file @
c844cb3f
...
@@ -19,8 +19,8 @@ except KeyError:
...
@@ -19,8 +19,8 @@ except KeyError:
return
result_dict
return
result_dict
try
:
try
:
encoded
=
name
.
replace
(
"definition_view/"
,
""
,
1
)
encoded
=
name
.
replace
(
"definition_view/"
,
""
,
1
)
.
encode
()
name
=
base64
.
decodebytes
(
encoded
)
name
=
base64
.
decodebytes
(
encoded
)
.
decode
()
base_64
=
True
base_64
=
True
except
binascii
.
Error
:
except
binascii
.
Error
:
pass
pass
...
...
bt5/erp5_payzen_secure_payment/DocumentTemplateItem/portal_components/document.erp5.PayzenService.py
View file @
c844cb3f
...
@@ -55,9 +55,9 @@ class PayzenREST:
...
@@ -55,9 +55,9 @@ class PayzenREST:
def
callPayzenApi
(
self
,
URL
,
payzen_dict
):
def
callPayzenApi
(
self
,
URL
,
payzen_dict
):
base64string
=
base64
.
encodebytes
(
base64string
=
base64
.
encodebytes
(
'%s:%s'
%
(
(
'%s:%s'
%
(
self
.
getServiceUsername
(),
self
.
getServiceUsername
(),
self
.
getServiceApiKey
())).
replace
(
'
\
n
'
,
''
)
self
.
getServiceApiKey
())).
encode
()).
decode
().
replace
(
'
\
n
'
,
''
)
header
=
{
"Authorization"
:
"Basic %s"
%
base64string
}
header
=
{
"Authorization"
:
"Basic %s"
%
base64string
}
LOG
(
'callPayzenApi'
,
WARNING
,
LOG
(
'callPayzenApi'
,
WARNING
,
"data = %s URL = %s"
%
(
str
(
payzen_dict
),
URL
),
error
=
False
)
"data = %s URL = %s"
%
(
str
(
payzen_dict
),
URL
),
error
=
False
)
...
...
bt5/erp5_smart_assistant/SkinTemplateItem/portal_skins/erp5_smart_assistant/Query_createExpenseRecord.py
View file @
c844cb3f
...
@@ -2,8 +2,8 @@ import base64
...
@@ -2,8 +2,8 @@ import base64
portal
=
context
.
getPortalObject
()
portal
=
context
.
getPortalObject
()
expense_record_module
=
portal
.
getDefaultModule
(
'Expense Record'
)
expense_record_module
=
portal
.
getDefaultModule
(
'Expense Record'
)
sender
=
portal
.
portal_membership
.
getAuthenticatedMember
().
getUserValue
()
sender
=
portal
.
portal_membership
.
getAuthenticatedMember
().
getUserValue
()
data
=
context
.
getData
(
)
data
=
bytes
(
context
.
getData
()
)
data64
=
u''
.
join
(
base64
.
encodebytes
(
data
).
splitlines
())
data64
=
u''
.
join
(
base64
.
encodebytes
(
data
).
decode
().
splitlines
())
photo_data
=
u'data:%s;base64,%s'
%
(
"image/*"
,
data64
)
photo_data
=
u'data:%s;base64,%s'
%
(
"image/*"
,
data64
)
expense_record_module
.
newContent
(
expense_record_module
.
newContent
(
comment
=
comment
,
comment
=
comment
,
...
...
bt5/erp5_web_shacache/TestTemplateItem/portal_components/test.erp5.ShaCacheMixin.py
View file @
c844cb3f
...
@@ -48,7 +48,7 @@ class ShaCacheMixin(object):
...
@@ -48,7 +48,7 @@ class ShaCacheMixin(object):
self
.
shacache
.
publish
()
self
.
shacache
.
publish
()
self
.
header_dict
=
{
self
.
header_dict
=
{
'Content-Type'
:
'application/json'
,
'Content-Type'
:
'application/json'
,
'Authorization'
:
'Basic %s'
%
(
base64
.
encodebytes
(
'ERP5TypeTestCase:'
).
strip
())
'Authorization'
:
'Basic %s'
%
(
base64
.
encodebytes
(
b'ERP5TypeTestCase:'
).
decode
(
).
strip
())
}
}
self
.
shacache_url
=
self
.
shacache
.
absolute_url
()
self
.
shacache_url
=
self
.
shacache
.
absolute_url
()
self
.
tic
()
self
.
tic
()
...
...
bt5/networkcache_erp5/TestTemplateItem/portal_components/test.erp5.testShaCacheExternal.py
View file @
c844cb3f
...
@@ -59,8 +59,8 @@ class TestShaCacheExternal(ShaCacheMixin, ShaSecurityMixin, ERP5TypeTestCase):
...
@@ -59,8 +59,8 @@ class TestShaCacheExternal(ShaCacheMixin, ShaSecurityMixin, ERP5TypeTestCase):
# Define POST headers with Authentication
# Define POST headers with Authentication
self
.
content_type
=
'application/json'
self
.
content_type
=
'application/json'
authentication_string
=
'lucas:lucas'
authentication_string
=
b
'lucas:lucas'
base64string
=
base64
.
encodebytes
(
authentication_string
).
strip
()
base64string
=
base64
.
encodebytes
(
authentication_string
).
decode
().
strip
()
self
.
header_dict
=
{
'Authorization'
:
'Basic %s'
%
base64string
,
self
.
header_dict
=
{
'Authorization'
:
'Basic %s'
%
base64string
,
'Content-Type'
:
self
.
content_type
}
'Content-Type'
:
self
.
content_type
}
...
...
bt5/networkcache_erp5/TestTemplateItem/portal_components/test.erp5.testShaDirExternal.py
View file @
c844cb3f
...
@@ -60,8 +60,8 @@ class TestShaDirExternal(ShaDirMixin, ShaSecurityMixin, ERP5TypeTestCase):
...
@@ -60,8 +60,8 @@ class TestShaDirExternal(ShaDirMixin, ShaSecurityMixin, ERP5TypeTestCase):
# Define POST headers with Authentication
# Define POST headers with Authentication
self
.
content_type
=
'application/json'
self
.
content_type
=
'application/json'
authentication_string
=
'lucas:lucas'
authentication_string
=
b
'lucas:lucas'
base64string
=
base64
.
encodebytes
(
authentication_string
).
strip
()
base64string
=
base64
.
encodebytes
(
authentication_string
).
decode
().
strip
()
self
.
header_dict
=
{
'Authorization'
:
'Basic %s'
%
base64string
,
self
.
header_dict
=
{
'Authorization'
:
'Basic %s'
%
base64string
,
'Content-Type'
:
self
.
content_type
}
'Content-Type'
:
self
.
content_type
}
...
...
erp5/util/testbrowser/examples/createERP5User.py
View file @
c844cb3f
...
@@ -45,7 +45,7 @@ zope_url = url.rsplit('/', 2)[0]
...
@@ -45,7 +45,7 @@ zope_url = url.rsplit('/', 2)[0]
import
base64
import
base64
browser
.
mech_browser
.
addheaders
.
append
(
browser
.
mech_browser
.
addheaders
.
append
(
(
'Authorization'
,
(
'Authorization'
,
'Basic %s'
%
base64
.
encodebytes
(
'%s:%s'
%
(
username
,
password
))
))
'Basic %s'
%
base64
.
encodebytes
(
(
'%s:%s'
%
(
username
,
password
)).
encode
())).
decode
(
))
for
index
in
range
(
user_nbr
):
for
index
in
range
(
user_nbr
):
new_username
=
"%s%d"
%
(
new_username_prefix
,
index
)
new_username
=
"%s%d"
%
(
new_username_prefix
,
index
)
...
...
product/ERP5/bin/bigfile_client_example.py
View file @
c844cb3f
...
@@ -4,7 +4,7 @@ import six.moves.http_client
...
@@ -4,7 +4,7 @@ import six.moves.http_client
connection
=
six
.
moves
.
http_client
.
HTTPConnection
(
'192.168.242.68:12001'
)
connection
=
six
.
moves
.
http_client
.
HTTPConnection
(
'192.168.242.68:12001'
)
import
base64
import
base64
base64string
=
base64
.
encodebytes
(
'zope:insecure'
)[:
-
1
]
base64string
=
base64
.
encodebytes
(
b'zope:insecure'
).
decode
(
)[:
-
1
]
n
=
1
<<
20
n
=
1
<<
20
...
...
product/ERP5Security/__init__.py
View file @
c844cb3f
...
@@ -75,7 +75,8 @@ def _setUserNameForAccessLog(username, REQUEST):
...
@@ -75,7 +75,8 @@ def _setUserNameForAccessLog(username, REQUEST):
except
AttributeError
:
except
AttributeError
:
pass
pass
else
:
else
:
medusa_headers
[
'authorization'
]
=
'Basic %s'
%
encodebytes
(
'%s:'
%
username
).
rstrip
()
# BBB ZServer
medusa_headers
[
'authorization'
]
=
'Basic %s'
%
encodebytes
((
'%s:'
%
username
).
encode
()).
decode
().
rstrip
()
else
:
else
:
REQUEST
.
_orig_env
[
'REMOTE_USER'
]
=
username
REQUEST
.
_orig_env
[
'REMOTE_USER'
]
=
username
...
...
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