From a2c6e00e229357447fee22a11828fc94cf2cdc5a Mon Sep 17 00:00:00 2001 From: Chris Evett Date: Thu, 25 Nov 2021 05:03:57 -0500 Subject: [PATCH] fix: STS xml was malformed (#4637) --- moto/sts/responses.py | 3 +-- tests/test_sts/test_server.py | 12 ++++++++++++ 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/moto/sts/responses.py b/moto/sts/responses.py index 98f7a5d97..4e6fcf352 100644 --- a/moto/sts/responses.py +++ b/moto/sts/responses.py @@ -118,8 +118,7 @@ GET_SESSION_TOKEN_RESPONSE = """ +GET_FEDERATION_TOKEN_RESPONSE = """ AQoDYXdzEPT//////////wEXAMPLEtc764bNrC9SAPBSM22wDOk4x4HIZ8j4FZTwdQWLWsKWHGBuFqwAeMicRXmxfpSPfIeoIYRqTflfKD8YUuwthAx7mSEI/qkPpKPi/kMcGdQrmGdeehM4IC1NtBmUpp2wUE8phUZampKsburEDy0KPkyQDYwT7WZ0wq5VSXDvp75YU9HFvlRd8Tx6q6fE8YQcHNVXAkiY9q6d+xo0rKwT38xVqr7ZD0u0iPPkUL64lIZbqBAz+scqKmlzm8FDrypNC9Yjc8fPOLn9FX9KSYvKTr4rvx3iSIlTJabIQwj2ICCR/oLxBA== diff --git a/tests/test_sts/test_server.py b/tests/test_sts/test_server.py index 1c67970c9..8d3cbc52c 100644 --- a/tests/test_sts/test_server.py +++ b/tests/test_sts/test_server.py @@ -36,3 +36,15 @@ def test_sts_get_caller_identity(): res.data.should.contain(b"Arn") res.data.should.contain(b"UserId") res.data.should.contain(b"Account") + + +def test_sts_wellformed_xml(): + backend = server.create_backend_app("sts") + test_client = backend.test_client() + + res = test_client.get("/?Action=GetFederationToken&Name=Bob") + res.data.should_not.contain(b"\n") + res = test_client.get("/?Action=GetSessionToken") + res.data.should_not.contain(b"\n") + res = test_client.get("/?Action=GetCallerIdentity") + res.data.should_not.contain(b"\n")