Hello Shopify Community,
I’m writing to raise awareness and seek clarification on a peculiar network request that we’ve observed on multiple stores. This request to a /private_access_tokens endpoint is consistently failing with a 401 Unauthorized error, and its origin is causing confusion for merchants, who are mistaking it for malicious activity from third-party apps.
Background
This investigation began after a merchant reported what they believed to be malicious JavaScript injected by a third-party app. They observed a script making unauthorized requests and, through their own process of elimination, concluded that a specific app was the culprit.
Here are the technical details they provided:
-
Malicious Code Found:
fetch('/private_access_tokens' + location.search).catch(() => {}); -
Behavior: The code was dynamically injected into the
<head>section, had no identifying attributes, and seemed to trigger on pages with “payment” in the URL, generating401console errors. -
Conclusion: The merchant uninstalled an app, and the script disappeared, leading them to believe the app was responsible.
Our Analysis and Findings
We took this report very seriously and conducted our own investigation. While we were able to reproduce the network error, our findings suggest this is not an issue caused by a specific third-party app, but rather, it appears to be related to the Shopify platform itself.
Here’s what we discovered:
-
Reproducible on Clean Stores: We successfully reproduced the exact same
401error on our own clean, internal demo store where the app the merchant mentioned (and many other common apps) has never been installed. -
Consistent Reproduction Steps: The error appears consistently under specific conditions on any store we’ve tested.
-
Platform-Level Indication: The script is injected inline within the
<head>, often situated between other standard Shopify scripts, which points towards it being a Shopify-native script rather than a poorly implemented script from an app.
How to Reproduce the Issue
You can likely verify this on your own development or live store by following these steps:
-
Log in to the storefront with a customer account.
-
Add any product to the cart.
-
Proceed to the checkout page.
-
Open your browser’s Developer Tools and navigate to the Network tab.
-
Filter for
sf_private_access_tokens. -
You will likely see a
GETrequest tohttps://<your-store-domain>/private_access_tokens?...that has failed with a 401 status code.Attaching a video of freshly installed store that seems to be calling the same api without any apps installed
https://drive.google.com/file/d/1jmuOd7IrC1bboDEIAb1nhJiWVT0TeZ48/view?usp=sharing