-
Notifications
You must be signed in to change notification settings - Fork 103
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
Site save doesn't sanitize description for XML entities #49
Comments
Using |
Why is #to_xml building XML with Strings anyway?! Use |
Looks like this can also happen with Credentials and Alerts. |
Yeah, looks like this code will benefit from being switched over to the XML objects instead of creating xml with strings. |
I'm pushing a quick fix for now. The string building is all over the place, so it will take some effort to clean up. As for Nokogiri, we don't want to introduce that dependency. But there is only one reason that I can think of for not switching to using the REXML libraries to do the same thing: If any code was depending upon the #to_xml calls to return a String, it will break if we switch over. That would require some more extensive testing internally just to make sure we don't break ourselves, let alone clients. A happy medium here might be to use the XML class, then to_s ourselves at the end? |
If you want to support calling the XML objects in a nested manner you could use |
Nice, I like that. That's something easy enough to add in over time. |
Line 263 in site.rb will sanitize site name, but not description:
This results in an error when trying to save a site that has any of the following in the description:
& ' " < >
To reproduce:
Using the web UI in Nexpose:
& ' " < >
Then, using a Ruby script with the gem:
3. Load the site
4. Save the site
The text was updated successfully, but these errors were encountered: