-
-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Don't show unescaped user id in user-information form.
This applies PloneHotfix20160830.
- Loading branch information
1 parent
44428b2
commit 38284c2
Showing
3 changed files
with
36 additions
and
2 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
from plone.app.users.browser.userdatapanel import UserDataPanel | ||
from plone.app.users.testing import PLONE_APP_USERS_FUNCTIONAL_TESTING | ||
from zope.i18n import translate | ||
|
||
import unittest | ||
|
||
|
||
class TestUserDataPanel(unittest.TestCase): | ||
|
||
layer = PLONE_APP_USERS_FUNCTIONAL_TESTING | ||
|
||
def test_regression(self): | ||
portal = self.layer['portal'] | ||
request = self.layer['request'] | ||
request.form.update({ | ||
'userid': 'admin' | ||
}) | ||
form = UserDataPanel(portal, request) | ||
description = translate(form.description, context=request) | ||
self.assertTrue('admin' in description) | ||
|
||
def test_escape_html(self): | ||
portal = self.layer['portal'] | ||
request = self.layer['request'] | ||
request.form.update({ | ||
'userid': 'admin<script>alert("userid")</script>' | ||
}) | ||
form = UserDataPanel(portal, request) | ||
description = translate(form.description, context=request) | ||
self.assertTrue('<script>' not in description) |