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

[FEATURE] Interdire l'HTML sur les champs qui ne le permettent pas (PIX-10243) (PIX-10241) #8668

Merged

Conversation

reibecca
Copy link
Contributor

@reibecca reibecca commented Apr 16, 2024

🦄 Problème

En tant que l'equipe contenu qui redige les modules, ils sont pas notifier si un champ peut contenir HTML ou pas.

🤖 Proposition

Ajouter validation pour les champs qui doivent pas contenir HTML.

🌈 Remarques

Pour le schema QROCM Block Select options, on a vu qu'il n'y a pas un minimum des options dans le joi schema. Il faut ajouter un minimum de 2 option.

💯 Pour tester

CI passe

En local:

  1. Aller sur un module.json eg. bien-ecrire-son-adresse-mail.json
  2. Modifier l'objet Image en ajoutant une balise HTML dans le champ alt

Par exemple :

{
        id: '167907eb-ee0d-4de0-9fc8-609b2b62ed9f',
        type: 'image',
        url: 'https://images.pix.fr/modulix/placeholder-image.svg',
        alt: '<p>une alt text invalid</p>',
        alternativeText: '',
      };
  1. Relancer les tests
  2. Verifier que les tests expliquent lisiblement où et pourquoi le test casse

@pix-bot-github
Copy link

Une fois les applications déployées, elles seront accessibles via les liens suivants :

Les variables d'environnement seront accessibles via les liens suivants :

@mirawlin mirawlin force-pushed the pix-10243-forbid-html-on-specific-fields branch from 3a2dc49 to 34858aa Compare April 17, 2024 08:53
@dlahaye dlahaye force-pushed the pix-10243-forbid-html-on-specific-fields branch from 34858aa to bffb8a0 Compare April 17, 2024 09:25
@mirawlin mirawlin force-pushed the pix-10243-forbid-html-on-specific-fields branch from bffb8a0 to 81bf129 Compare April 17, 2024 09:49
@mirawlin mirawlin force-pushed the pix-10243-forbid-html-on-specific-fields branch from 81bf129 to 9e531ee Compare April 17, 2024 12:43
@mirawlin mirawlin marked this pull request as ready for review April 17, 2024 12:43
@mirawlin mirawlin requested a review from a team as a code owner April 17, 2024 12:43
@mirawlin mirawlin force-pushed the pix-10243-forbid-html-on-specific-fields branch from 9e531ee to e2c3b0c Compare April 17, 2024 13:23
@yannbertrand yannbertrand force-pushed the pix-10243-forbid-html-on-specific-fields branch from e2c3b0c to 23d9162 Compare April 17, 2024 14:56
export { htmlSchema, proposalIdSchema, uuidSchema };
const htmlNotAllowedSchema = Joi.string()
.regex(/<.*?>/, { invert: true })
.message('{{:#label}} failed custom validation because HTML is not allowed in this field');
Copy link
Member

Choose a reason for hiding this comment

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

A garder dans un coin de la tête pour une prochaine fois !

https://joi.dev/api/?v=17.12.3#template-syntax

Co-authored-by: Rebeca Kaci <[email protected]>
Co-authored-by: Dimitri Lahaye <[email protected]>
@yannbertrand yannbertrand force-pushed the pix-10243-forbid-html-on-specific-fields branch from 23d9162 to 397c07a Compare April 18, 2024 12:36
@yannbertrand yannbertrand changed the title [FEATURE] Interdire l'HTML sur les champs qui ne le permettent pas (PIX-10243) [FEATURE] Interdire l'HTML sur les champs qui ne le permettent pas (PIX-10243) (PIX-10241) Apr 18, 2024
@pix-service-auto-merge pix-service-auto-merge merged commit 34a588f into dev Apr 18, 2024
10 checks passed
@pix-service-auto-merge pix-service-auto-merge deleted the pix-10243-forbid-html-on-specific-fields branch April 18, 2024 12:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants