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

Is it possible to preserve case on attributes when filtering XSS? #286

Open
ok-martin opened this issue Feb 22, 2024 · 0 comments
Open

Is it possible to preserve case on attributes when filtering XSS? #286

ok-martin opened this issue Feb 22, 2024 · 0 comments

Comments

@ok-martin
Copy link

Is there a way to preserve the case of whitelisted attributes when using filterXSS?

Given this code:

const svgText = "<svg id="Art" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 209.621 248.055"></svg>"

const WHITELIST = {
    svg: ['id', 'xmlns', 'viewBox', 'preserveAspectRatio'],
};

const cleanText = filterXSS(svgText, { whiteList: SVG_TAGS_WHITELIST });

cleanText comes back as <svg viewbox="0 0 209.621 248.055"> instead of <svg viewBox="0 0 209.621 248.055">

I cannot run a specific query that will convert viewbox back to viewBox because it is not the only instance that I need. I have more whitelisted fields and mapping all of them is not feasible.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant