Closed (fixed)
Project:
Commerce FinDock
Version:
2.x-dev
Component:
Code
Priority:
Normal
Category:
Task
Assigned:
Reporter:
Created:
28 Nov 2022 at 16:35 UTC
Updated:
12 Oct 2023 at 12:49 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #2
primsi commentedInitial patch.
Comment #3
primsi commentedFixing some copy/pasted comments.
Comment #4
berdirindendation is off here.
we want a double protection. on the ip and on the order id. So a bad actor needs to distribute the requests to multiple source ips *and* multiple orders.
I'd rename the ip_limit to just limit and use the same setting for both, explaining that in the comments.
Also, isset(0) => TRUE, you want to use !empty() or just directly if ($configuration['limit'], the default configuration should ensure that it's always set, even on existing configuration.
Comment #5
berdirindendation is off here.
we want a double protection. on the ip and on the order id. So a bad actor needs to distribute the requests to multiple source ips *and* multiple orders.
I'd rename the ip_limit to just limit and use the same setting for both, explaining that in the comments.
Also, isset(0) => TRUE, you want to use !empty() or just directly if ($configuration['limit'], the default configuration should ensure that it's always set, even on existing configuration.
Comment #6
primsi commentedNot sure if that's what you intended.
Comment #7
miro_dietikerBTW can we be sure that we are not causing problems with the IP limits, in situation like: test environments, local dev...
(Worst would be behind a proxy without proper IP forwarding, so you always see the proxy IP like sometimes also happens on login after relaunches and incomplete prod configuration...)
It seems proper IP handlign is provided by the flood system itself?
Comment #8
berdirthis looks like what I expected yes. But lets do two separate if conditions and only register a flood event if it's allowed, like before, for both of them separately.
Since the identifier is namespaced with the name, I'd say just "order-ID" is enough.
And lets make the messages a little bit more clear, something like this, based on the user login flood messages:
- IP: Too many failed payment attempts from your IP address. This IP address is temporarily blocked. Try again later.
- Order: Too many failed payment attempts for this order. Payments are temporarily blocked. Try again later.
@miro: Sure, this can cause problems if you have a lot of people trying to do checkout from a single IP. Thinking about that, lets add two separate limit settings, limit_ip and limit_order. Sorry about the back and forth. I'd say same timeframe is OK? Then it's up to you if you just want to enforce a per-order limit or a higher per-IP limit. But the IP one is also the one that can easily be misused by a botnet, so you have to weigh that off.
Comment #9
primsi commentedThanks for the reviews. Updated according comments.
Comment #10
primsi commentedRemoving leftover comment.
Comment #11
berdirThe log messages should use commerce_findock, not commerce_payment.
Comment #12
primsi commentedI see the comment is wrong, did you mean that?
Comment #13
berdirNot what I meant, but I also realized that we can't actually do that as the log message is based on the exception and we can't control the channel.
Committed.