Skip to content

Commit 92b619b

Browse files
Release 0.8.1
1 parent 4e4d672 commit 92b619b

File tree

2 files changed

+8
-21
lines changed

2 files changed

+8
-21
lines changed

CHANGELOG.md

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

3+
## 0.8.1 - 2025-06-01
4+
5+
* Fixed insufficient nonce entropy (CVE-2025-21617)
6+
37
## 0.8.0 - 2025-06-01
48

59
* Adjusted some method modifiers and added return types

src/Oauth1.php

Lines changed: 4 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -100,10 +100,7 @@ public function __invoke(callable $handler)
100100
*/
101101
private function onBefore(RequestInterface $request): RequestInterface
102102
{
103-
$oauthparams = self::getOauthParams(
104-
$this->generateNonce($request),
105-
$this->config
106-
);
103+
$oauthparams = self::getOauthParams($this->config);
107104

108105
$oauthparams['oauth_signature'] = $this->getSignature($request, $oauthparams);
109106
uksort($oauthparams, 'strcmp');
@@ -179,19 +176,6 @@ public function getSignature(RequestInterface $request, array $params): string
179176
return base64_encode($signature);
180177
}
181178

182-
/**
183-
* Returns a Nonce Based on the unique id and URL.
184-
*
185-
* This will allow for multiple requests in parallel with the same exact
186-
* timestamp to use separate nonce's.
187-
*
188-
* @param RequestInterface $request Request to generate a nonce for
189-
*/
190-
private static function generateNonce(RequestInterface $request): string
191-
{
192-
return sha1(uniqid('', true).$request->getUri()->getHost().$request->getUri()->getPath());
193-
}
194-
195179
/**
196180
* Creates the Signature Base String.
197181
*
@@ -296,14 +280,13 @@ private function buildAuthorizationHeader(array $params): array
296280
/**
297281
* Get the oauth parameters as named by the oauth spec
298282
*
299-
* @param string $nonce Unique nonce
300-
* @param array $config Configuration options of the plugin.
283+
* @param array $config Configuration options of the plugin.
301284
*/
302-
private static function getOauthParams(string $nonce, array $config): array
285+
private static function getOauthParams(array $config): array
303286
{
304287
$params = [
305288
'oauth_consumer_key' => $config['consumer_key'],
306-
'oauth_nonce' => $nonce,
289+
'oauth_nonce' => bin2hex(random_bytes(20)),
307290
'oauth_signature_method' => $config['signature_method'],
308291
'oauth_timestamp' => time(),
309292
];

0 commit comments

Comments
 (0)