Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
63c91ad
ESB-1146 Fix XEE in PageModelDOM
MEM2677 Jun 24, 2026
567e5fc
Update Redis Docker images to specific legacy versions and adjust Sen…
ffalqui Jun 25, 2026
cc29e75
Merge pull request #337 from entando/ESB-1148
ffalqui Jun 25, 2026
bb4797c
ESB-1145 FIX SSTI in resourceTypeCode
ffalqui Jun 25, 2026
0f82841
ESB-1144 FIX XSS in ContentManager
alexcasent Jun 25, 2026
2f4342e
ESB-1144 FIX XSS: Sanitize user input by stripping potentially unsafe…
ffalqui Jun 25, 2026
d7a3b94
Merge pull request #340 from entando/ESB-1146-patch
MEM2677 Jun 26, 2026
1f7ebbc
ESB-1126 Improved keycloak configuration handling
MEM2677 Jun 26, 2026
4e0f775
Merge pull request #339 from entando/ESB-1145
ffalqui Jun 26, 2026
f7337d1
Merge pull request #338 from entando/ESB-1144
ffalqui Jun 26, 2026
28332d0
ESB-1154 fix Lucene query injection via unsanitized field names
MEM2677 Jun 26, 2026
1ec9eed
ESB-1053 Update Freemarker dependency to use Jakarta servlet package.
ffalqui Jun 29, 2026
9005bb4
Merge pull request #344 from entando/ESB-1053
ffalqui Jul 1, 2026
ff7833f
Merge pull request #343 from entando/ESB-fix-lucene-query-injection
MEM2677 Jul 1, 2026
4104cc7
ESB-1144 Sanitize entity type labels
ffalqui Jun 29, 2026
96edffe
Merge pull request #345 from entando/ESB-1144
ffalqui Jul 2, 2026
8e968a0
ESB-1154 refacotred error handling, updated tests
MEM2677 Jul 2, 2026
c14d0a9
ESB-1154 fix tests
MEM2677 Jul 2, 2026
6d3e8dc
ESB-1154 trimmed log
MEM2677 Jul 7, 2026
dd4a380
ESB-1154 fix jakarta servlet error attributes
MEM2677 Jul 7, 2026
3a1348e
ESB-1154 quality gate
MEM2677 Jul 7, 2026
bd295dc
ESB-1154 quality gate
MEM2677 Jul 7, 2026
ca52d3a
ESB-1154 Enhance validation and sanitization on SOLR endpoint input
MEM2677 Jul 8, 2026
9ff1df6
Merge pull request #341 from entando/ESB-1126
MEM2677 Jul 8, 2026
cb663f0
ESB-1154 Fix SolrFacetedContentsResult totalSize eval
MEM2677 Jul 8, 2026
30757b0
Merge pull request #346 from entando/ESB-1154
MEM2677 Jul 8, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Dockerfile.tomcat
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM registry.hub.docker.com/entando/entando-tomcat-base:7.5.0
FROM registry.hub.docker.com/entando/entando-tomcat-base:v7.5.1-ESB-1170-PR-37-BB-release-2F-7.5
ARG VERSION

