fix broken validation

This commit is contained in:
Echo 2025-08-26 07:03:48 -04:00
parent c299e26e67
commit 84ac41ad7e
No known key found for this signature in database
GPG key ID: A1263DC479EDB62F

View file

@ -248,8 +248,11 @@ module Api
return render json: { error: "whatcha doin'?" }, status: :unprocessable_entity
end
cool = %w[created_at deleted_at]
not_cool = %w[INSERT UPDATE DELETE DROP CREATE ALTER TRUNCATE EXEC EXECUTE]
if not_cool.any? { |keyword| query.upcase.include?(keyword) }
if not_cool.any? { |keyword| query.upcase.include?(keyword) } &&
cool.none? { |field| query.upcase.include?(field.upcase) }
return render json: { error: "no perms lmaooo" }, status: :forbidden
end
@ -257,11 +260,6 @@ module Api
return render json: { error: "no perms lmaooo" }, status: :forbidden
end
cool = %w[created_at deleted_at]
if query.upcase.match?(/\b(#{not_cool.join('|')})\b/) && !query.upcase.match?(/\b(#{cool.join('|')})\b/)
return render json: { error: "no perms lmaooo" }, status: :forbidden
end
begin
limited_query = query.strip
unless limited_query.upcase.include?("LIMIT")