-
-
Notifications
You must be signed in to change notification settings - Fork 13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Prevent users from submitting multiple tasks in parallel #122
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #122 +/- ##
===========================================
+ Coverage 45.64% 56.66% +11.01%
===========================================
Files 10 12 +2
Lines 390 533 +143
Branches 44 77 +33
===========================================
+ Hits 178 302 +124
- Misses 210 229 +19
Partials 2 2 ☔ View full report in Codecov by Sentry. |
7461595
to
f66efb5
Compare
Updated first comment with more screenshots, this is ready for review / comments I would like to move this fast to production to reduce issues we have with zimit pipe being filled. |
user has no tracker ID but there is already too many ongoing tasks for this tracker ID Seems to be contradictory.
Other than that LGTM, I probably would have been content with option 1 alone. |
I've already expressed my concerns about blocking by IP in the ticket so I won't complain about it but I think the wording remains important. I am confident there will be false positive and saying “You are blocked” to someone legitimately using the service is terrible communication. I even think a generic somewhat vague message with a dedicated error code would be better. |
Fixed in first comment, this is a typo: for this
Because as the code is today, it might be more than that, vague statements are always superior to wrong ones. I hope it is quite niche, but I'm sure it will happen.
But then it would have been quickly circumvented by someone finding the trick, loosing again our resources and our time/effort, since we would not even be aware that traffic is high again because some tricked our systems.
Or so that they know in plain text they just have to use a VPN with another exit IP to circumvent our blockage. I'm not in favor of giving too much directions on how to circumvent protections. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK
class Tracker: | ||
def __init__(self): | ||
self.known_clients: list[ClientInfo] = [] | ||
self.ongoing_task_has_finished = self._ongoing_task_has_finished |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what's the reason for this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is meant to allow customizing both functions more easily. Used only for tests for now. I don't find it particularly elegant, but at least it works. And does not require tons of code. Suggestions welcomed.
Let's merge, please open a dedicated issue if there is still things to enhance / fix. |
Fix #56
Changes
situation 1
: user has a tracker ID and there is already too many ongoing tasks for this tracker ID => block user and display link(s) to ongoing tasksituation 2
: user has no tracker ID but there is already too many ongoing tasks for this tracker ID => block user inviting him to come back later (tasks are probably not his tasks, we do not want to "leak" tasks to other users behind same IPsituation 3
: user has an invalid tracker ID, or other weird situations linked to a user probably trying to tamper our system => block user with quite obscure message avoiding to leak too much details, but still displaying status so that it is a bit easier to debug should this be a bugsituation 4
: we fail to get status (bug, ...) => simple error messagesituation 5
: user has quota left for his tracker ID or his IP => display usual UIWording can obviously be fine-tuned. Everything is meant to be internationalized.
"Contact us" is really "poor" for now, but I assume this will be solved in #93
Technical details
<unique_id>|<digest>
:<unique_id>
is a randomly generated 64 bits number in hexadecimal representation<digest>
is the sha-256 HMAC of the<unique_id>
, in hexadecimal representation again@Popolechien @kelson42 @rgaudin feedback needed obviously