mirror of
https://github.com/qbcore-fivem/qb-core.git
synced 2026-09-04 17:23:31 +00:00
[FIX] Security match sql (#925)
* Added PrepForSQL function performs a check to a string with expected patterns to be matched. * Bug Fixes After talking with Stan I realized that it wasn't testing strings so I set it up to ensure data is a string. I also reworded the event log.
This commit is contained in:
@@ -417,11 +417,12 @@ end
|
|||||||
|
|
||||||
--- SQL Pattern Matching
|
--- SQL Pattern Matching
|
||||||
function QBCore.Functions.PrepForSQL(source,data,pattern)
|
function QBCore.Functions.PrepForSQL(source,data,pattern)
|
||||||
|
data = tostring(data)
|
||||||
local src = source
|
local src = source
|
||||||
local player = QBCore.Functions.GetPlayer(src)
|
local player = QBCore.Functions.GetPlayer(src)
|
||||||
local result = string.match(data, pattern)
|
local result = string.match(data, pattern)
|
||||||
if not result or string.len(result) ~= string.len(data) then
|
if not result or string.len(result) ~= string.len(data) then
|
||||||
TriggerEvent('qb-log:server:CreateLog', 'anticheat', 'SQL Injection Attempted', 'red', string.format('%s Attempted a SQL Exploit!', player.PlayerData.license))
|
TriggerEvent('qb-log:server:CreateLog', 'anticheat', 'SQL Exploit Attempted', 'red', string.format('%s attempted to exploit SQL!', player.PlayerData.license))
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
return true
|
return true
|
||||||
|
|||||||
Reference in New Issue
Block a user