Fix SQL injection vulnerability in cache cleanup

Co-Authored-By: Joe Moura <joao@crewai.com>
This commit is contained in:
Devin AI
2025-05-05 22:44:18 +00:00
parent 62de5a7989
commit 223683d8bd

View File

@@ -228,10 +228,11 @@ class LLMResponseCacheStorage:
logger.info("Deleting all cache entries (max_age_days <= 0)")
else:
cursor.execute(
f"""
DELETE FROM llm_response_cache
WHERE timestamp < datetime('now', '-{max_age_days} days')
"""
DELETE FROM llm_response_cache
WHERE timestamp < datetime('now', ? || ' days')
""",
(f"-{max_age_days}",)
)
deleted_count = cursor.rowcount