Repository navigation
Escape XML special characters in production definition settings and item attributes - #17
Open
jay23606 wants to merge 1 commit into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #13.
Bug
Setting values and item attributes (
name,category,class_name,comment,schedule) in_production_definition.pywere interpolated into the generated production XML with no escaping. A value containing&,<,>or"(for exampleFilePath: "/data/input&output") produced invalid XML, which fails to compile on the IRIS side.Change
_xml_escapehelper built on the standard libraryxml.sax.saxutils.escape, which also escapes"to"so it is safe in attributes.<Setting>values in_create_item_target_settingsand to the item attributes in_create_production_item.Description) are not changed.Testing
tests/test_xml_escaping.py. It stubs theirismodule, builds aServiceItemwith special characters in its name, comment and adapter setting, and checks that the generated XML contains the escaped forms.python -m pytest tests/test_xml_escaping.py -qpasses with the fix (1 passed).Regression test: fails on base twice (/unescaped (item name|item comment|setting value)/), passes on fix twice (
python -m pytest tests/test_xml_escaping.py -q)Fixes #13