Skip to main content

Credential reaches a log sink

Detects direct credential flows to console and logger sinks.

DetailValue
Check IDCREDENTIAL_LOG_LEAKAGE
SeverityHigh
How it runsDeterministic scan and agent review

app/routes/app.sync.ts

import { authenticate } from "../shopify.server";

export async function syncProducts(request: Request) {
const { session } = await authenticate.admin(request);

// Log sinks are copied into aggregators, tickets, and
// screenshots. A token that reaches one is a token you have to
// rotate.
console.log("syncing", {
shop: session.shop,
accessToken: session.accessToken,
});
}

Remove credentials from logs; emit only safe redacted, hashed, or boolean-derived values.

app/routes/app.sync.ts

import { authenticate } from "../shopify.server";

export async function syncProducts(request: Request) {
const { session } = await authenticate.admin(request);
const { accessToken } = session;

// Log the shape, never the value. Booleans, hashes and redacted
// derivations keep the log useful for debugging. Derive first:
// the scanner clears Boolean(accessToken), not
// Boolean(session.accessToken).
console.log("syncing", {
shop: session.shop,
hasToken: Boolean(accessToken),
});
}


Was this page helpful?