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

Commit 2382142

Browse files
authored
Merge pull request #1142 from Shopify/dependabot/npm_and_yarn/isbot-4.4.0
Bump isbot from 3.7.0 to 4.4.0
2 parents 580ef75 + cc62d36 commit 2382142

File tree

3 files changed

+16
-8
lines changed

3 files changed

+16
-8
lines changed

packages/shopify-api/lib/auth/oauth/oauth.ts

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import isbot from 'isbot';
1+
import {isbot} from 'isbot';
22

33
import {throwFailedRequest} from '../../clients/common';
44
import ProcessedQuery from '../../utils/processed-query';
@@ -74,7 +74,11 @@ export function begin(config: ConfigInterface): OAuthBegin {
7474
const request = await abstractConvertRequest(adapterArgs);
7575
const response = await abstractConvertIncomingResponse(adapterArgs);
7676

77-
if (isbot(request.headers['User-Agent'])) {
77+
let userAgent = request.headers['User-Agent'];
78+
if (Array.isArray(userAgent)) {
79+
userAgent = userAgent[0];
80+
}
81+
if (isbot(userAgent)) {
7882
logForBot({request, log, func: 'begin'});
7983
response.statusCode = 410;
8084
return abstractConvertResponse(response, adapterArgs);
@@ -140,7 +144,11 @@ export function callback(config: ConfigInterface): OAuthCallback {
140144
const shop = query.get('shop')!;
141145

142146
const response = {} as NormalizedResponse;
143-
if (isbot(request.headers['User-Agent'])) {
147+
let userAgent = request.headers['User-Agent'];
148+
if (Array.isArray(userAgent)) {
149+
userAgent = userAgent[0];
150+
}
151+
if (isbot(userAgent)) {
144152
logForBot({request, log, func: 'callback'});
145153
throw new ShopifyErrors.BotActivityDetected(
146154
'Invalid OAuth callback initiated by bot',

packages/shopify-api/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@
7474
"@shopify/network": "^3.2.1",
7575
"@shopify/storefront-api-client": "^0.2.2",
7676
"compare-versions": "^5.0.3",
77-
"isbot": "^3.6.10",
77+
"isbot": "^4.4.0",
7878
"jose": "^4.9.1",
7979
"node-fetch": "^2.6.1",
8080
"tslib": "^2.0.3",

yarn.lock

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6197,10 +6197,10 @@ isarray@^2.0.5:
61976197
resolved "https://registry.yarnpkg.com/isarray/-/isarray-2.0.5.tgz#8af1e4c1221244cc62459faf38940d4e644a5723"
61986198
integrity sha512-xHjhDr3cNBK0BzdUJSPXZntQUx/mwMS5Rw4A7lPJ90XGAO6ISP/ePDNuo0vhqOZU+UD5JoodwCAAoZQd3FeAKw==
61996199

6200-
isbot@^3.6.10:
6201-
version "3.7.0"
6202-
resolved "https://registry.yarnpkg.com/isbot/-/isbot-3.7.0.tgz#c68eb005c03e3d225a0ea559211da2bff94bb1ce"
6203-
integrity sha512-9BcjlI89966BqWJmYdTnRub85sit931MyCthSIPtgoOsTjoW7A2MVa09HzPpYE2+G4vyAxfDvR0AbUGV0FInQg==
6200+
isbot@^4.4.0:
6201+
version "4.4.0"
6202+
resolved "https://registry.yarnpkg.com/isbot/-/isbot-4.4.0.tgz#897ce9f2e498de6181027660ca80de8734d1ef81"
6203+
integrity sha512-8ZvOWUA68kyJO4hHJdWjyreq7TYNWTS9y15IzeqVdKxR9pPr3P/3r9AHcoIv9M0Rllkao5qWz2v1lmcyKIVCzQ==
62046204

62056205
isexe@^2.0.0:
62066206
version "2.0.0"

0 commit comments

Comments
 (0)