From do-not-reply at jboss.org Wed Sep 7 05:49:58 2011 Content-Type: multipart/mixed; boundary="===============1228083589430690209==" MIME-Version: 1.0 From: do-not-reply at jboss.org To: gatein-commits at lists.jboss.org Subject: [gatein-commits] gatein SVN: r7327 - in portal/branches/xss: webui/portal/src/main/java/org/exoplatform/portal/webui/portal and 1 other directory. Date: Wed, 07 Sep 2011 05:49:58 -0400 Message-ID: <201109070949.p879nwZj008069@svn01.web.mwc.hst.phx2.redhat.com> --===============1228083589430690209== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Author: ndkhoiits Date: 2011-09-07 05:49:58 -0400 (Wed, 07 Sep 2011) New Revision: 7327 Modified: portal/branches/xss/portlet/exoadmin/src/main/webapp/groovy/navigation/w= ebui/component/UISiteManagement.gtmpl portal/branches/xss/webui/portal/src/main/java/org/exoplatform/portal/we= bui/portal/UIPortalForm.java Log: GTNPORTAL-2062 XSS issue when entering site description Modified: portal/branches/xss/portlet/exoadmin/src/main/webapp/groovy/navig= ation/webui/component/UISiteManagement.gtmpl =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- portal/branches/xss/portlet/exoadmin/src/main/webapp/groovy/navigation/= webui/component/UISiteManagement.gtmpl 2011-09-07 09:23:51 UTC (rev 7326) +++ portal/branches/xss/portlet/exoadmin/src/main/webapp/groovy/navigation/= webui/component/UISiteManagement.gtmpl 2011-09-07 09:49:58 UTC (rev 7327) @@ -1,28 +1,34 @@ <% + import org.exoplatform.portal.config.UserPortalConfigService; import org.exoplatform.webui.core.UIComponent ; import org.exoplatform.webui.form.UIForm; - import java.text.DateFormat; - import java.text.SimpleDateFormat; - import org.exoplatform.portal.config.UserPortalConfigService; - = + = + import org.gatein.common.text.EntityEncoder; + = String[] actions =3D uicomponent.getActions(); uicomponent.loadPortalConfigs(); def rcontext =3D _ctx.getRequestContext(); def userPortalConfigService =3D uicomponent.getApplicationComponent(User= PortalConfigService.class); def defaultPortalName =3D userPortalConfigService.getDefaultPortal(); + EntityEncoder encoder =3D EntityEncoder.FULL; + = + String editLayoutLabel =3D _ctx.appRes("UISiteManagement.label.editLayou= t"); + String editNavigationLabel =3D _ctx.appRes("UISiteManagement.label.editN= av"); + String editPortalPropLabel =3D _ctx.appRes("UISiteManagement.label.editP= ortalProp"); + String deletePortalLabel =3D _ctx.appRes("UISiteManagement.label.deleteP= ortal"); %>
"> - <% - for (portalConfig in uicomponent.getPortalConfigs()) { = - %> - - - - + + +
3D""/ + <% + for (portalConfig in uicomponent.getPortalConfigs()) { = = + %> + + + + - - -
3D""/
<%=3Duicomponent.getFieldV= alue(portalConfig, 'name') %>
<% - def siteLabel =3D uicomponent.getFieldValue(por= talConfig, 'label'); - def siteDescription =3D uicomponent.getFieldVal= ue(portalConfig, 'description'); + def siteLabel =3D encoder.encode(uicomponent.ge= tFieldValue(portalConfig, 'label')); + def siteDescription =3D encoder.encode(uicompon= ent.getFieldValue(portalConfig, 'description')); if (siteLabel !=3D null && siteLabel.trim().len= gth() > 0) { print """
$siteLabel
"""; @@ -32,45 +38,45 @@ print """
$siteDescription
"""; } %> -
- " class=3D"EditLayoutIcon"><%=3D_ctx.appRes("UISiteMana= gement.label.editLayout")%> - " class=3D"EditNavIcon"><%=3D_ctx.appRes("UISiteManagemen= t.label.editNav")%> - '}]))" class=3D"EditNavIcon"><%=3D_ctx.appRes("UISi= teManagement.label.editPortalProp")%> - = - <% if(defaultPortalName !=3D null && !defaultPortalName.equa= ls(portalConfig.getName())) {%> - " class=3D"DeleteIcon"><%=3D_ctx.appRes("UISiteManagement.la= bel.deletePortal")%> - <% } %> -
= - <% = - } - %> = - <% - if(uicomponent.getPortalConfigs() !=3D null && uicomponent.getPortalConf= igs().size() > 0){ - %> -
= +
+ " class=3D"EditLayoutIcon">$editLayou= tLabel + " class=3D"EditNavIcon">$editNavigation= Label + '}]))" class=3D"EditNavIcon">$edi= tPortalPropLabel + = + <% if(defaultPortalName !=3D null && !defa= ultPortalName.equals(portalConfig.getName())) {%> + " class=3D"DeleteIcon">$deletePortalLab= el + <% } %> +
= + <% = + } + %> = + <% + if(uicomponent.getPortalConfigs() !=3D null && uicomponent.getPort= alConfigs().size() > 0){ + %> +
= - - + + -
- -
+ +
-
- <% - } - %> - <%uicomponent.renderChildren();%> + +
+ <% + } + %> + <%uicomponent.renderChildren();%> = = Modified: portal/branches/xss/webui/portal/src/main/java/org/exoplatform/po= rtal/webui/portal/UIPortalForm.java =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D --- portal/branches/xss/webui/portal/src/main/java/org/exoplatform/portal/w= ebui/portal/UIPortalForm.java 2011-09-07 09:23:51 UTC (rev 7326) +++ portal/branches/xss/webui/portal/src/main/java/org/exoplatform/portal/w= ebui/portal/UIPortalForm.java 2011-09-07 09:49:58 UTC (rev 7327) @@ -63,6 +63,7 @@ import org.exoplatform.webui.form.UIFormTabPane; import org.exoplatform.webui.form.validator.IdentifierValidator; import org.exoplatform.webui.form.validator.MandatoryValidator; +import org.exoplatform.webui.form.validator.SpecialCharacterValidator; import org.exoplatform.webui.form.validator.StringLengthValidator; import org.exoplatform.webui.organization.UIListPermissionSelector; import org.exoplatform.webui.organization.UIListPermissionSelector.EmptyIt= eratorValidator; @@ -242,7 +243,7 @@ new UIFormStringInput(FIELD_NAME, FIELD_NAME, null).addValidator(= MandatoryValidator.class).addValidator( StringLengthValidator.class, 3, 30).addValidator(IdentifierVal= idator.class).setEditable(false)); = - uiSettingSet.addUIFormInput(new UIFormStringInput(FIELD_LABEL, FIELD= _LABEL, null)); + uiSettingSet.addUIFormInput(new UIFormStringInput(FIELD_LABEL, FIELD= _LABEL, null).addValidator(SpecialCharacterValidator.class)); uiSettingSet.addUIFormInput(new UIFormStringInput(FIELD_DESCRIPTION,= FIELD_DESCRIPTION, null)); uiSettingSet.addUIFormInput(new UIFormSelectBox(FIELD_LOCALE, FIELD_= LOCALE, languages).addValidator(MandatoryValidator.class)); = --===============1228083589430690209==--