-
Notifications
You must be signed in to change notification settings - Fork 455
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
Invalid XML can be generated out of bad user input #10996
Comments
@jonasraoni, is this user input via the browser, or an invalid XML file (JATS), or something else? We used to have some tools for this back in the early days of OJS 3.0 ("charset normalization"); they caused more problems than they solve. At some level we need to rely on the underlying platform and environment to provide sane user input; trying to work around gaps in userspace is fixing things at the wrong level, in my opinion. If there's a common source of bad input, we can look into it, but I'll be a little resistant to fixes that really should be happening upstream. |
Is this content that's pasted into TinyMCE? I think both input and output would be good to investigate...
I would think it's possible to use a standard method to create XML text elements that's resilient -- without having to manually pass all our text through an additional filter. |
Valid Title
Description
The XML has a well defined list of accepted characters, but user input might violate it, and the PHP functions are not going to help, therefore it makes sense to remove them from the user input (e.g.
preg_replace('/[^\x{0009}\x{000a}\x{000d}\x{0020}-\x{D7FF}\x{E000}-\x{FFFD}]+/u', '', $input)
).It also makes sense to fix bad UTF-8 characters on the way with:
Steps to Reproduce
/index.php/{$journal}/oai
URL and list the recordsExpected Result
The character should be stripped or replaced by something acceptable, such as the 0xFFFD (https://en.wikipedia.org/wiki/Specials_(Unicode_block)#Replacement_character).
Actual Result
The browser will not render the content properly, but of course, that's not the main issue.
Environment Details
No response
Application Version
OJS 3.3.0
Logs
No response
Additional Information
No response
The text was updated successfully, but these errors were encountered: