Skip to content

Commit e987935

Browse files
authored
Merge pull request #50 from spotlibs/feature/security-helper
Feature/security helper
2 parents 3d71db6 + 1031e2c commit e987935

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

src/Libraries/Security.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,8 @@ public static function encrypt(string $plaintext): string
5252
if (!$ecrypted) {
5353
throw new \Exception("failed to encrypt string");
5454
}
55-
return bin2hex($iv . $ecrypted);
55+
56+
return strtoupper(bin2hex($iv . $ecrypted));
5657
}
5758

5859
/**
@@ -65,7 +66,6 @@ public static function encrypt(string $plaintext): string
6566
*/
6667
public static function decrypt(string $encrypted): string
6768
{
68-
6969
$ivHex = substr($encrypted, 0, 32);
7070
$iv = hex2bin($ivHex);
7171
$encrypted = substr($encrypted, 32);

src/Middlewares/ActivityMonitor.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,9 @@ public function __construct(Context $contextService)
5858
*/
5959
public function handle($request, Closure $next)
6060
{
61+
if ($request->path() == "ping") {
62+
return $next($request);
63+
}
6164
$meta = new Metadata();
6265
$meta->api_key = $request->header('X-Api-Key');
6366
$meta->app = $request->header('X-App');
@@ -107,6 +110,9 @@ public function handle($request, Closure $next)
107110
*/
108111
public function terminate($request, $response)
109112
{
113+
if ($request->path() == "ping") {
114+
return;
115+
}
110116
$fileData = (array) $this->contextService->get('fileData');
111117
$log = new StdClass();
112118
$log->app_name = getenv('APP_NAME');

0 commit comments

Comments
 (0)