Skip to content

Commit

Permalink
Don't limit browser_session.user_agent to 4096 chars
Browse files Browse the repository at this point in the history
  • Loading branch information
Al2Klimov authored and nilmerg committed Jul 23, 2024
1 parent 9f9e2c6 commit f64d7bc
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 6 deletions.
3 changes: 1 addition & 2 deletions library/Notifications/Daemon/Server.php
Original file line number Diff line number Diff line change
Expand Up @@ -406,8 +406,7 @@ protected function authenticate(Connection $connection, array $cookies, array $h

if ($browserSession !== null) {
if (isset($headers['User-Agent'][0])) {
// limit user-agent to 4k chars
$userAgent = substr(trim($headers['User-Agent'][0]), 0, 4096);
$userAgent = trim($headers['User-Agent'][0]);
} else {
$userAgent = 'default';
}
Expand Down
6 changes: 2 additions & 4 deletions library/Notifications/ProvidedHook/SessionStorage.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,7 @@ public function onLogin(User $user): void
// user successfully authenticated
$rawUserAgent = (new UserAgent())->getAgent();
if ($rawUserAgent) {
// limit user-agent to 4k chars
$userAgent = substr(trim($rawUserAgent), 0, 4096);
$userAgent = trim($rawUserAgent);
} else {
$userAgent = 'default';
}
Expand Down Expand Up @@ -124,8 +123,7 @@ public function onLogout(User $user): void

$rawUserAgent = (new UserAgent())->getAgent();
if ($rawUserAgent) {
// limit user-agent to 4k chars
$userAgent = substr(trim($rawUserAgent), 0, 4096);
$userAgent = trim($rawUserAgent);
} else {
$userAgent = 'default';
}
Expand Down

0 comments on commit f64d7bc

Please sign in to comment.