8000 Core: Added escapeHtml option to avoid XSS attacks via showLabel method by volkanceylan · Pull Request #2462 · jquery-validation/jquery-validation · GitHub
[go: up one dir, main page]

Skip to content

Core: Added escapeHtml option to avoid XSS attacks via showLabel method #2462

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

Merged

Conversation

volkanceylan
Copy link
Contributor

This adds a new constructor option "escapeHtml".

There is a script injection risk if the messages set via $.validator.messages etc. are originating from a user localizable dictionary, like a translation screen as the showLabel function uses .html() to set the label content. Even in cases where that is not an issue, if the message itself contains a format placeholder like "{0} is not valid value for this field", as the value passed to {0} is a user input, it still provides an opportunity for script injection attacks albeit at a lower risk.

@volkanceylan volkanceylan changed the title Core: Added escapeHtml option to avoid XSS attacks via showLabel methods Core: Added escapeHtml option to avoid XSS attacks via showLabel method Jan 25, 2023
@bytestream bytestream linked an issue Feb 1, 2023 that may be closed by this pull request
@bytestream bytestream merged commit 7a490d8 into jquery-validation:master Feb 1, 2023
@bytestream
Copy link
Member

Thanks @volkanceylan

@bholmesACR
Copy link

@volkanceylan Hey there, did this fix get added to a new release? According to Sonatype vulnerability listing "sonatype-2023-0681", which links to this page, the vulnerability has not been addressed in a new release since the current one version 1.19.5 is still affected correct?

@volkanceylan
Copy link
Contributor Author

I don't think they released it yet, and it is not on by default so just updating won't resolve the issue.

@bytestream
Copy link
Member

@bholmesACR see 1.20.0

@bholmesACR
Copy link

@bytestream Thanks! Also do we have to turn on/enable something like @volkanceylan says even after updating to remediate the risk? Just want to confirm

@bytestream
Copy link
Member

@bholmesACR You have to set escapeHtml: true, in your jquery-validation config

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

Successfully merging this pull request may close these issues.

Add option to html escape the messages in showLabel function
3 participants
0