Skip to content

Commit be165ab

Browse files
fix(api): gate enterprise ZDR/anon search behind searchZDR permission (firecrawl#3167)
The v2 search and x402-search controllers accept an `enterprise` parameter for ZDR/anon search but never verified the team has the searchZDR flag enabled. Any authenticated user could pass enterprise=["zdr"] or enterprise=["anon"] and use the feature (just paying higher credits). Add a getSearchZDR() check that returns 403 when the team lacks the searchZDR: "allowed" or "forced" flag. Co-authored-by: firecrawl-spring[bot] <254786068+firecrawl-spring[bot]@users.noreply.github.com> Co-authored-by: micahstairs <micah@sideguide.dev>
1 parent 1226fa8 commit be165ab

2 files changed

Lines changed: 26 additions & 0 deletions

File tree

apps/api/src/controllers/v2/search.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,18 @@ export async function searchController(
9090
zeroDataRetention = isZDROrAnon ?? false;
9191
applyZdrScope(isZDROrAnon ?? false);
9292

93+
// Verify the team has searchZDR enabled before allowing enterprise ZDR/anon
94+
if (isZDROrAnon) {
95+
const searchMode = getSearchZDR(req.acuc?.flags);
96+
if (searchMode !== "allowed" && searchMode !== "forced") {
97+
return res.status(403).json({
98+
success: false,
99+
error:
100+
"Zero Data Retention (ZDR) search is not enabled for your team. Contact support@firecrawl.com to enable this feature.",
101+
});
102+
}
103+
}
104+
93105
if (!agentRequestId) {
94106
await logRequest({
95107
id: jobId,

apps/api/src/controllers/v2/x402-search.ts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -243,6 +243,20 @@ export async function x402SearchController(
243243
origin: req.body.origin,
244244
});
245245

246+
// Verify the team has searchZDR enabled before allowing enterprise ZDR/anon
247+
const isZDR = req.body.enterprise?.includes("zdr");
248+
const isAnon = req.body.enterprise?.includes("anon");
249+
if (isZDR || isAnon) {
250+
const searchMode = getSearchZDR(req.acuc?.flags);
251+
if (searchMode !== "allowed" && searchMode !== "forced") {
252+
return res.status(403).json({
253+
success: false,
254+
error:
255+
"Zero Data Retention (ZDR) search is not enabled for your team. Contact support@firecrawl.com to enable this feature.",
256+
});
257+
}
258+
}
259+
246260
await logRequest({
247261
id: jobId,
248262
kind: "search",

0 commit comments

Comments
 (0)