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

Experimental switchLocalePathLinkSSR causing possible XSS vector #3042

Closed
KilianSSL opened this issue Jul 26, 2024 · 1 comment · Fixed by #3043
Closed

Experimental switchLocalePathLinkSSR causing possible XSS vector #3042

KilianSSL opened this issue Jul 26, 2024 · 1 comment · Fixed by #3043
Assignees
Labels
❗ p4-important Priority 4: bugs that violate documented behavior, or significantly impact perf v8 v9

Comments

@KilianSSL
Copy link

KilianSSL commented Jul 26, 2024

Environment

Reproduction

Minimal Repro: https://github.com/KilianSSL/i18n-ssr-repro

Disable javascript, to best review the SSR response.

  1. Set experimental switchLocalePathLinkSSR flag to true
  2. Create a wildcard page like /pages/[...slug].vue
  3. Make sure you have a language switcher utilizing <SwitchLocalePathLink>
  4. Navigate to a page like: http://localhost:3000/fr/%22%3Exss/
  5. If not manually overridden/sanitized via
setI18nParams({
  fr: { slug: '' },
  de: { slug: '' },
})  

the ">xss/ portion of the URL will cause <SwitchLocalePathLink> to output invalid HTML that will render whatever comes after ">xss/.

Describe the bug

The bug seems to be caused by <SwitchLocalePathLink> defaulting to the current URL parameters, if not set otherwise via setI18nParams. The parameters are not being sanitized before they're used in the generated HTML.

grafik

Additional context

No response

Logs

No response

@BobbieGoede
Copy link
Collaborator

This is problematic, thanks for reporting! I'll see if I can get this fixed soon and publish a patch release with it.

@BobbieGoede BobbieGoede added ❗ p4-important Priority 4: bugs that violate documented behavior, or significantly impact perf v8 v9 and removed pending triage labels Jul 26, 2024
@BobbieGoede BobbieGoede self-assigned this Jul 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
❗ p4-important Priority 4: bugs that violate documented behavior, or significantly impact perf v8 v9
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants