Skip to content

Commit a6cb343

Browse files
committed
fix: make deviceVendor optional in session fingerprint validation
Desktop browsers don't have deviceVendor (only mobile devices with Apple, Samsung, etc). This was causing ILLEGAL_SESSION errors for desktop browser logins.
1 parent 72f1c15 commit a6cb343

3 files changed

Lines changed: 6 additions & 5 deletions

File tree

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@hydre/auth",
3-
"version": "4.2.9",
3+
"version": "4.2.10",
44
"description": "A light graphql authentication server built on Redis",
55
"type": "module",
66
"scripts": {

src/session_gate.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,10 @@ export async function create_or_update_session({
2121
publish = null,
2222
should_mark_logged_once = false,
2323
}) {
24-
// Validate session fingerprint (must have BOTH device info - stronger security)
24+
// Validate session fingerprint (browserName required, deviceVendor optional)
25+
// Desktop browsers typically don't have deviceVendor (only mobile devices have vendor info)
2526
// Check for non-empty trimmed values to prevent empty string bypass
26-
if (!session_data.browserName?.trim() || !session_data.deviceVendor?.trim()) {
27+
if (!session_data.browserName?.trim()) {
2728
throw new GraphQLError(ERRORS.ILLEGAL_SESSION)
2829
}
2930

0 commit comments

Comments
 (0)