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

Special characters breaking the page (Important AF) #8784

Closed
xtance opened this issue Jan 30, 2023 · 0 comments · Fixed by #8789
Closed

Special characters breaking the page (Important AF) #8784

xtance opened this issue Jan 30, 2023 · 0 comments · Fixed by #8789
Labels
bug Something isn't working

Comments

@xtance
Copy link

xtance commented Jan 30, 2023

Describe the bug

This is dangerous! Especially if you output any user-submitted data on your page
This symbol is preventing json from parsing. https://pastebin.com/0iWwevN2
Coming from serverside to clientside it will break the page. (tested in chrome and waterfox)

(Just read the reproduction, I will try to explain it there)
I also created a repo for this https://github.com/xtance/sveltekit-problem

Reproduction

  1. Create a page like this:
    +page.server.ts
/** @type {import('./$types').PageServerLoad} */
export async function load({  }) {
	let str = '�';
	return ({ str });
}

+page.svelte

<script>
	export let data;
</script>

<div>This page will only be rendered after F5</div>
  1. Go to that page from another SvelteKit page <- this is important. You need to click on link pointing to that page.
    What you get is SyntaxError: Unexpected token � in JSON at position 74
    And then "500 Internal Error" instead of the page
    (If you refresh the page, or navigate straight to it instead of a href there s no such bug)

Some motherfucker used that as a nickname on my site now no one can visit his page + every page containing his username also broke.
Sure this sounds emotional but IMHO this is dangerous

Logs

SyntaxError: Unexpected token � in JSON at position 74`

System Info

System:
    OS: Windows 10 10.0.17763
    CPU: (4) x64 Intel(R) Pentium(R) CPU G4620 @ 3.70GHz
    Memory: 8.23 GB / 15.84 GB
  Binaries:
    Node: 18.12.0 - C:\Program Files\nodejs\node.EXE
    npm: 8.19.2 - C:\Program Files\nodejs\npm.CMD
  Browsers:
    Internet Explorer: 11.0.17763.771
  npmPackages:
    @sveltejs/adapter-auto: ^1.0.0 => 1.0.2
    @sveltejs/kit: ^1.0.0 => 1.3.3
    svelte: ^3.54.0 => 3.55.1
    vite: ^4.0.0 => 4.0.4

Severity

blocking all usage of SvelteKit

Additional Information

Please fix and thanks in advance <3

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 a pull request may close this issue.

2 participants