Skip to content

Commit

Permalink
update vendor libs
Browse files Browse the repository at this point in the history
  • Loading branch information
aheinze committed Feb 13, 2023
1 parent 08c9fa4 commit 7a58e3c
Show file tree
Hide file tree
Showing 11 changed files with 140 additions and 57 deletions.
16 changes: 8 additions & 8 deletions lib/vendor/composer/InstalledVersions.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ class InstalledVersions
'aliases' =>
array (
),
'reference' => '6342fd3a7fce734a66a29fe3f205f3bcc38c8fc3',
'reference' => '08c9fa4b32e0071aaa3a41a0b48ad733e6bc91bd',
'name' => 'cockpit-hq/cockpit',
),
'versions' =>
Expand Down Expand Up @@ -59,7 +59,7 @@ class InstalledVersions
'aliases' =>
array (
),
'reference' => '6342fd3a7fce734a66a29fe3f205f3bcc38c8fc3',
'reference' => '08c9fa4b32e0071aaa3a41a0b48ad733e6bc91bd',
),
'colinodell/json5' =>
array (
Expand Down Expand Up @@ -99,12 +99,12 @@ class InstalledVersions
),
'firebase/php-jwt' =>
array (
'pretty_version' => 'v6.3.2',
'version' => '6.3.2.0',
'pretty_version' => 'v6.4.0',
'version' => '6.4.0.0',
'aliases' =>
array (
),
'reference' => 'ea7dda77098b96e666c5ef382452f94841e439cd',
'reference' => '4dd1e007f22a927ac77da5a3fbb067b42d3bc224',
),
'guzzlehttp/guzzle' =>
array (
Expand Down Expand Up @@ -422,12 +422,12 @@ class InstalledVersions
),
'webonyx/graphql-php' =>
array (
'pretty_version' => 'v15.0.3',
'version' => '15.0.3.0',
'pretty_version' => 'v15.1.0',
'version' => '15.1.0.0',
'aliases' =>
array (
),
'reference' => 'bfa78b44a93c00ebc9a1bc92497bc170a0e3b656',
'reference' => 'c58c08f3e2d6c43a8e0bb4bcc61ecb2a3e4f85df',
),
'zircote/swagger-php' =>
array (
Expand Down
29 changes: 15 additions & 14 deletions lib/vendor/composer/installed.json
Original file line number Diff line number Diff line change
Expand Up @@ -414,17 +414,17 @@
},
{
"name": "firebase/php-jwt",
"version": "v6.3.2",
"version_normalized": "6.3.2.0",
"version": "v6.4.0",
"version_normalized": "6.4.0.0",
"source": {
"type": "git",
"url": "https://github.com/firebase/php-jwt.git",
"reference": "ea7dda77098b96e666c5ef382452f94841e439cd"
"reference": "4dd1e007f22a927ac77da5a3fbb067b42d3bc224"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/firebase/php-jwt/zipball/ea7dda77098b96e666c5ef382452f94841e439cd",
"reference": "ea7dda77098b96e666c5ef382452f94841e439cd",
"url": "https://api.github.com/repos/firebase/php-jwt/zipball/4dd1e007f22a927ac77da5a3fbb067b42d3bc224",
"reference": "4dd1e007f22a927ac77da5a3fbb067b42d3bc224",
"shasum": ""
},
"require": {
Expand All @@ -439,9 +439,10 @@
"psr/http-factory": "^1.0"
},
"suggest": {
"ext-sodium": "Support EdDSA (Ed25519) signatures",
"paragonie/sodium_compat": "Support EdDSA (Ed25519) signatures when libsodium is not present"
},
"time": "2022-12-19T17:10:46+00:00",
"time": "2023-02-09T21:01:23+00:00",
"type": "library",
"installation-source": "dist",
"autoload": {
Expand Down Expand Up @@ -473,7 +474,7 @@
],
"support": {
"issues": "https://github.com/firebase/php-jwt/issues",
"source": "https://github.com/firebase/php-jwt/tree/v6.3.2"
"source": "https://github.com/firebase/php-jwt/tree/v6.4.0"
},
"install-path": "../firebase/php-jwt"
},
Expand Down Expand Up @@ -2845,17 +2846,17 @@
},
{
"name": "webonyx/graphql-php",
"version": "v15.0.3",
"version_normalized": "15.0.3.0",
"version": "v15.1.0",
"version_normalized": "15.1.0.0",
"source": {
"type": "git",
"url": "https://github.com/webonyx/graphql-php.git",
"reference": "bfa78b44a93c00ebc9a1bc92497bc170a0e3b656"
"reference": "c58c08f3e2d6c43a8e0bb4bcc61ecb2a3e4f85df"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/webonyx/graphql-php/zipball/bfa78b44a93c00ebc9a1bc92497bc170a0e3b656",
"reference": "bfa78b44a93c00ebc9a1bc92497bc170a0e3b656",
"url": "https://api.github.com/repos/webonyx/graphql-php/zipball/c58c08f3e2d6c43a8e0bb4bcc61ecb2a3e4f85df",
"reference": "c58c08f3e2d6c43a8e0bb4bcc61ecb2a3e4f85df",
"shasum": ""
},
"require": {
Expand Down Expand Up @@ -2886,7 +2887,7 @@
"psr/http-message": "To use standard GraphQL server",
"react/promise": "To leverage async resolving on React PHP platform"
},
"time": "2023-02-02T21:59:56+00:00",
"time": "2023-02-04T15:00:26+00:00",
"type": "library",
"installation-source": "dist",
"autoload": {
Expand All @@ -2906,7 +2907,7 @@
],
"support": {
"issues": "https://github.com/webonyx/graphql-php/issues",
"source": "https://github.com/webonyx/graphql-php/tree/v15.0.3"
"source": "https://github.com/webonyx/graphql-php/tree/v15.1.0"
},
"funding": [
{
Expand Down
16 changes: 8 additions & 8 deletions lib/vendor/composer/installed.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
'aliases' =>
array (
),
'reference' => '6342fd3a7fce734a66a29fe3f205f3bcc38c8fc3',
'reference' => '08c9fa4b32e0071aaa3a41a0b48ad733e6bc91bd',
'name' => 'cockpit-hq/cockpit',
),
'versions' =>
Expand Down Expand Up @@ -36,7 +36,7 @@
'aliases' =>
array (
),
'reference' => '6342fd3a7fce734a66a29fe3f205f3bcc38c8fc3',
'reference' => '08c9fa4b32e0071aaa3a41a0b48ad733e6bc91bd',
),
'colinodell/json5' =>
array (
Expand Down Expand Up @@ -76,12 +76,12 @@
),
'firebase/php-jwt' =>
array (
'pretty_version' => 'v6.3.2',
'version' => '6.3.2.0',
'pretty_version' => 'v6.4.0',
'version' => '6.4.0.0',
'aliases' =>
array (
),
'reference' => 'ea7dda77098b96e666c5ef382452f94841e439cd',
'reference' => '4dd1e007f22a927ac77da5a3fbb067b42d3bc224',
),
'guzzlehttp/guzzle' =>
array (
Expand Down Expand Up @@ -399,12 +399,12 @@
),
'webonyx/graphql-php' =>
array (
'pretty_version' => 'v15.0.3',
'version' => '15.0.3.0',
'pretty_version' => 'v15.1.0',
'version' => '15.1.0.0',
'aliases' =>
array (
),
'reference' => 'bfa78b44a93c00ebc9a1bc92497bc170a0e3b656',
'reference' => 'c58c08f3e2d6c43a8e0bb4bcc61ecb2a3e4f85df',
),
'zircote/swagger-php' =>
array (
Expand Down
8 changes: 8 additions & 0 deletions lib/vendor/firebase/php-jwt/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# Changelog

## [6.4.0](https://github.com/firebase/php-jwt/compare/v6.3.2...v6.4.0) (2023-02-08)


### Features

* add support for W3C ES256K ([#462](https://github.com/firebase/php-jwt/issues/462)) ([213924f](https://github.com/firebase/php-jwt/commit/213924f51936291fbbca99158b11bd4ae56c2c95))
* improve caching by only decoding jwks when necessary ([#486](https://github.com/firebase/php-jwt/issues/486)) ([78d3ed1](https://github.com/firebase/php-jwt/commit/78d3ed1073553f7d0bbffa6c2010009a0d483d5c))

## [6.3.2](https://github.com/firebase/php-jwt/compare/v6.3.1...v6.3.2) (2022-11-01)


Expand Down
3 changes: 2 additions & 1 deletion lib/vendor/firebase/php-jwt/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@
"php": "^7.1||^8.0"
},
"suggest": {
"paragonie/sodium_compat": "Support EdDSA (Ed25519) signatures when libsodium is not present"
"paragonie/sodium_compat": "Support EdDSA (Ed25519) signatures when libsodium is not present",
"ext-sodium": "Support EdDSA (Ed25519) signatures"
},
"autoload": {
"psr-4": {
Expand Down
45 changes: 37 additions & 8 deletions lib/vendor/firebase/php-jwt/src/CachedKeySet.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,15 @@
namespace Firebase\JWT;

use ArrayAccess;
use InvalidArgumentException;
use LogicException;
use OutOfBoundsException;
use Psr\Cache\CacheItemInterface;
use Psr\Cache\CacheItemPoolInterface;
use Psr\Http\Client\ClientInterface;
use Psr\Http\Message\RequestFactoryInterface;
use RuntimeException;
use UnexpectedValueException;

/**
* @implements ArrayAccess<string, Key>
Expand Down Expand Up @@ -41,7 +43,7 @@ class CachedKeySet implements ArrayAccess
*/
private $cacheItem;
/**
* @var array<string, Key>
* @var array<string, array<mixed>>
*/
private $keySet;
/**
Expand Down Expand Up @@ -101,7 +103,7 @@ public function offsetGet($keyId): Key
if (!$this->keyIdExists($keyId)) {
throw new OutOfBoundsException('Key ID not found');
}
return $this->keySet[$keyId];
return JWK::parseKey($this->keySet[$keyId], $this->defaultAlg);
}

/**
Expand Down Expand Up @@ -130,15 +132,43 @@ public function offsetUnset($offset): void
throw new LogicException('Method not implemented');
}

/**
* @return array<mixed>
*/
private function formatJwksForCache(string $jwks): array
{
$jwks = json_decode($jwks, true);

if (!isset($jwks['keys'])) {
throw new UnexpectedValueException('"keys" member must exist in the JWK Set');
}

if (empty($jwks['keys'])) {
throw new InvalidArgumentException('JWK Set did not contain any keys');
}

$keys = [];
foreach ($jwks['keys'] as $k => $v) {
$kid = isset($v['kid']) ? $v['kid'] : $k;
$keys[(string) $kid] = $v;
}

return $keys;
}

private function keyIdExists(string $keyId): bool
{
if (null === $this->keySet) {
$item = $this->getCacheItem();
// Try to load keys from cache
if ($item->isHit()) {
// item found! Return it
$jwks = $item->get();
$this->keySet = JWK::parseKeySet(json_decode($jwks, true), $this->defaultAlg);
// item found! retrieve it
$this->keySet = $item->get();
// If the cached item is a string, the JWKS response was cached (previous behavior).
// Parse this into expected format array<kid, jwk> instead.
if (\is_string($this->keySet)) {
$this->keySet = $this->formatJwksForCache($this->keySet);
}
}
}

Expand All @@ -148,15 +178,14 @@ private function keyIdExists(string $keyId): bool
}
$request = $this->httpFactory->createRequest('GET', $this->jwksUri);
$jwksResponse = $this->httpClient->sendRequest($request);
$jwks = (string) $jwksResponse->getBody();
$this->keySet = JWK::parseKeySet(json_decode($jwks, true), $this->defaultAlg);
$this->keySet = $this->formatJwksForCache((string) $jwksResponse->getBody());

if (!isset($this->keySet[$keyId])) {
return false;
}

$item = $this->getCacheItem();
$item->set($jwks);
$item->set($this->keySet);
if ($this->expiresAfter) {
$item->expiresAfter($this->expiresAfter);
}
Expand Down
1 change: 1 addition & 0 deletions lib/vendor/firebase/php-jwt/src/JWK.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ class JWK
private const ASN1_BIT_STRING = 0x03;
private const EC_CURVES = [
'P-256' => '1.2.840.10045.3.1.7', // Len: 64
'secp256k1' => '1.3.132.0.10', // Len: 64
// 'P-384' => '1.3.132.0.34', // Len: 96 (not yet supported)
// 'P-521' => '1.3.132.0.35', // Len: 132 (not supported)
];
Expand Down
24 changes: 17 additions & 7 deletions lib/vendor/firebase/php-jwt/src/JWT.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ class JWT
public static $supported_algs = [
'ES384' => ['openssl', 'SHA384'],
'ES256' => ['openssl', 'SHA256'],
'ES256K' => ['openssl', 'SHA256'],
'HS256' => ['hash_hmac', 'SHA256'],
'HS384' => ['hash_hmac', 'SHA384'],
'HS512' => ['hash_hmac', 'SHA512'],
Expand Down Expand Up @@ -132,8 +133,8 @@ public static function decode(
// See issue #351
throw new UnexpectedValueException('Incorrect key for this algorithm');
}
if ($header->alg === 'ES256' || $header->alg === 'ES384') {
// OpenSSL expects an ASN.1 DER sequence for ES256/ES384 signatures
if (\in_array($header->alg, ['ES256', 'ES256K', 'ES384'], true)) {
// OpenSSL expects an ASN.1 DER sequence for ES256/ES256K/ES384 signatures
$sig = self::signatureToDER($sig);
}
if (!self::verify("{$headb64}.{$bodyb64}", $sig, $key->getKeyMaterial(), $header->alg)) {
Expand Down Expand Up @@ -170,8 +171,8 @@ public static function decode(
*
* @param array<mixed> $payload PHP array
* @param string|resource|OpenSSLAsymmetricKey|OpenSSLCertificate $key The secret key.
* @param string $alg Supported algorithms are 'ES384','ES256', 'HS256', 'HS384',
* 'HS512', 'RS256', 'RS384', and 'RS512'
* @param string $alg Supported algorithms are 'ES384','ES256', 'ES256K', 'HS256',
* 'HS384', 'HS512', 'RS256', 'RS384', and 'RS512'
* @param string $keyId
* @param array<string, string> $head An array with header elements to attach
*
Expand Down Expand Up @@ -210,8 +211,8 @@ public static function encode(
*
* @param string $msg The message to sign
* @param string|resource|OpenSSLAsymmetricKey|OpenSSLCertificate $key The secret key.
* @param string $alg Supported algorithms are 'ES384','ES256', 'HS256', 'HS384',
* 'HS512', 'RS256', 'RS384', and 'RS512'
* @param string $alg Supported algorithms are 'ES384','ES256', 'ES256K', 'HS256',
* 'HS384', 'HS512', 'RS256', 'RS384', and 'RS512'
*
* @return string An encrypted message
*
Expand All @@ -238,7 +239,7 @@ public static function sign(
if (!$success) {
throw new DomainException('OpenSSL unable to sign data');
}
if ($alg === 'ES256') {
if ($alg === 'ES256' || $alg === 'ES256K') {
$signature = self::signatureFromDER($signature, 256);
} elseif ($alg === 'ES384') {
$signature = self::signatureFromDER($signature, 384);
Expand All @@ -255,6 +256,9 @@ public static function sign(
// The last non-empty line is used as the key.
$lines = array_filter(explode("\n", $key));
$key = base64_decode((string) end($lines));
if (\strlen($key) === 0) {
throw new DomainException('Key cannot be empty string');
}
return sodium_crypto_sign_detached($msg, $key);
} catch (Exception $e) {
throw new DomainException($e->getMessage(), 0, $e);
Expand Down Expand Up @@ -312,6 +316,12 @@ private static function verify(
// The last non-empty line is used as the key.
$lines = array_filter(explode("\n", $keyMaterial));
$key = base64_decode((string) end($lines));
if (\strlen($key) === 0) {
throw new DomainException('Key cannot be empty string');
}
if (\strlen($signature) === 0) {
throw new DomainException('Signature cannot be empty string');
}
return sodium_crypto_sign_verify_detached($signature, $msg, $key);
} catch (Exception $e) {
throw new DomainException($e->getMessage(), 0, $e);
Expand Down
Loading

0 comments on commit 7a58e3c

Please sign in to comment.