Skip to content
Snippets Groups Projects
Unverified Commit 46155122 authored by Eugen Rochko's avatar Eugen Rochko Committed by GitHub
Browse files

Reduce connect timeout limit and limit signature failures by source IP (#9236)

* Reduce connect timeout from 10s to 1s

* Limit failing signature verifications per source IP
parent dd00cd19
No related branches found
No related tags found
No related merge requests found
......@@ -43,7 +43,12 @@ module SignatureVerification
return
end
account = account_from_key_id(signature_params['keyId'])
account_stoplight = Stoplight("source:#{request.ip}") { account_from_key_id(signature_params['keyId']) }
.with_fallback { nil }
.with_threshold(1)
.with_cool_off_time(5.minutes.seconds)
account = account_stoplight.run
if account.nil?
@signature_verification_failure_reason = "Public key not found for key #{signature_params['keyId']}"
......
......@@ -94,7 +94,7 @@ class Request
end
def timeout
{ write: 10, connect: 10, read: 10 }
{ connect: 1, read: 10, write: 10 }
end
def http_client
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment