Data access may exceed the current request
Investigates reads that may expose data outside the authenticated shop or user boundary.
| Detail | Value |
|---|---|
| Check ID | OVERBROAD_DATA_ACCESS |
| Severity | Medium |
| How it runs | Agent review |
Anchor to Vulnerable exampleVulnerable example
app/routes/app.orders.status.tsx
import type { LoaderFunctionArgs } from "react-router";
import { authenticate } from "../shopify.server";
import prisma from "../db.server";
export const loader = async ({ request }: LoaderFunctionArgs) => {
const { session } = await authenticate.admin(request);
// The page renders a status badge, but the loader ships every
// column, including the customer's email, phone, and address, to
// the browser.
return {
orders: await prisma.order.findMany({ where: { shop: session.shop } }),
};
};
Anchor to How to fixHow to fix
Scope data access to the authenticated shop and minimum necessary records.
app/routes/app.orders.status.tsx
import type { LoaderFunctionArgs } from "react-router";
import { authenticate } from "../shopify.server";
import prisma from "../db.server";
export const loader = async ({ request }: LoaderFunctionArgs) => {
const { session } = await authenticate.admin(request);
// Select the fields the view actually renders. Personal data
// that never leaves the server can't leak through a loader
// payload or an error report.
return {
orders: await prisma.order.findMany({
where: { shop: session.shop },
select: { id: true, name: true, fulfillmentStatus: true },
}),
};
};
shopify app security check, the command that runs this check- All app security checks
Was this page helpful?