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

make sure userdata is correctly passed #31

Closed
wants to merge 1 commit into from

Conversation

DaanHoogland
Copy link
Member

@DaanHoogland DaanHoogland commented Mar 8, 2019

Description

removing class="disallowSpecialCharacters" to prevent url encoding
and calling sanitizeReverse on the fields contents before encoding it to send to the server.

Types of changes

  • Breaking change (fix or feature that would cause existing functionality to change)
  • New feature (non-breaking change which adds functionality)
  • Bug fix (non-breaking change which fixes an issue)
  • Enhancement (improves an existing feature and functionality)
  • Cleanup (Code refactoring and cleanup, that may add test cases)

Screenshots (if appropriate):

How Has This Been Tested?

This has been manually tested by adding user data containing the characters '&', '<' and '>' in the simulator UI and then checking the data base field in the user_vm table to see if the characters where xml-entities after base64-decoding them.

@@ -557,7 +557,7 @@ <h3><translate key="label.select.iso.or.template" /></h3>
<span><translate key="label.add.userdata"/> (<translate key="label.optional"/>)</span>
</div>
<div class="value">
<textarea name="userdata" class="disallowSpecialCharacters"></textarea>
<textarea name="userdata"></textarea>
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this might not be needed but it makes no sense either, so I'll keep this in.

$.extend(deployVmData, {
userdata : encodeURIComponent(btoa(userdata))
userdata : btoa(userdata)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll re-add the encodeURI call as a base64 string may contain '=' signs.

userdata = userdata
.replace(/&amp;/g, "&")
.replace(/&lt;/g, "<")
.replace(/&gt;/g, ">");
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nicolas reported he had a test case where the calling variity did work, I so I'll experiment more to see if I can get it to work and replace above with a call to cloudstack.sanitizeReverse(userdata);

  these are generic for all fields and hurt userdata
  call ithe existing method
  remove class that pretends to prevent special chars
Copy link
Member

@rohityadavcloud rohityadavcloud left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, if testing is okay @DaanHoogland then send to apache/cloudstack

@DaanHoogland DaanHoogland changed the title remove class that prevents special chars make sure userdata is correctly passed Mar 25, 2019
@DaanHoogland
Copy link
Member Author

moved to master

@DaanHoogland
Copy link
Member Author

see apache#3260

rohityadavcloud pushed a commit that referenced this pull request Jan 20, 2021
* Added some fixes and made language change not reload

* Remove unwanted code

Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
shwstppr added a commit that referenced this pull request Aug 16, 2021
Fixes stopped VM migration of user VM belonging to user other than root admin
https://shapeblue.atlassian.net/browse/KDDI-653
shwstppr added a commit that referenced this pull request Nov 23, 2021
Fixes stopped VM migration of user VM belonging to user other than root admin
https://shapeblue.atlassian.net/browse/KDDI-653
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.

None yet

3 participants