Skip to content
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

feat: add complaint endpoint #2

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

NoamGaash
Copy link
Member

will let the user make an official complaint to the Israeli MOT

@NoamGaash NoamGaash requested review from OriHoch and xoRmalka January 20, 2024 14:54
Copy link
Contributor

@OriHoch OriHoch left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Running a browser is very resource intensive, giving end user control over starting a browser is very risky and potential for problems like very easy DDOS. At a minimum this should be a different container, but need to see how much resources it needs

I would suggest the following changes:

  • The API endpoint only saves the complaints locally in DB
  • Daily cronjob takes the complaints from DB and runs the browser to send them
  • Have some limitation over the number of complaints and/or length of time the cronjob runs - to prevent denial of service.
  • Code can remain in this repo if you want but we should not include all the playwright dependencies in the backend api as it will make a huge container, should seperate to 2 containers - 1 with playwright and 1 without

regarding implementation - can do it using a Kubernetes cronjob - I can create that for you if you have a container which does the job

@OriHoch
Copy link
Contributor

OriHoch commented Jan 21, 2024

I think we might also encounter rate limiting / security blocks from the MOT side, but we will see, we have some whitelisted IPs on gov sites so it might not block them

@NoamGaash
Copy link
Member Author

@OriHoch I've used the isBusy flag to prevent DDOS attacks - there will be only one browser instance at a time, and until one complaint is finished, others can't be started. I thought about having the complaints raw data stored in SQS, and getting a worker to pull from the queue. Anyway, maybe we should consider placing a captcha to prevent abusing this service

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants