Skip to content

Commit 6f883ef

Browse files
committed
Upgrading composer dependencies, fixing JWT tokens (too short keys).
1 parent d4702c5 commit 6f883ef

10 files changed

Lines changed: 492 additions & 461 deletions

File tree

app/V1Module/security/AccessManager.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
use Firebase\JWT\Key;
1616
use DomainException;
1717
use UnexpectedValueException;
18+
use InvalidArgumentException;
1819

1920
class AccessManager
2021
{
@@ -46,6 +47,9 @@ public function __construct(array $parameters, Users $users)
4647
{
4748
$this->users = $users;
4849
$this->verificationKey = Arrays::get($parameters, "verificationKey");
50+
if (!$this->verificationKey || strlen($this->verificationKey) < 32) {
51+
throw new InvalidArgumentException("AccessManager verification key is not configured or too short");
52+
}
4953
$this->expiration = Arrays::get($parameters, "expiration", 24 * 60 * 60); // one day in seconds
5054
$this->invitationExpiration = Arrays::get($parameters, "invitationExpiration", 24 * 60 * 60); // one day in sec
5155
$this->issuer = Arrays::get($parameters, "issuer", "https://recodex.mff.cuni.cz");

app/config/config.local.neon.example

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ parameters:
2727
audience: "%webapp.address%"
2828
expiration: 604800 # 7 days in seconds
2929
invitationExpiration: 604800 # of an invitation token (7 days in seconds)
30-
verificationKey: "recodex-123" # this should be a really secret string
30+
verificationKey: "recodex-123" # this should be a really secret string and sufficiently long (for HS256, at least 32 characters is required)
3131
tokenCookieName: 'recodex_accessToken' # web-app config value 'PERSISTENT_TOKENS_KEY_PREFIX' + '_accessToken', null if only Authorization header is used
3232

3333
broker:

app/config/config.neon

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,6 @@ parameters:
5656
expiration: 86400 # of regular auth tokens (seconds)
5757
invitationExpiration: 86400 # of an invitation token (seconds)
5858
usedAlgorithm: HS256
59-
verificationKey: "recodex-123"
6059
tokenCookieName: 'recodex_accessToken' # web-app config value 'PERSISTENT_TOKENS_KEY_PREFIX' + '_accessToken', null if only Authorization header is used
6160

6261
broker: # connection to broker

composer.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,17 +29,17 @@
2929
"php": ">=8.2",
3030
"bjeavons/zxcvbn-php": "^1.4",
3131
"contributte/console": "^0.10.0",
32-
"firebase/php-jwt": "^6.11",
32+
"firebase/php-jwt": "^7.0",
3333
"forxer/gravatar": "^5.0",
3434
"guzzlehttp/guzzle": "^7.10",
3535
"eluceo/ical": "^2.7",
3636
"ext-yaml": ">=2.0",
3737
"ext-json": ">=1.7",
3838
"ext-zip": ">=1.15",
39-
"latte/latte": "^3.0",
40-
"league/commonmark": "^2.7",
39+
"latte/latte": "^3.1",
40+
"league/commonmark": "^2.8",
4141
"limenet/git-version": "v0.1.6",
42-
"nelmio/alice": "^3.14",
42+
"nelmio/alice": "^3.17",
4343
"nette/application": "^3.2",
4444
"nette/bootstrap": "^3.2",
4545
"nette/caching": "^3.4",
@@ -59,14 +59,14 @@
5959
"nettrine/migrations": "^0.10",
6060
"nettrine/orm": "^0.9",
6161
"ramsey/uuid-doctrine": "^2.0",
62-
"symfony/process": "^7.3",
62+
"symfony/process": "^7.4",
6363
"tracy/tracy": "^2.11",
6464
"zircote/swagger-php": "^5.5"
6565
},
6666
"require-dev": {
6767
"mockery/mockery": "@stable",
6868
"mikey179/vfsstream": "@stable",
69-
"nette/tester": "^2.4",
69+
"nette/tester": "^2.6",
7070
"phpstan/phpstan": "^2.1",
7171
"phpstan/phpstan-nette": "^2.0",
7272
"vrana/adminer": "^5.4"

0 commit comments

Comments
 (0)