Skip to content

Supercharge your AI agents with data from the web and beyond. Building the library for superintelligence. 🔥

fix(api): gate enterprise ZDR/anon search behind searchZDR permission (#3167)

firecrawl-spring[bot]be165ab0e55b
diff --git a/apps/api/src/controllers/v2/search.ts b/apps/api/src/controllers/v2/search.ts
index 85f4e77e6..3cbef22e0 100644
--- a/apps/api/src/controllers/v2/search.ts
+++ b/apps/api/src/controllers/v2/search.ts
@@ -90,6 +90,18 @@ export async function searchController(
zeroDataRetention = isZDROrAnon ?? false;
applyZdrScope(isZDROrAnon ?? false);
+ // Verify the team has searchZDR enabled before allowing enterprise ZDR/anon
+ if (isZDROrAnon) {
+ const searchMode = getSearchZDR(req.acuc?.flags);
+ if (searchMode !== "allowed" && searchMode !== "forced") {
+ return res.status(403).json({
+ success: false,
+ error:
+ "Zero Data Retention (ZDR) search is not enabled for your team. Contact [email protected] to enable this feature.",
+ });
+ }
+ }
+
if (!agentRequestId) {
await logRequest({
id: jobId,
diff --git a/apps/api/src/controllers/v2/x402-search.ts b/apps/api/src/controllers/v2/x402-search.ts
index 03d43c200..bcaaf2eb6 100644
--- a/apps/api/src/controllers/v2/x402-search.ts
+++ b/apps/api/src/controllers/v2/x402-search.ts
@@ -243,6 +243,20 @@ export async function x402SearchController(
origin: req.body.origin,
});
+ // Verify the team has searchZDR enabled before allowing enterprise ZDR/anon
+ const isZDR = req.body.enterprise?.includes("zdr");
+ const isAnon = req.body.enterprise?.includes("anon");
+ if (isZDR || isAnon) {
+ const searchMode = getSearchZDR(req.acuc?.flags);
+ if (searchMode !== "allowed" && searchMode !== "forced") {
+ return res.status(403).json({
+ success: false,
+ error:
+ "Zero Data Retention (ZDR) search is not enabled for your team. Contact [email protected] to enable this feature.",
+ });
+ }
+ }
+
await logRequest({
id: jobId,
kind: "search",