Forward Supabase identity for terminal data proxies
This commit is contained in:
@@ -106,6 +106,7 @@ export async function GET(req: NextRequest) {
|
|||||||
? NO_STORE_CACHE_CONTROL
|
? NO_STORE_CACHE_CONTROL
|
||||||
: cachePolicy.responseCacheControl,
|
: cachePolicy.responseCacheControl,
|
||||||
fetchCache: "no-store",
|
fetchCache: "no-store",
|
||||||
|
includeSupabaseIdentity: true,
|
||||||
publicMessage: "Failed to fetch city detail batch",
|
publicMessage: "Failed to fetch city detail batch",
|
||||||
revalidateSeconds: cachePolicy.revalidateSeconds,
|
revalidateSeconds: cachePolicy.revalidateSeconds,
|
||||||
signal: controller.signal,
|
signal: controller.signal,
|
||||||
|
|||||||
@@ -75,6 +75,7 @@ export async function GET(req: NextRequest) {
|
|||||||
fetchCache: "no-store",
|
fetchCache: "no-store",
|
||||||
publicMessage: "Failed to fetch scan terminal data",
|
publicMessage: "Failed to fetch scan terminal data",
|
||||||
revalidateSeconds: cachePolicy.revalidateSeconds,
|
revalidateSeconds: cachePolicy.revalidateSeconds,
|
||||||
|
includeSupabaseIdentity: true,
|
||||||
signal: controller.signal,
|
signal: controller.signal,
|
||||||
timeoutPublicMessage: "Scan terminal request timed out",
|
timeoutPublicMessage: "Scan terminal request timed out",
|
||||||
timing: timer,
|
timing: timer,
|
||||||
|
|||||||
@@ -50,4 +50,21 @@ export function runTests() {
|
|||||||
helperSource.includes("authEmail: identity?.email || null"),
|
helperSource.includes("authEmail: identity?.email || null"),
|
||||||
"backend auth helper must verify incoming Supabase bearer tokens and forward trusted user identity headers to backend services",
|
"backend auth helper must verify incoming Supabase bearer tokens and forward trusted user identity headers to backend services",
|
||||||
);
|
);
|
||||||
|
|
||||||
|
const scanTerminalRoute = fs.readFileSync(
|
||||||
|
path.join(projectRoot, "app", "api", "scan", "terminal", "route.ts"),
|
||||||
|
"utf8",
|
||||||
|
);
|
||||||
|
const cityDetailBatchRoute = fs.readFileSync(
|
||||||
|
path.join(projectRoot, "app", "api", "cities", "detail-batch", "route.ts"),
|
||||||
|
"utf8",
|
||||||
|
);
|
||||||
|
assert(
|
||||||
|
scanTerminalRoute.includes("includeSupabaseIdentity: true"),
|
||||||
|
"scan terminal proxy must forward the Supabase identity; otherwise paid users hit backend 401 even when /api/auth/me is active",
|
||||||
|
);
|
||||||
|
assert(
|
||||||
|
cityDetailBatchRoute.includes("includeSupabaseIdentity: true"),
|
||||||
|
"city detail batch proxy must forward the Supabase identity; otherwise paid users see empty charts with backend 401",
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user