Skip to content

Resolve "ajout de nouveaux mots clés et trash les yopmail.com"

Closes #3 (closed)

Design

  • ajout d'un espace avant et après le mot clé pour pouvoir ajouter jet et download
  • création d'un fichier de domaines emails à surveiller (on y ajoutera une liste plus complète dans notre cron)
    • On prend tous les events avec l'email des organisateurs et on grep dedans

Tests

  • export des données de production pour tests en local
for table in events actors users
do
  docker compose exec mobilizon-db psql -U mobilizon -d postgres_mobilizon -c "COPY (SELECT * FROM $table) TO stdout DELIMITER ',' CSV HEADER" > ${table}-export.csv
done
  • Export du schema docker compose exec mobilizon-db pg_dump -U mobilizon --schema-only postgres_mobilizon > schema.sql
  • Import des données
sudo docker compose exec mobilizon-db sh

cat /schema.sql | psql  -U mobilizon -d postgres_mobilizon
psql  -U mobilizon -d postgres_mobilizon
alter table users DISABLE TRIGGER ALL;
alter table actors DISABLE TRIGGER ALL;
alter table events DISABLE TRIGGER ALL;
COPY users FROM '/users-export.csv' DELIMITER ',' CSV HEADER;
COPY actors FROM '/actors-export.csv' DELIMITER ',' CSV HEADER;
COPY events FROM '/events-export.csv' DELIMITER ',' CSV HEADER;
alter table users ENABLE TRIGGER ALL;
alter table actors ENABLE TRIGGER ALL;
alter table events ENABLE TRIGGER ALL;
  • pour les tests j'ai ajouté gmail.com dans les domaines blacklistés et mis un echo devant les commandes curl
sudo docker compose exec mobilizon-cron sh
 # bash
bash-5.1# cd app/
bash-5.1# echo gmail.com > emails_domains_spam.txt 
bash-5.1# rm last_check.txt 
bash-5.1# bash main.sh

[..]
curl -fsS -H accept: application/json -X POST -H Authorization: Bearer toto -F query=mutation CreateReport($eventsIds: [ID], $reportedId: ID!, $content: String, $commentsIds: [ID], $forward: Boolean) {
createReport(
    eventsIds: $eventsIds
    reportedId: $reportedId
    content: $content
    commentsIds: $commentsIds
    forward: $forward
) {
    id
    __typename
}
} -F variables={ "content" : "Possibly SPAM, user email **xxxx@gmail.com** from suspicious domain, detected by script on 2024-04-03 22:00:38-04", "reportedId": "xxxx", "eventsIds": ["xxxx"], "forward":false } -F operationName=CreateReport https://mobilizon.picasoft.net/api

Une seconde exécution de main.sh montre bien que plus rien n'est détecté

bash-5.1# bash main.sh 
2024-04-03 22:22:05-04
removed 'spam_export/airline.csv'
removed 'spam_export/all_events_with_organizers_emails.csv'
removed 'spam_export/bitcoin.csv'
removed 'spam_export/cash.csv'
removed 'spam_export/company.csv'
removed 'spam_export/design.csv'
removed 'spam_export/domains_to_check.csv'
removed 'spam_export/download.csv'
removed 'spam_export/driver.csv'
removed 'spam_export/escort.csv'
removed 'spam_export/events_users_with_bad_emails.csv'
removed 'spam_export/exam.csv'
removed 'spam_export/jet.csv'
== airline ==
== bitcoin ==
== cash ==
== company ==
== design ==
== download ==
== driver ==
== escort ==
== exam ==
== jet ==
== Getting organizers from events since last check ==
Edited by Gregory Loncle

Merge request reports

Loading