Open Source alternative to Algolia + Pinecone and an Easier-to-Use alternative to ElasticSearch ⚡ 🔍 ✨ Fast, typo tolerant, in-memory fuzzy Search Engine for building delightful search experiences
C++ algoliadatastoreelasticsearchenterprise-searchfacetingfull-text-searchfuzzy-searchgeosearchin-memoryinstantsearchmerchandisingpineconesearchsearch-enginesemantic-searchsimilarity-searchsite-searchsynonymstypo-tolerancevector-search
Validate strings before integer conversion in the API layer.
Kishore Nallan8904aba598d6
diff --git a/TODO.md b/TODO.mdindex 5a2d8a49..804109c7 100644--- a/TODO.md+++ b/TODO.md@@ -73,6 +73,8 @@- ~~during index_in_memory() validations should be front loaded~~- ~~Support token ranking field being a float~~- ~~https support~~+- ~~Validate before string to int conversion in the http api layer~~+- handle hyphens (replace them)- get collection should show schema- highlight of string arrays?- NOT operator support@@ -81,7 +83,6 @@- Test for snippets- Test for replication- Proper logging-- Validate before string to int conversion in the http api layer- > INT32_MAX validation for float field- art bool support- Add docs/explanation around ranking calcdiff --git a/src/api.cpp b/src/api.cppindex cb7a3dc1..624d0ca4 100644--- a/src/api.cpp+++ b/src/api.cpp@@ -140,6 +140,18 @@ void get_search(http_req & req, http_res & res) {req.params[PAGE] = "1";}+ if(!StringUtils::is_uint64_t(req.params[NUM_TYPOS])) {+ return res.send_400("Parameter `" + NUM_TYPOS + "` must be an unsigned integer.");+ }++ if(!StringUtils::is_uint64_t(req.params[PER_PAGE])) {+ return res.send_400("Parameter `" + PER_PAGE + "` must be an unsigned integer.");+ }++ if(!StringUtils::is_uint64_t(req.params[PAGE])) {+ return res.send_400("Parameter `" + PAGE + "` must be an unsigned integer.");+ }+std::string filter_str = req.params.count(FILTER) != 0 ? req.params[FILTER] : "";std::vector<std::string> search_fields;