Skip to content

Commit 9e4da9b

Browse files
authored
Merge branch 'master' into master
2 parents fb5d189 + 1474c4b commit 9e4da9b

33 files changed

+412
-530
lines changed

.travis.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ language: python
55
python:
66
- 3.6
77
- 3.7
8+
- 3.8
89
- pypy3
910

1011
addons:

CHANGELOG.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,22 @@
11
# Changelog
22

3+
## 5.1.0 (2020-06-09)
4+
5+
- support eIDAS RequestedAttributes per AuthnRequest
6+
- fix xmlsec1 --id-attr configuration option value
7+
- do not remove existing disco URL query params
8+
- load attribute maps in predictable order
9+
- better error message when AudienceRestriction does not validate
10+
- always use base64.encodebytes instead of base64.encodestring
11+
- update the eIDAS attribute mapping for legal person
12+
- fix py_compile warnings
13+
- fix pylint errors and warnings
14+
- various small fixes
15+
- add Python3.8 as supported
16+
- tests: fix validity dates
17+
- docs: document default value for 'want_response_signed'
18+
19+
320
## 5.0.0 (2020-01-13)
421

522
- Fix XML Signature Wrapping (XSW) vulnerabilities - CVE-2020-5390

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
5.0.0
1+
5.1.0

docs/howto/config.rst

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ Format::
189189
key_file: "key.pem"
190190

191191
*key_file* is the name of a PEM formatted file that contains the private key
192-
of the service. This is presently used both to encrypt/sign assertions and as
192+
of the service. This is currently used both to encrypt/sign assertions and as
193193
the client key in an HTTPS session.
194194

195195
metadata
@@ -270,7 +270,7 @@ Where you describe the organization responsible for the service.::
270270
preferred_binding
271271
^^^^^^^^^^^^^^^^^
272272

273-
Which binding should be prefered for a service.
273+
Which binding should be preferred for a service.
274274
Example configuration::
275275

