Skip to content
This repository was archived by the owner on Feb 7, 2024. It is now read-only.

Commit e9b9cc4

Browse files
authored
Merge pull request #626 from beyondcode/fix/check-app-key
[fix] Check for key app on authorization
2 parents f08e4f2 + df613de commit e9b9cc4

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

src/Statistics/Http/Middleware/Authorize.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@ class Authorize
88
{
99
public function handle($request, $next)
1010
{
11-
return is_null(App::findBySecret($request->secret)) ? abort(403) : $next($request);
11+
$app = App::findByKey($request->key);
12+
13+
return is_null($app) || $app->secret !== $request->secret
14+
? abort(403)
15+
: $next($request);
1216
}
1317
}

tests/Statistics/Controllers/WebSocketsStatisticsControllerTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ public function it_can_store_statistics()
1414
$this->post(
1515
action([WebSocketStatisticsEntriesController::class, 'store']),
1616
array_merge($this->payload(), [
17+
'key' => config('websockets.apps.0.key'),
1718
'secret' => config('websockets.apps.0.secret'),
1819
])
1920
);

0 commit comments

Comments
 (0)