Skip to main content

Data access may exceed the current request

Investigates reads that may expose data outside the authenticated shop or user boundary.

DetailValue
Check IDOVERBROAD_DATA_ACCESS
SeverityMedium
How it runsAgent review

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 } }),
};
};

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 },
}),
};
};


Was this page helpful?