276276
"preferred_binding" = {
@@ -340,16 +340,16 @@ accepted_time_diff
340340
^^^^^^^^^^^^^^^^^^
341341

342342
If your computer and another computer that you are communicating with are not
343-
in synch regarding the computer clock, then here you can state how big a
343+
in sync regarding the computer clock, then here you can state how big a
344344
difference you are prepared to accept.
345345

346-
.. note:: This will indiscriminately affect all-time comparisons.
347-
Hence your server my accept a statement that in fact is too old.
346+
.. note:: This will indiscriminately affect all time comparisons.
347+
Hence your server may accept a statement that in fact is too old.
348348

349349
xmlsec_binary
350350
^^^^^^^^^^^^^
351351

352-
Presently xmlsec1 binaries are used for all the signing and encryption stuff.
352+
Currently xmlsec1 binaries are used for all the signing and encryption stuff.
353353
This option defines where the binary is situated.
354354

355355
Example::
@@ -385,7 +385,7 @@ Directives that are specific to a certain type of service.
385385
idp/aa
386386
^^^^^^
387387

388-
Directives that are specific to an IdP or AA service instance
388+
Directives that are specific to an IdP or AA service instance.
389389

390390
sign_assertion
391391
""""""""""""""
@@ -498,6 +498,8 @@ want_response_signed
498498
Indicates that Authentication Responses to this SP must be signed. If set to
499499
True, the SP will not consume any SAML Responses that are not signed.
500500

501+
Valid values are True or False. Default value is True.
502+
501503
Example::
502504

503505
"service": {
@@ -629,7 +631,7 @@ name_format indicates the name format for that attribute, such as
629631

630632
It is mandatory that at least name or friendly_name is set.
631633
By default attributes are assumed to be required.
632-
Missing attributes are infered based on the attribute maps data.
634+
Missing attributes are inferred based on the attribute maps data.
633635

634636
Example::
635637

@@ -844,7 +846,7 @@ or if you want to use for instance memcache::
844846

845847
"subject_data": ("memcached", "localhost:12121"),
846848

847-
*shelve* and *memcached* are the only database types that are presently
849+
*shelve* and *memcached* are the only database types that are currently
848850
supported.
849851

850852

example/sp-wsgi/sp.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,10 @@
22
from __future__ import print_function
33

44
import argparse
5-
import cgi
5+
try:
6+
import html
7+
except:
8+
import cgi as html
69
import importlib
710
import logging
811
import os
@@ -48,6 +51,9 @@
4851
from saml2.saml import NAMEID_FORMAT_PERSISTENT
4952
from saml2.samlp import Extensions
5053

54+
def _html_escape(payload):
55+
return html.escape(payload, quote=True)
56+
5157
logger = logging.getLogger("")
5258
hdlr = logging.FileHandler("spx.log")
5359
base_formatter = logging.Formatter("%(asctime)s %(name)s:%(levelname)s %(message)s")
@@ -699,7 +705,7 @@ def main(environ, start_response, sp):
699705
body = dict_to_table(user.data)
700706
body.append(
701707
"<br><pre>{authn_stmt}</pre>".format(
702-
authn_stmt=cgi.escape(user.authn_statement)
708+
authn_stmt=_html_escape(user.authn_statement)
703709
)
704710
)
705711
body.append("<br><a href='/logout'>logout</a>")

setup.cfg

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ classifier =
2222
Programming Language :: Python :: 3 :: Only
2323
Programming Language :: Python :: 3.6
2424
Programming Language :: Python :: 3.7
25+
Programming Language :: Python :: 3.8
2526
requires-dist = setuptools
2627
keywords =
2728
saml

src/saml2/__init__.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121

2222
import six
2323

24-
import saml2.version
24+
from saml2.version import version as __version__
2525
from saml2.validate import valid_instance
2626

2727
try:
@@ -40,11 +40,7 @@
4040
import defusedxml.ElementTree
4141

4242

43-
__version__ = str(saml2.version.version)
44-
45-
46-
root_logger = logging.getLogger(__name__)
47-
root_logger.level = logging.NOTSET
43+
logger = logging.getLogger(__name__)
4844

4945
NAMESPACE = 'urn:oasis:names:tc:SAML:2.0:assertion'
5046
# TEMPLATE = '{urn:oasis:names:tc:SAML:2.0:assertion}%s'

src/saml2/attribute_converter.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ def ac_factory(path=""):
6262
if path not in sys.path:
6363
sys.path.insert(0, path)
6464

65-
for fil in os.listdir(path):
65+
for fil in sorted(os.listdir(path)):
6666
if fil.endswith(".py"):
6767
mod = import_module(fil[:-3])
6868
for key, item in mod.__dict__.items():

src/saml2/attributemaps/saml_uri.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,9 @@
3636
'identifier': 'urn:oasis:names:tc:SAML:2.0:attrname-format:uri',
3737
'fro': {
3838
EIDAS_LEGALPERSON+'LegalPersonIdentifier': 'LegalPersonIdentifier',
39-
EIDAS_LEGALPERSON+'LegalAddress': 'LegalAddress',
39+
EIDAS_LEGALPERSON+'LegalPersonAddress': 'LegalAddress',
4040
EIDAS_LEGALPERSON+'LegalName': 'LegalName',
41-
EIDAS_LEGALPERSON+'VATRegistration': 'VATRegistration',
41+
EIDAS_LEGALPERSON+'VATRegistrationNumber': 'VATRegistration',
4242
EIDAS_LEGALPERSON+'TaxReference': 'TaxReference',
4343
EIDAS_LEGALPERSON+'BusinessCodes': 'BusinessCodes',
4444
EIDAS_LEGALPERSON+'LEI': 'LEI',
@@ -218,9 +218,9 @@
218218
},
219219
'to': {
220220
'LegalPersonIdentifier': EIDAS_LEGALPERSON+'LegalPersonIdentifier',
221-
'LegalAddress': EIDAS_LEGALPERSON+'LegalAddress',
221+
'LegalAddress': EIDAS_LEGALPERSON+'LegalPersonAddress',
222222
'LegalName': EIDAS_LEGALPERSON+'LegalName',
223-
'VATRegistration': EIDAS_LEGALPERSON+'VATRegistration',
223+
'VATRegistration': EIDAS_LEGALPERSON+'VATRegistrationNumber',
224224
'TaxReference': EIDAS_LEGALPERSON+'TaxReference',
225225
'BusinessCodes': EIDAS_LEGALPERSON+'BusinessCodes',
226226
'LEI': EIDAS_LEGALPERSON+'LEI',

src/saml2/authn.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,13 @@ def __init__(self, srv):
2929
self.srv = srv
3030

3131
def __call__(self, *args, **kwargs):
32-
raise NotImplemented
32+
raise NotImplementedError
3333

3434
def authenticated_as(self, **kwargs):
35-
raise NotImplemented
35+
raise NotImplementedError
3636

3737
def verify(self, **kwargs):
38-
raise NotImplemented
38+
raise NotImplementedError
3939

4040

4141
def is_equal(a, b):

0 commit comments

Comments
 (0)