Skip to content
This repository was archived by the owner on Jun 1, 2023. It is now read-only.

Commit 6abd369

Browse files
committed
Fixed character set limitations. Added tests.
1 parent 576d379 commit 6abd369

File tree

3 files changed

+16
-2
lines changed

3 files changed

+16
-2
lines changed

Diff for: src/oidcmsg/oauth2/__init__.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ def verify(self, **kwargs):
4646
if "error_description" in self:
4747
# Verify that the characters used are within the allow ranges
4848
# %x20-21 / %x23-5B / %x5D-7E
49-
if all(x in error_chars for x in self["error_description"]):
49+
if not all(x in error_chars for x in self["error_description"]):
5050
raise ValueError("Characters outside allowed set")
5151
return True
5252

Diff for: tests/test_4_message.py

+15
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@
3434

3535
__author__ = 'Roland Hedberg'
3636

37+
from oidcmsg.oauth2 import ResponseMessage
38+
3739
keys = [
3840
{"type": "RSA", "use": ["sig"]},
3941
{"type": "RSA", "use": ["enc"]},
@@ -496,3 +498,16 @@ def test_msg_ser():
496498
msg_ser([1,2], 'dict')
497499
with pytest.raises(OidcMsgError):
498500
msg_ser([1,2], 'list')
501+
502+
503+
def test_error_description():
504+
msg = ResponseMessage(error="foobar", error_description="ÅÄÖ")
505+
with pytest.raises(ValueError):
506+
msg.verify()
507+
508+
msg = ResponseMessage(error="foobar", error_description="abc\ndef")
509+
with pytest.raises(ValueError):
510+
msg.verify()
511+
512+
msg = ResponseMessage(error="foobar", error_description="abc def")
513+
msg.verify()

Diff for: tests/test_7_session.py

-1
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,6 @@ def full_path(local_file):
6262
class TestEndSessionResponse(object):
6363
def test_example(self):
6464
esr = EndSessionResponse()
65-
pass
6665

6766

6867
class TestEndSessionRequest(object):

0 commit comments

Comments
 (0)