Skip to content

Commit cfa78a3

Browse files
authored
Fix SQL injection in whereRaw
1 parent 3dc81d8 commit cfa78a3

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/HasSlug.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,7 @@ public function resolveRouteBinding($value, $field = null)
256256

257257
// Get the models where this slug exists in other langs as well
258258
$results = $this->getRouteBindingQueryBuilder()
259-
->whereRaw('JSON_SEARCH(`'.$key.'`, "one", "'.$value.'")')
259+
->whereRaw('JSON_SEARCH(`?`, "one", "?")', [$key, $value])
260260
->get();
261261

262262
// If we have zero or multiple results, don't guess

0 commit comments

Comments
 (0)