Skip to content

Candidats : limitation du nom à 70 caractères et correctif et sécurité#4320

Merged
celine-m-s merged 2 commits intomasterfrom
celinems/secu
Jul 2, 2024
Merged

Candidats : limitation du nom à 70 caractères et correctif et sécurité#4320
celine-m-s merged 2 commits intomasterfrom
celinems/secu

Conversation

@celine-m-s
Copy link
Contributor

@celine-m-s celine-m-s commented Jun 28, 2024

🤔 Pourquoi ?

Corrections suite à la campagne de Bug bounty.

  • Limitation du nom de l'utilisateur à 70 caractères.
  • Échappement du nom de l'utilisateur dans les résultats de recherche bénéficiaire.

🚨 À vérifier

  • Mettre à jour le CHANGELOG_breaking_changes.md ?

🏝️ Comment tester

  • Se connecter en tant que candidat et modifier son prénom. Par exemple :
<form%20action=#%20style="margin:100px">Login:<input%20name=1><br>Password:<input%20name=2><input%20type=submit%20value="go">
  • Se connecter en tant qu'employeur et ajouter un bénéficiaire. Vérifier que le nom qui s'affiche n'est pas un formulaire et qu'il est plus court que celui entré précédemment. 😎

💻 Captures d'écran

image

@celine-m-s celine-m-s self-assigned this Jun 28, 2024
@celine-m-s celine-m-s added the modifié Modifié dans le changelog. label Jun 28, 2024
@celine-m-s celine-m-s changed the title Correctifs de sécurité Candidats : limitation du nom à 70 caractères et correctif et sécurité Jun 28, 2024
@celine-m-s celine-m-s marked this pull request as ready for review June 28, 2024 10:20
@notion-workspace
Copy link

"""
full_name = f"{self.first_name.strip().title()} {self.last_name.upper()}"
return full_name.strip()
return full_name.strip()[:70]
Copy link
Contributor

Choose a reason for hiding this comment

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

Plus besoin de cela si ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

C'est un ajout indépendant. En fait, j'aurais pu en faire une PR en soi.
Je trouve que c'est mieux de tronquer les noms trop longs. Certains utilisateurs se trompent de champ et indiquent des adresses postales.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Zo est d'accord.

Copy link
Member

Choose a reason for hiding this comment

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

Je ne comprends pas ce changement. Les noms peuvent être très long, et il est toujours possible de rentrer 150 caractères pour le prénom et 150 pour le nom, c’est juste qu’on n’affichera juste les 70 premiers lorsqu’on utilise get_full_name().

De plus, rien n’indique la troncation (django.utils.text.Truncator est disponible si besoin).

def get_kind_display(self):
return UserKind(self.kind).label

def autocomplete_display(self):
Copy link
Contributor

Choose a reason for hiding this comment

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

C'est la méthode par défaut pour RemoteAutocompleteSelect2Widget.
J'ai effectivement l'impression que ce n'est pas utilisé dans le formulaire GPS mais potentiellement dans d'autres ?

Copy link
Contributor Author

@celine-m-s celine-m-s Jul 2, 2024

Choose a reason for hiding this comment

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

La méthode a été introduite par Vincent quand l'app GPS a vu le jour. Tous les tests passent donc je dirais que c'est le seul endroit où elle est utilisée.

@celine-m-s celine-m-s added this pull request to the merge queue Jul 2, 2024
Merged via the queue into master with commit 523704e Jul 2, 2024
@celine-m-s celine-m-s deleted the celinems/secu branch July 2, 2024 15:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

modifié Modifié dans le changelog.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants