5
0
Fork 0
mirror of https://0xacab.org/sutty/sutty synced 2024-11-16 00:21:41 +00:00

fix: no fallar si la firma es nil
Some checks failed
ci/woodpecker/push/woodpecker Pipeline failed

closes #14089
This commit is contained in:
f 2023-08-16 17:04:34 -03:00
parent ef8ed271d7
commit 4a7ac981e5

View file

@ -55,7 +55,7 @@ module Api
payload = request.body.read payload = request.body.read
site.roles.where(temporal: false, rol: 'usuarie').pluck(:token).find do |token| site.roles.where(temporal: false, rol: 'usuarie').pluck(:token).find do |token|
new_signature = prepend + OpenSSL::HMAC.hexdigest(OpenSSL::Digest.new('sha256'), token, payload) new_signature = prepend + OpenSSL::HMAC.hexdigest(OpenSSL::Digest.new('sha256'), token, payload)
ActiveSupport::SecurityUtils.secure_compare(new_signature, signature) ActiveSupport::SecurityUtils.secure_compare(new_signature, signature.to_s)
end.tap do |t| end.tap do |t|
raise ActiveRecord::RecordNotFound, 'token no encontrado' if t.nil? raise ActiveRecord::RecordNotFound, 'token no encontrado' if t.nil?
end end