### Required OpenShift Labels
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<%@ taglib prefix="s" uri="/struts-tags" %>
<s:if test="#lang.default">
<s:property value="%{#attribute.getText()}" />
<s:property value="%{#attribute.getText()}" escapeHtml="true" />
</s:if>
<s:else>
<s:if test="#attributeTracer.listElement">
<s:property value="%{#attribute.getText()}" />
<s:property value="%{#attribute.getText()}" escapeHtml="true" />
</s:if>
<s:else>
<s:text name="EntityAttribute.monolang.defaultValue" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@
<s:if test="#lang.default">
<s:if test="%{null == #attribute.getMapKey()}" >&ndash;</s:if>
<s:else>
<p><label><s:text name="label.key" /></label>:&#32;<s:property value="%{#attribute.getMapKey()}" /></p>
<p><label><s:text name="label.value" /></label>:&#32;<s:property value="%{#attribute.getMapValue()}" /></p>
<p><label><s:text name="label.key" /></label>:&#32;<s:property value="#attribute.getMapKey()" escapeHtml="true" /></p>
<p><label><s:text name="label.value" /></label>:&#32;<s:property value="#attribute.getMapValue()" escapeHtml="true" /></p>
</s:else>
</s:if>
<s:else>
<s:if test="#attributeTracer.listElement">
<s:if test="%{null == #attribute.getMapKey()}" >&ndash;</s:if>
<s:else>
<p><label><s:text name="label.key" /></label>:&#32;<s:property value="%{#attribute.getMapKey()}" /></p>
<p><label><s:text name="label.value" /></label>:&#32;<s:property value="%{#attribute.getMapValue()}" /></p>
<p><label><s:text name="label.key" /></label>:&#32;<s:property value="#attribute.getMapKey()" escapeHtml="true" /></p>
<p><label><s:text name="label.value" /></label>:&#32;<s:property value="#attribute.getMapValue()" escapeHtml="true" /></p>
</s:else>
</s:if>
<s:else>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
<%@ taglib prefix="s" uri="/struts-tags" %>
<s:property value="#attribute.getTextForLang(#lang.code)" escapeHtml="false" />
<s:property value="#attribute.getTextForLang(#lang.code)" escapeHtml="true" />
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
<%@ taglib prefix="s" uri="/struts-tags" %>
<s:property value="%{#attribute.getTextForLang(#lang.code)}" />
<s:property value="#attribute.getTextForLang(#lang.code)" escapeHtml="true" />
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
<%@ taglib prefix="s" uri="/struts-tags" %>
<s:property value="%{#attribute.getTextForLang(#lang.code)}" />
<s:property value="#attribute.getTextForLang(#lang.code)" escapeHtml="true" />
6 changes: 3 additions & 3 deletions admin-console/src/main/webapp/error.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
<%@ taglib prefix="wp" uri="/aps-core" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%
Object statusCode = request.getAttribute("javax.servlet.error.status_code");
Object exceptionType = request.getAttribute("javax.servlet.error.exception_type");
Object message = request.getAttribute("javax.servlet.error.message");
Object statusCode = request.getAttribute("jakarta.servlet.error.status_code");
Object exceptionType = request.getAttribute("jakarta.servlet.error.exception_type");
Object message = request.getAttribute("jakarta.servlet.error.message");
%>
<!DOCTYPE html>
<html lang="en">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
/*
* Copyright 2015-Present Entando Inc. (http://www.entando.com) All rights reserved.
*
Expand Down Expand Up @@ -45,6 +45,7 @@
import org.entando.entando.ent.exception.EntRuntimeException;
import org.entando.entando.ent.util.EntLogging.EntLogFactory;
import org.entando.entando.ent.util.EntLogging.EntLogger;
import org.entando.entando.ent.util.LabelSanitizer;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.CacheEvict;

Expand Down Expand Up @@ -144,7 +145,7 @@
@Override
public String getViewPage(String contentId) {
Content type = this.getTypeById(contentId);
return type.getViewPage();

Check failure on line 148 in cms-plugin/src/main/java/com/agiletec/plugins/jacms/aps/system/services/content/ContentManager.java

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Fix this access that will throw a NullPointerException when executed.

See more on https://sonarcloud.io/project/issues?id=entando_app-engine&issues=AZ-Tk7sh7dtt045fte9x&open=AZ-Tk7sh7dtt045fte9x&pullRequest=353
}

/**
Expand All @@ -156,7 +157,7 @@
@Override
public String getDefaultModel(String contentId) {
Content type = this.getTypeById(contentId);
return type.getDefaultModel();

Check failure on line 160 in cms-plugin/src/main/java/com/agiletec/plugins/jacms/aps/system/services/content/ContentManager.java

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Fix this access that will throw a NullPointerException when executed.

See more on https://sonarcloud.io/project/issues?id=entando_app-engine&issues=AZ-Tk7sh7dtt045fte9y&open=AZ-Tk7sh7dtt045fte9y&pullRequest=353
}

/**
Expand All @@ -169,7 +170,7 @@
@Override
public String getListModel(String contentId) {
Content type = this.getTypeById(contentId);
return type.getListModel();

Check failure on line 173 in cms-plugin/src/main/java/com/agiletec/plugins/jacms/aps/system/services/content/ContentManager.java

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Fix this access that will throw a NullPointerException when executed.

See more on https://sonarcloud.io/project/issues?id=entando_app-engine&issues=AZ-Tk7sh7dtt045fte9z&open=AZ-Tk7sh7dtt045fte9z&pullRequest=353
}

/**
Expand Down Expand Up @@ -293,6 +294,7 @@
private String addUpdateContent(Content content, boolean updateDate) throws EntException {
String id = null;
try {
content.setDescription(LabelSanitizer.stripMarkup(content.getDescription()));
content.setLastModified(new Date());
if (updateDate) {
content.incrementVersion(false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@
import java.util.List;
import java.util.Map;
import java.util.Properties;

import org.entando.entando.ent.util.LabelSanitizer;
import org.entando.entando.plugins.jacms.aps.system.services.content.widget.RowContentListHelper;
import org.entando.entando.ent.util.EntLogging.EntLogger;
import org.entando.entando.ent.util.EntLogging.EntLogFactory;
Expand Down Expand Up @@ -113,6 +115,7 @@ public void releaseTenantAware() {
*/
@Override
public void addContentModel(ContentModel model) throws EntException {
model.setDescription(LabelSanitizer.stripMarkup(model.getDescription()));
try {
this.getContentModelDAO().addContentModel(model);
this.getCacheWrapper().addContentModel(model);
Expand Down Expand Up @@ -149,6 +152,7 @@ public void removeContentModel(ContentModel model) throws EntException {
*/
@Override
public void updateContentModel(ContentModel model) throws EntException {
model.setDescription(LabelSanitizer.stripMarkup(model.getDescription()));
try {
this.getContentModelDAO().updateContentModel(model);
this.getCacheWrapper().updateContentModel(model);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
/*
* Copyright 2015-Present Entando Inc. (http://www.entando.com) All rights reserved.
*
Expand Down Expand Up @@ -40,6 +40,7 @@
import org.entando.entando.ent.util.EntLogging.EntLogger;
import org.entando.entando.ent.util.EntLogging.EntLogFactory;
import org.entando.entando.ent.util.EntSafeXmlUtils;
import org.entando.entando.ent.util.LabelSanitizer;
import org.xml.sax.InputSource;

import jakarta.xml.bind.JAXBContext;
Expand Down Expand Up @@ -244,6 +245,7 @@
*/
@Override
public void addResource(ResourceInterface resource) throws EntException {
resource.setDescription(LabelSanitizer.stripMarkup(resource.getDescription()));
try {
this.generateAndSetResourceId(resource, resource.getId());
this.getResourceDAO().addResource(resource);
Expand All @@ -268,7 +270,7 @@
ResourceInterface oldResource = this.loadResource(bean.getResourceId());
try {
if (null == bean.getInputStream()) {
oldResource.setDescription(bean.getDescr());
oldResource.setDescription(LabelSanitizer.stripMarkup(bean.getDescr()));

Check failure on line 273 in cms-plugin/src/main/java/com/agiletec/plugins/jacms/aps/system/services/resource/ResourceManager.java

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Fix this access that will throw a NullPointerException when executed.

See more on https://sonarcloud.io/project/issues?id=entando_app-engine&issues=AZ-Tk7to7dtt045fte92&open=AZ-Tk7to7dtt045fte92&pullRequest=353
oldResource.setCategories(bean.getCategories());
oldResource.setMetadata(bean.getMetadata());
oldResource.setMainGroup(bean.getMainGroup());
Expand All @@ -280,7 +282,7 @@
updatedResource
.saveResourceInstances(bean, getIgnoreMetadataKeysForResourceType(bean.getResourceType()));
this.getResourceDAO().updateResource(updatedResource);
if (!updatedResource.getMasterFileName().equals(oldResource.getMasterFileName())) {

Check failure on line 285 in cms-plugin/src/main/java/com/agiletec/plugins/jacms/aps/system/services/resource/ResourceManager.java

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Fix this access that will throw a NullPointerException when executed.

See more on https://sonarcloud.io/project/issues?id=entando_app-engine&issues=AZ-Tk7to7dtt045fte93&open=AZ-Tk7to7dtt045fte93&pullRequest=353
oldResource.deleteResourceInstances();
}
this.notifyResourceChanging(updatedResource, ResourceChangedEvent.UPDATE_OPERATION_CODE);
Expand All @@ -299,6 +301,7 @@
*/
@Override
public void updateResource(ResourceInterface resource) throws EntException {
resource.setDescription(LabelSanitizer.stripMarkup(resource.getDescription()));
try {
this.getResourceDAO().updateResource(resource);
this.notifyResourceChanging(resource, ResourceChangedEvent.UPDATE_OPERATION_CODE);
Expand All @@ -310,7 +313,7 @@

protected ResourceInterface createResource(ResourceDataBean bean) throws EntException {
ResourceInterface resource = this.createResourceType(bean.getResourceType());
resource.setDescription(bean.getDescr());
resource.setDescription(LabelSanitizer.stripMarkup(bean.getDescr()));
resource.setMainGroup(bean.getMainGroup());
resource.setCategories(bean.getCategories());
resource.setMasterFileName(bean.getFileName());
Expand Down Expand Up @@ -560,7 +563,7 @@
protected void refreshMasterFileNames(String resourceId) {
try {
ResourceInterface resource = this.loadResource(resourceId);
if (resource.isMultiInstance()) {

Check failure on line 566 in cms-plugin/src/main/java/com/agiletec/plugins/jacms/aps/system/services/resource/ResourceManager.java

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Fix this access that will throw a NullPointerException when executed.

See more on https://sonarcloud.io/project/issues?id=entando_app-engine&issues=AZ-Tk7to7dtt045fte94&open=AZ-Tk7to7dtt045fte94&pullRequest=353
ResourceInstance instance
= ((AbstractMultiInstanceResource) resource).getInstance(0, null);
String filename = instance.getFileName();
Expand All @@ -581,7 +584,7 @@
protected void refreshResourceInstances(String resourceId) {
try {
ResourceInterface resource = this.loadResource(resourceId);
resource.reloadResourceInstances();

Check failure on line 587 in cms-plugin/src/main/java/com/agiletec/plugins/jacms/aps/system/services/resource/ResourceManager.java

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Fix this access that will throw a NullPointerException when executed.

See more on https://sonarcloud.io/project/issues?id=entando_app-engine&issues=AZ-Tk7to7dtt045fte95&open=AZ-Tk7to7dtt045fte95&pullRequest=353
this.updateResource(resource);
} catch (Throwable t) {
logger.error("Error refreshing resource instances of resource {}", resourceId, t);
Expand Down Expand Up @@ -667,7 +670,7 @@
JAXBContext context = JAXBContext.newInstance(JaxbMetadataMapping.class);
Unmarshaller unmarshaller = context.createUnmarshaller();
JaxbMetadataMapping jaxbMapping = (JaxbMetadataMapping) unmarshaller.unmarshal(stream);
jaxbMapping.getFields().stream().forEach(m -> {

Check warning on line 673 in cms-plugin/src/main/java/com/agiletec/plugins/jacms/aps/system/services/resource/ResourceManager.java

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Simplify the code by replacing .stream().forEach() with .forEach().

See more on https://sonarcloud.io/project/issues?id=entando_app-engine&issues=AZ-Tk7to7dtt045fte91&open=AZ-Tk7to7dtt045fte91&pullRequest=353
String key = m.getKey();
String csv = m.getValue();
List<String> metadatas = new ArrayList<>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import org.apache.commons.lang3.StringUtils;
import org.apache.struts2.ServletActionContext;
import org.entando.entando.aps.system.services.actionlog.model.ActivityStreamInfo;
import org.entando.entando.ent.util.LabelSanitizer;
import org.entando.entando.plugins.jacms.aps.system.services.content.helper.IContentHelper;
import org.entando.entando.plugins.jacms.aps.util.CmsPageUtil;
import org.entando.entando.ent.util.EntLogging.EntLogger;
Expand Down Expand Up @@ -134,7 +135,8 @@ public void scanEntity(IApsEntity entity, ActionSupport action) {
String[] args = {String.valueOf(maxLength)};
action.addFieldError(DESCR, action.getText("error.content.descr.wrongMaxLength", args));
}
if (!descr.matches("([^\"])+")) {
if (!descr.matches("[^\"<>]+")) {
content.setDescription(LabelSanitizer.stripMarkup(content.getDescription()));
action.addFieldError(DESCR, action.getText("error.content.descr.wrongCharacters"));
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
* @author E.Santoboni
*/
public abstract class AbstractResourceAction extends AbstractTreeAction {

public List<String> getResourceTypeCodes() {
return this.getResourceManager().getResourceTypeCodes();
}
Expand Down Expand Up @@ -58,7 +58,14 @@ public ResourceInterface loadResource(String resourceId) throws Throwable {
public String getResourceTypeCode() {
return _resourceTypeCode;
}

// Accept only registered type codes; neutralizes reflected input at the single bind point (SSTI, WSTG-INPV-18).
public void setResourceTypeCode(String resourceTypeCode) {
if (null != resourceTypeCode && null != this.getResourceManager()
&& !this.getResourceManager().getResourceTypeCodes().contains(resourceTypeCode)) {
this._resourceTypeCode = null;
return;
}
this._resourceTypeCode = resourceTypeCode;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,12 @@ public class MultipleResourceAction extends ResourceAction {
public void validate() {
logger.debug("MultipleResourceAction validate");
savedId.clear();
// Reject unregistered type codes: blocks save() on unknown type and reflected sinks (SSTI, WSTG-INPV-18).
if (!this.getResourceManager().getResourceTypeCodes().contains(this.getResourceTypeCode())) {
logger.warn("Rejected unknown resourceTypeCode value");
this.addFieldError("resourceTypeCode", this.getText("error.resource.file.genericError"));
return;
}
if (ApsAdminSystemConstants.EDIT == this.getStrutsAction()) {
this.fetchFileDescriptions();
addFieldErrors(validateFileDescriptions());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,7 @@
</s:if>
<s:else>
<div class="text-muted">
<s:property value="#attribute.getText()" />
<s:property value="#attribute.getText()" escapeHtml="true" />
</div>
</s:else>
</s:else>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<img
class="img-thumbnail"
src="<s:property value="#defaultResource.getImagePath('1')"/>"
alt="<s:property value="#defaultResource.descr"/>" />
alt="<s:property value="#defaultResource.descr"/>" escapeHtml="true" />
<span class="sr-only">
<abbr
title="<s:text name="label.img.text.long" />">
Expand All @@ -27,7 +27,7 @@
</s:if>
<s:else>
<s:if test="#currentResource != null">
<img class="img-thumbnail" src="<s:property value="#currentResource.getImagePath('1')"/>" alt="<s:property value="#currentResource.descr"/>" />
<img class="img-thumbnail" src="<s:property value="#currentResource.getImagePath('1')"/>" alt="<s:property value="#currentResource.descr" escapeHtml="true" />" />
<span class="sr-only">
<abbr title="<s:text name="label.img.text.long" />"> <s:text name="label.img.text.short" /></abbr>:&#32;
</span>
Expand All @@ -36,7 +36,7 @@
<img
class="img-thumbnail"
src="<s:property value="#defaultResource.getImagePath('1')"/>"
alt="<s:property value="#defaultResource.descr"/>" />
alt="<s:property value="#defaultResource.descr" escapeHtml="true" />" />
<span class="sr-only">
<abbr
title="<s:text name="label.img.text.long" />">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,10 @@
<s:set var="linkDestination" value="%{getText('note.contentLinkTo') + ': ' + #linkToEdit.contentDestination + ' - ' + #linkedContent.descr + ', ' + getText('note.contentOnPageLinkTo') + ': ' + #linkedPage.titles[currentLang.code]}" />
</s:elseif>
<%-- link icon --%>
<a href="<s:property value="#linkToEdit.contentDestination" />" class="<s:property value="#statusIconVar" />" title="<s:property value="#linkDestination" />"><span class="sr-only"><s:property value="#linkDestination" /></span></a>
<a href="<s:property value="#linkToEdit.contentDestination" />" class="<s:property value="#statusIconVar" />" title="<s:property value="#linkDestination" escapeHtml="true" />"><span class="sr-only"><s:property value="#linkDestination" escapeHtml="true" /></span></a>
<%-- text of the link --%>
<s:if test="%{#attribute.getTextForLang(#lang.code)==null}">
<span class="text-muted">&#32;<s:property value="#attribute.getText()" /></span>
<span class="text-muted">&#32;<s:property value="#attribute.getText()" escapeHtml="true" /></span>
</s:if>
<s:else>
&#32;<s:include value="/WEB-INF/apsadmin/jsp/entity/view/textAttribute.jsp" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,8 @@ void testSaveNewResourceStrutsValidation() throws Throwable {
assertEquals(Action.INPUT, result);
ActionSupport action = this.getAction();
Map<String, List<String>> actionFieldErrors = action.getFieldErrors();
assertEquals(6, actionFieldErrors.size());
assertEquals(1, actionFieldErrors.get("resourceTypeCode").size());
assertEquals(2, actionFieldErrors.size());
assertEquals(2, actionFieldErrors.get("resourceTypeCode").size());
assertEquals(1, actionFieldErrors.get("mainGroup").size());
}

Expand Down Expand Up @@ -131,8 +131,8 @@ void testSaveNewResource_2() throws Throwable {
assertEquals(Action.INPUT, result);
ActionSupport action = this.getAction();
Map<String, List<String>> actionFieldErrors = action.getFieldErrors();
assertEquals(5, actionFieldErrors.size());
assertEquals(1, actionFieldErrors.get("resourceTypeCode").size());
assertEquals(1, actionFieldErrors.size());
assertEquals(2, actionFieldErrors.get("resourceTypeCode").size());

}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
/*
* Copyright 2015-Present Entando Inc. (http://www.entando.com) All rights reserved.
*
Expand Down Expand Up @@ -59,6 +59,7 @@
import org.apache.commons.beanutils.BeanComparator;
import org.entando.entando.ent.util.EntLogging.EntLogger;
import org.entando.entando.ent.util.EntLogging.EntLogFactory;
import org.entando.entando.ent.util.LabelSanitizer;
import org.xml.sax.InputSource;
import org.xml.sax.SAXException;

Expand Down Expand Up @@ -254,6 +255,7 @@
if (null == entityType) {
throw new EntException("Invalid entity type to add");
}
this.sanitizeEntityTypeLabels(entityType);
Map<String, IApsEntity> newEntityTypes = this.getEntityTypes();
newEntityTypes.put(entityType.getTypeCode(), entityType);
this.updateEntityPrototypes(newEntityTypes);
Expand All @@ -271,6 +273,7 @@
if (null == entityType) {
throw new EntException("Invalid entity type to update");
}
this.sanitizeEntityTypeLabels(entityType);
Map<String, IApsEntity> entityTypes = this.getEntityTypes();
IApsEntity oldEntityType = entityTypes.get(entityType.getTypeCode());
if (null == oldEntityType) {
Expand All @@ -282,6 +285,23 @@
this.notifyEntityTypesChanging(oldEntityType, entityType, EntityTypesChangingEvent.UPDATE_OPERATION_CODE);
}

/**
* Strips markup from the user-supplied label fields of an entity type (its description
* and the name/description of each attribute) before it is persisted
*/
private void sanitizeEntityTypeLabels(IApsEntity entityType) {
entityType.setTypeCode(LabelSanitizer.stripMarkup(entityType.getTypeCode()));
entityType.setTypeDescription(LabelSanitizer.stripMarkup(entityType.getTypeDescription()));
List<AttributeInterface> attributes = entityType.getAttributeList();
if (null != attributes) {
for (AttributeInterface attribute : attributes) {
attribute.setName(LabelSanitizer.stripMarkup(attribute.getName()));
attribute.setDescription(LabelSanitizer.stripMarkup(attribute.getDescription()));
LabelSanitizer.stripMarkup(attribute.getNames());
}
}
}

protected void verifyReloadingNeeded(IApsEntity oldEntityType, IApsEntity newEntityType) {
if (this.getStatus(newEntityType.getTypeCode()) == STATUS_NEED_TO_RELOAD_REFERENCES) {
return;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
/*
* Copyright 2015-Present Entando Inc. (http://www.entando.com) All rights reserved.
*
Expand All @@ -23,6 +23,7 @@
import org.entando.entando.aps.system.services.tenants.RefreshableBeanTenantAware;
import org.entando.entando.ent.util.EntLogging.EntLogger;
import org.entando.entando.ent.util.EntLogging.EntLogFactory;
import org.entando.entando.ent.util.LabelSanitizer;
import org.springframework.beans.factory.BeanFactoryUtils;
import org.springframework.beans.factory.ListableBeanFactory;

Expand Down Expand Up @@ -82,6 +83,8 @@
*/
@Override
public void addCategory(Category category) throws EntException {
category.setCode(LabelSanitizer.stripMarkup(category.getCode()));
LabelSanitizer.stripMarkup(category.getTitles());
try {
this.getCategoryDAO().addCategory(category);
this.getCacheWrapper().addCategory(category);
Expand Down Expand Up @@ -121,6 +124,7 @@
*/
@Override
public void updateCategory(Category category) throws EntException {
LabelSanitizer.stripMarkup(category.getTitles());
try {
this.getCategoryDAO().updateCategory(category);
this.getCacheWrapper().updateCategory(category);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
import org.apache.commons.beanutils.BeanComparator;
import org.entando.entando.ent.util.EntLogging.EntLogger;
import org.entando.entando.ent.util.EntLogging.EntLogFactory;
import org.entando.entando.ent.util.LabelSanitizer;

/**
* Servizio gestore dei gruppi.
Expand Down Expand Up @@ -87,6 +88,7 @@ public void releaseTenantAware() {
@Override
public void addGroup(Group group) throws EntException {
try {
group.setDescr(LabelSanitizer.stripMarkup(group.getDescr()));
this.getGroupDAO().addGroup(group);
this.getCacheWrapper().addGroup(group);
} catch (Throwable t) {
Expand Down Expand Up @@ -121,6 +123,7 @@ public void removeGroup(Group group) throws EntException {
@Override
public void updateGroup(Group group) throws EntException {
try {
group.setDescr(LabelSanitizer.stripMarkup(group.getDescr()));
this.getGroupDAO().updateGroup(group);
this.getCacheWrapper().updateGroup(group);
} catch (Throwable t) {
Expand Down
Loading
Loading