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

fix(pci-public-ip): fix the i18n t interpolation config #11655

Merged
merged 1 commit into from May 13, 2024

Conversation

seven-amid
Copy link
Contributor

ref: DTCORE-2189
ref: DTCORE-2198

Question Answer
Branch? feat/pci-public-ip
Bug fix? yes
New feature? no
Breaking change? no
Tickets DTCORE-2189 & DTCORE-2198
License BSD 3-Clause
  • Try to keep pull requests small so they can be easily reviewed.
  • Commits are signed-off
  • Only FR translations have been updated
  • Branch is up-to-date with target branch
  • Lint has passed locally
  • Standalone app was ran and tested locally
  • Ticket reference is mentioned in linked commits (internal only)
  • Breaking change is mentioned in relevant commits

Description

Related

ref: DTCORE-2189
ref: DTCORE-2198
Signed-off-by: LIDRISSI Hamid <abdelghani-lidrissi.hamid.ext@ovhcloud.com>
@seven-amid seven-amid requested review from a team as code owners May 6, 2024 12:53
@seven-amid seven-amid requested review from kqesar, frenautvh, antonymarion, oalkabouss and anooparveti and removed request for a team May 6, 2024 12:53
@github-actions github-actions bot added the bug Something isn't working label May 6, 2024
Copy link

sonarcloud bot commented May 6, 2024

Quality Gate Passed Quality Gate passed

Issues
0 New issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code

See analysis details on SonarCloud

Comment on lines +51 to +53
interpolation: {
escapeValue: false,
},
Copy link
Contributor

@chipp972 chipp972 May 7, 2024

Choose a reason for hiding this comment

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

we have this configuration directly in the initI18n function from react-shell-client package
It's better to have it by default and not duplicate it in each translation

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The reason behind not make it in global config is the risk of XXS attack https://www.i18next.com/translation-function/interpolation#unescape

Copy link
Contributor

@chipp972 chipp972 May 10, 2024

Choose a reason for hiding this comment

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

Except we usually interpolate data that come from our APIs (properties of an object, error messages) and display it to the user. We don't often interpolate data that come from user input and even less often send those to the APIs.

We have more cases where we don't want to escape value (because we use accents in our languages) than not doing it so it should be the default in my opinion.

If there is a risk of XXS attack we can add the configuration interpolation: {escapeValue: true} specifically for this case. Instead of adding interpolation: {escapeValue: false} everywhere if there is an accent or a special character in the i18n text

@seven-amid seven-amid merged commit 941fdb4 into feat/pci-public-ip May 13, 2024
14 checks passed
@seven-amid seven-amid deleted the fix/DTCORE-2189 branch May 13, 2024 07:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants