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

Commit

Permalink
Merge pull request #626 from beyondcode/fix/check-app-key
Browse files Browse the repository at this point in the history
[fix] Check for key app on authorization
  • Loading branch information
rennokki authored Jan 23, 2021
2 parents f08e4f2 + df613de commit e9b9cc4
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/Statistics/Http/Middleware/Authorize.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ class Authorize
{
public function handle($request, $next)
{
return is_null(App::findBySecret($request->secret)) ? abort(403) : $next($request);
$app = App::findByKey($request->key);

return is_null($app) || $app->secret !== $request->secret
? abort(403)
: $next($request);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ public function it_can_store_statistics()
$this->post(
action([WebSocketStatisticsEntriesController::class, 'store']),
array_merge($this->payload(), [
'key' => config('websockets.apps.0.key'),
'secret' => config('websockets.apps.0.secret'),
])
);
Expand Down

0 comments on commit e9b9cc4

Please sign in to comment.