Skip to content

🐸 Rybbit - open-source and privacy-friendly alternative to Google Analytics that is 10x more intuitive.

Fix potential SQL injection

Edward Cuid063434f2fae
diff --git a/server/src/services/import/importQuotaChecker.ts b/server/src/services/import/importQuotaChecker.ts
index 6923e4931..cc39eb102 100644
--- a/server/src/services/import/importQuotaChecker.ts
+++ b/server/src/services/import/importQuotaChecker.ts
@@ -83,12 +83,16 @@ export class ImportQuotaTracker {
toYYYYMM(timestamp) as month,
COUNT(*) as count
FROM events
- WHERE site_id IN (${grandfatheredSites.join(",")})
+ WHERE site_id IN {siteIds:Array(Int32)}
AND type = 'pageview'
- AND timestamp >= toDate('${startDate}')
+ AND timestamp >= toDate({startDate:String})
GROUP BY month
ORDER BY month
`,
+ query_params: {
+ siteIds: grandfatheredSites,
+ startDate: startDate,
+ },
format: "JSONEachRow",
});
@@ -107,12 +111,16 @@ export class ImportQuotaTracker {
toYYYYMM(timestamp) as month,
COUNT(*) as count
FROM events
- WHERE site_id IN (${newSites.join(",")})
+ WHERE site_id IN {siteIds:Array(Int32)}
AND type IN ('pageview', 'custom_event', 'performance')
- AND timestamp >= toDate('${startDate}')
+ AND timestamp >= toDate({startDate:String})
GROUP BY month
ORDER BY month
`,
+ query_params: {
+ siteIds: newSites,
+ startDate: startDate,
+ },
format: "JSONEachRow",
});