diff options
author | tailor <cygnus@janrain.com> | 2007-10-02 23:30:49 +0000 |
---|---|---|
committer | tailor <cygnus@janrain.com> | 2007-10-02 23:30:49 +0000 |
commit | 829cbf7c025e9e72d6a58f4c787fa8a446c7717e (patch) | |
tree | b9025cc92b8caf51b7db335ee252937c429eab65 | |
parent | 21257027342bcd76514c308ccb951f6fcdb9a414 (diff) | |
download | php-openid-829cbf7c025e9e72d6a58f4c787fa8a446c7717e.zip php-openid-829cbf7c025e9e72d6a58f4c787fa8a446c7717e.tar.gz php-openid-829cbf7c025e9e72d6a58f4c787fa8a446c7717e.tar.bz2 |
[project @ Fail return_to verification if bare args in response are absent from return_to]
-rw-r--r-- | Auth/OpenID/Consumer.php | 11 | ||||
-rw-r--r-- | Tests/Auth/OpenID/Consumer.php | 13 |
2 files changed, 24 insertions, 0 deletions
diff --git a/Auth/OpenID/Consumer.php b/Auth/OpenID/Consumer.php index 7049164..4fe8cb5 100644 --- a/Auth/OpenID/Consumer.php +++ b/Auth/OpenID/Consumer.php @@ -873,6 +873,17 @@ class Auth_OpenID_GenericConsumer { } } + // Make sure all non-OpenID arguments in the response are also + // in the signed return_to. + $bare_args = $message->getArgs(Auth_OpenID_BARE_NS); + foreach ($bare_args as $key => $value) { + if (Auth_OpenID::arrayGet($q, $key) != $value) { + return new Auth_OpenID_FailureResponse( + sprintf("Parameter %s = %s not in return_to URL", + $key, $value)); + } + } + return true; } diff --git a/Tests/Auth/OpenID/Consumer.php b/Tests/Auth/OpenID/Consumer.php index 03163c8..0578e4b 100644 --- a/Tests/Auth/OpenID/Consumer.php +++ b/Tests/Auth/OpenID/Consumer.php @@ -1058,6 +1058,19 @@ class TestReturnToArgs extends PHPUnit_TestCase { $this->consumer = new Auth_OpenID_GenericConsumer($store); } + function test_returnToArgsUnexpectedArg() + { + $query = array( + 'openid.mode' => 'id_res', + 'openid.return_to' => 'http://example.com/', + 'foo' => 'bar'); + + // no return value, success is assumed if there are no + // exceptions. + $this->assertTrue(Auth_OpenID::isFailure( + $this->consumer->_verifyReturnToArgs($query))); + } + function test_returnToArgsOkay() { $query = array( |