Fix security vulnerabilities
Issue-ID: SDC-3634
Signed-off-by: aribeiro <anderson.ribeiro@est.tech>
Change-Id: I2ad864179cea8021773a9ea80953d995d75d36d0
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/item-rest/item-rest-types/src/main/java/org/openecomp/sdcrests/item/types/ActivityLogDto.java b/openecomp-be/api/openecomp-sdc-rest-webapp/item-rest/item-rest-types/src/main/java/org/openecomp/sdcrests/item/types/ActivityLogDto.java
index a4b6880..2a7289e 100644
--- a/openecomp-be/api/openecomp-sdc-rest-webapp/item-rest/item-rest-types/src/main/java/org/openecomp/sdcrests/item/types/ActivityLogDto.java
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/item-rest/item-rest-types/src/main/java/org/openecomp/sdcrests/item/types/ActivityLogDto.java
@@ -20,7 +20,12 @@
package org.openecomp.sdcrests.item.types;
import java.util.Date;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+import org.openecomp.sdc.common.util.ValidationUtils;
+@Data
+@NoArgsConstructor
public class ActivityLogDto {
private String id;
@@ -30,54 +35,20 @@
private String user;
private ActivityStatus status;
- public ActivityLogDto() {
+ public void setId(final String id) {
+ this.id = ValidationUtils.sanitizeInputString(id);
}
- public String getId() {
- return id;
+ public void setType(final String type) {
+ this.type = ValidationUtils.sanitizeInputString(type);
}
- public void setId(String id) {
- this.id = id;
+ public void setComment(final String comment) {
+ this.comment = ValidationUtils.sanitizeInputString(comment);
}
- public Date getTimestamp() {
- return timestamp;
+ public void setUser(final String user) {
+ this.user = ValidationUtils.sanitizeInputString(user);
}
- public void setTimestamp(Date timestamp) {
- this.timestamp = timestamp;
- }
-
- public String getType() {
- return type;
- }
-
- public void setType(String type) {
- this.type = type;
- }
-
- public String getComment() {
- return comment;
- }
-
- public void setComment(String comment) {
- this.comment = comment;
- }
-
- public String getUser() {
- return user;
- }
-
- public void setUser(String user) {
- this.user = user;
- }
-
- public ActivityStatus getStatus() {
- return status;
- }
-
- public void setStatus(ActivityStatus status) {
- this.status = status;
- }
}
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/item-rest/item-rest-types/src/main/java/org/openecomp/sdcrests/item/types/CommitRequestDto.java b/openecomp-be/api/openecomp-sdc-rest-webapp/item-rest/item-rest-types/src/main/java/org/openecomp/sdcrests/item/types/CommitRequestDto.java
index 821b771..15b08fc 100644
--- a/openecomp-be/api/openecomp-sdc-rest-webapp/item-rest/item-rest-types/src/main/java/org/openecomp/sdcrests/item/types/CommitRequestDto.java
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/item-rest/item-rest-types/src/main/java/org/openecomp/sdcrests/item/types/CommitRequestDto.java
@@ -19,15 +19,15 @@
*/
package org.openecomp.sdcrests.item.types;
+import lombok.Data;
+import org.openecomp.sdc.common.util.ValidationUtils;
+
+@Data
public class CommitRequestDto {
private String message;
- public String getMessage() {
- return message;
- }
-
- public void setMessage(String message) {
- this.message = message;
+ public void setMessage(final String message) {
+ this.message = ValidationUtils.sanitizeInputString(message);
}
}
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/item-rest/item-rest-types/src/main/java/org/openecomp/sdcrests/item/types/ItemCreationDto.java b/openecomp-be/api/openecomp-sdc-rest-webapp/item-rest/item-rest-types/src/main/java/org/openecomp/sdcrests/item/types/ItemCreationDto.java
index dec7c97..7437aec 100644
--- a/openecomp-be/api/openecomp-sdc-rest-webapp/item-rest/item-rest-types/src/main/java/org/openecomp/sdcrests/item/types/ItemCreationDto.java
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/item-rest/item-rest-types/src/main/java/org/openecomp/sdcrests/item/types/ItemCreationDto.java
@@ -19,24 +19,17 @@
*/
package org.openecomp.sdcrests.item.types;
+import lombok.Data;
+import org.openecomp.sdc.common.util.ValidationUtils;
+
+@Data
public class ItemCreationDto {
private String itemId;
private VersionDto version;
- public String getItemId() {
- return itemId;
+ public void setItemId(final String itemId) {
+ this.itemId = ValidationUtils.sanitizeInputString(itemId);
}
- public void setItemId(String itemId) {
- this.itemId = itemId;
- }
-
- public VersionDto getVersion() {
- return version;
- }
-
- public void setVersion(VersionDto version) {
- this.version = version;
- }
}
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/item-rest/item-rest-types/src/main/java/org/openecomp/sdcrests/item/types/ItemDto.java b/openecomp-be/api/openecomp-sdc-rest-webapp/item-rest/item-rest-types/src/main/java/org/openecomp/sdcrests/item/types/ItemDto.java
index 38633fb..34ad19f 100644
--- a/openecomp-be/api/openecomp-sdc-rest-webapp/item-rest/item-rest-types/src/main/java/org/openecomp/sdcrests/item/types/ItemDto.java
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/item-rest/item-rest-types/src/main/java/org/openecomp/sdcrests/item/types/ItemDto.java
@@ -20,7 +20,10 @@
package org.openecomp.sdcrests.item.types;
import java.util.Map;
+import lombok.Data;
+import org.openecomp.sdc.common.util.ValidationUtils;
+@Data
public class ItemDto {
private String id;
@@ -31,59 +34,28 @@
private String status;
private Map<String, Object> properties;
- public String getId() {
- return id;
+ public void setId(final String id) {
+ this.id = ValidationUtils.sanitizeInputString(id);
}
- public void setId(String id) {
- this.id = id;
+ public void setType(final String type) {
+ this.type = ValidationUtils.sanitizeInputString(type);
}
- public String getType() {
- return type;
+ public void setName(final String name) {
+ this.name = ValidationUtils.sanitizeInputString(name);
}
- public void setType(String type) {
- this.type = type;
+ public void setDescription(final String description) {
+ this.description = ValidationUtils.sanitizeInputString(description);
}
- public String getName() {
- return name;
+ public void setOwner(final String owner) {
+ this.owner = ValidationUtils.sanitizeInputString(owner);
}
- public void setName(String name) {
- this.name = name;
+ public void setStatus(final String status) {
+ this.status = ValidationUtils.sanitizeInputString(status);
}
- public String getDescription() {
- return description;
- }
-
- public void setDescription(String description) {
- this.description = description;
- }
-
- public String getOwner() {
- return owner;
- }
-
- public void setOwner(String owner) {
- this.owner = owner;
- }
-
- public String getStatus() {
- return status;
- }
-
- public void setStatus(String status) {
- this.status = status;
- }
-
- public Map<String, Object> getProperties() {
- return properties;
- }
-
- public void setProperties(Map<String, Object> properties) {
- this.properties = properties;
- }
}
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/item-rest/item-rest-types/src/main/java/org/openecomp/sdcrests/item/types/RevisionDto.java b/openecomp-be/api/openecomp-sdc-rest-webapp/item-rest/item-rest-types/src/main/java/org/openecomp/sdcrests/item/types/RevisionDto.java
index d7bd88f..e115388 100644
--- a/openecomp-be/api/openecomp-sdc-rest-webapp/item-rest/item-rest-types/src/main/java/org/openecomp/sdcrests/item/types/RevisionDto.java
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/item-rest/item-rest-types/src/main/java/org/openecomp/sdcrests/item/types/RevisionDto.java
@@ -20,7 +20,10 @@
package org.openecomp.sdcrests.item.types;
import java.util.Date;
+import lombok.Data;
+import org.openecomp.sdc.common.util.ValidationUtils;
+@Data
public class RevisionDto {
private String id;
@@ -28,35 +31,15 @@
private Date time;
private String user;
- public String getId() {
- return id;
+ public void setId(final String id) {
+ this.id = ValidationUtils.sanitizeInputString(id);
}
- public void setId(String id) {
- this.id = id;
+ public void setMessage(final String message) {
+ this.message = ValidationUtils.sanitizeInputString(message);
}
- public String getMessage() {
- return message;
- }
-
- public void setMessage(String message) {
- this.message = message;
- }
-
- public Date getTime() {
- return time;
- }
-
- public void setTime(Date time) {
- this.time = time;
- }
-
- public String getUser() {
- return user;
- }
-
- public void setUser(String user) {
- this.user = user;
+ public void setUser(final String user) {
+ this.user = ValidationUtils.sanitizeInputString(user);
}
}
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/item-rest/item-rest-types/src/main/java/org/openecomp/sdcrests/item/types/SubmitRequestDto.java b/openecomp-be/api/openecomp-sdc-rest-webapp/item-rest/item-rest-types/src/main/java/org/openecomp/sdcrests/item/types/SubmitRequestDto.java
index 3f4b4a9..aa8ae2c 100644
--- a/openecomp-be/api/openecomp-sdc-rest-webapp/item-rest/item-rest-types/src/main/java/org/openecomp/sdcrests/item/types/SubmitRequestDto.java
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/item-rest/item-rest-types/src/main/java/org/openecomp/sdcrests/item/types/SubmitRequestDto.java
@@ -19,15 +19,15 @@
*/
package org.openecomp.sdcrests.item.types;
+import lombok.Data;
+import org.openecomp.sdc.common.util.ValidationUtils;
+
+@Data
public class SubmitRequestDto {
private String message;
- public String getMessage() {
- return message;
- }
-
- public void setMessage(String message) {
- this.message = message;
+ public void setMessage(final String message) {
+ this.message = ValidationUtils.sanitizeInputString(message);
}
}
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/item-rest/item-rest-types/src/main/java/org/openecomp/sdcrests/item/types/VersionDto.java b/openecomp-be/api/openecomp-sdc-rest-webapp/item-rest/item-rest-types/src/main/java/org/openecomp/sdcrests/item/types/VersionDto.java
index 83884d3..38582be 100644
--- a/openecomp-be/api/openecomp-sdc-rest-webapp/item-rest/item-rest-types/src/main/java/org/openecomp/sdcrests/item/types/VersionDto.java
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/item-rest/item-rest-types/src/main/java/org/openecomp/sdcrests/item/types/VersionDto.java
@@ -21,9 +21,14 @@
import java.util.Date;
import java.util.Map;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+import org.openecomp.sdc.common.util.ValidationUtils;
import org.openecomp.sdc.versioning.dao.types.VersionState;
import org.openecomp.sdc.versioning.dao.types.VersionStatus;
+@Data
+@NoArgsConstructor
public class VersionDto {
private String id;
@@ -36,78 +41,19 @@
private Date modificationTime;
private Map<String, Object> additionalInfo;
- public VersionDto() {
+ public void setId(final String id) {
+ this.id = ValidationUtils.sanitizeInputString(id);
}
- public String getId() {
- return id;
+ public void setName(final String name) {
+ this.name = ValidationUtils.sanitizeInputString(name);
}
- public void setId(String id) {
- this.id = id;
+ public void setDescription(final String description) {
+ this.description = ValidationUtils.sanitizeInputString(description);
}
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- public String getDescription() {
- return description;
- }
-
- public void setDescription(String description) {
- this.description = description;
- }
-
- public String getBaseId() {
- return baseId;
- }
-
- public void setBaseId(String baseId) {
- this.baseId = baseId;
- }
-
- public VersionStatus getStatus() {
- return status;
- }
-
- public void setStatus(VersionStatus status) {
- this.status = status;
- }
-
- public VersionState getState() {
- return state;
- }
-
- public void setState(VersionState state) {
- this.state = state;
- }
-
- public Date getCreationTime() {
- return creationTime;
- }
-
- public void setCreationTime(Date creationTime) {
- this.creationTime = creationTime;
- }
-
- public Date getModificationTime() {
- return modificationTime;
- }
-
- public void setModificationTime(Date modificationTime) {
- this.modificationTime = modificationTime;
- }
-
- public Map<String, Object> getAdditionalInfo() {
- return additionalInfo;
- }
-
- public void setAdditionalInfo(Map<String, Object> additionalInfo) {
- this.additionalInfo = additionalInfo;
+ public void setBaseId(final String baseId) {
+ this.baseId = ValidationUtils.sanitizeInputString(baseId);
}
}
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/item-rest/item-rest-types/src/main/java/org/openecomp/sdcrests/item/types/VersionRequestDto.java b/openecomp-be/api/openecomp-sdc-rest-webapp/item-rest/item-rest-types/src/main/java/org/openecomp/sdcrests/item/types/VersionRequestDto.java
index 81747d4..628ffd2 100644
--- a/openecomp-be/api/openecomp-sdc-rest-webapp/item-rest/item-rest-types/src/main/java/org/openecomp/sdcrests/item/types/VersionRequestDto.java
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/item-rest/item-rest-types/src/main/java/org/openecomp/sdcrests/item/types/VersionRequestDto.java
@@ -19,26 +19,17 @@
*/
package org.openecomp.sdcrests.item.types;
+import lombok.Data;
+import org.openecomp.sdc.common.util.ValidationUtils;
import org.openecomp.sdc.versioning.types.VersionCreationMethod;
+@Data
public class VersionRequestDto {
private String description;
private VersionCreationMethod creationMethod;
- public String getDescription() {
- return description;
- }
-
public void setDescription(String description) {
- this.description = description;
- }
-
- public VersionCreationMethod getCreationMethod() {
- return creationMethod;
- }
-
- public void setCreationMethod(VersionCreationMethod creationMethod) {
- this.creationMethod = creationMethod;
+ this.description = ValidationUtils.sanitizeInputString(description);
}
}
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-types/src/main/java/org/openecomp/sdcrests/vendorlicense/types/EntitlementPoolEntityDto.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-types/src/main/java/org/openecomp/sdcrests/vendorlicense/types/EntitlementPoolEntityDto.java
index 835d6fc..a77c5c8 100644
--- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-types/src/main/java/org/openecomp/sdcrests/vendorlicense/types/EntitlementPoolEntityDto.java
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-types/src/main/java/org/openecomp/sdcrests/vendorlicense/types/EntitlementPoolEntityDto.java
@@ -21,35 +21,13 @@
import io.swagger.v3.oas.annotations.media.Schema;
import java.util.Set;
+import lombok.Data;
@Schema(description = "EntitlementPoolEntity")
+@Data
public class EntitlementPoolEntityDto extends EntitlementPoolRequestDto {
private String id;
private Set<String> referencingFeatureGroups;
private String versionUUID;
-
- public String getId() {
- return id;
- }
-
- public void setId(String id) {
- this.id = id;
- }
-
- public Set<String> getReferencingFeatureGroups() {
- return referencingFeatureGroups;
- }
-
- public void setReferencingFeatureGroups(Set<String> referencingFeatureGroups) {
- this.referencingFeatureGroups = referencingFeatureGroups;
- }
-
- public String getversionUUID() {
- return versionUUID;
- }
-
- public void setVersionUUID(String versionUUID) {
- this.versionUUID = versionUUID;
- }
}
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-types/src/main/java/org/openecomp/sdcrests/vendorlicense/types/EntitlementPoolRequestDto.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-types/src/main/java/org/openecomp/sdcrests/vendorlicense/types/EntitlementPoolRequestDto.java
index 35e6f31..6439583 100644
--- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-types/src/main/java/org/openecomp/sdcrests/vendorlicense/types/EntitlementPoolRequestDto.java
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-types/src/main/java/org/openecomp/sdcrests/vendorlicense/types/EntitlementPoolRequestDto.java
@@ -19,16 +19,19 @@
*/
package org.openecomp.sdcrests.vendorlicense.types;
-import io.swagger.v3.oas.annotations.media.Schema;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
-import org.hibernate.validator.constraints.NotBlank;
-import org.openecomp.sdc.vendorlicense.dao.types.EntitlementPoolType;
-import org.openecomp.sdc.vendorlicense.dao.types.OperationalScope;
-import org.openecomp.sdc.vendorlicense.dao.types.ThresholdUnit;
+import io.swagger.v3.oas.annotations.media.Schema;
import javax.validation.Valid;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
+import lombok.Data;
+import org.hibernate.validator.constraints.NotBlank;
+import org.openecomp.sdc.common.util.ValidationUtils;
+import org.openecomp.sdc.vendorlicense.dao.types.EntitlementPoolType;
+import org.openecomp.sdc.vendorlicense.dao.types.OperationalScope;
+import org.openecomp.sdc.vendorlicense.dao.types.ThresholdUnit;
+@Data
@Schema(description = "EntitlementPoolRequest")
@JsonIgnoreProperties({"time", "aggregationFunction", "entitlementMetric"})
public class EntitlementPoolRequestDto {
@@ -52,83 +55,20 @@
private String startDate;
private String expiryDate;
- public String getName() {
- return name;
+ public void setName(final String name) {
+ this.name = ValidationUtils.sanitizeInputString(name);
}
- public void setName(String name) {
- this.name = name;
+ public void setManufacturerReferenceNumber(final String manufacturerReferenceNumber) {
+ this.manufacturerReferenceNumber = ValidationUtils.sanitizeInputString(manufacturerReferenceNumber);
}
- public String getManufacturerReferenceNumber() {
- return manufacturerReferenceNumber;
+ public void setDescription(final String description) {
+ this.description = ValidationUtils.sanitizeInputString(description);
}
- public void setManufacturerReferenceNumber(String manufacturerReferenceNumber) {
- this.manufacturerReferenceNumber = manufacturerReferenceNumber;
+ public void setIncrements(final String increments) {
+ this.increments = ValidationUtils.sanitizeInputString(increments);
}
- public String getDescription() {
- return description;
- }
-
- public void setDescription(String description) {
- this.description = description;
- }
-
- public EntitlementPoolType getType() {
- return type;
- }
-
- public void setType(EntitlementPoolType type) {
- this.type = type;
- }
-
- public Integer getThresholdValue() {
- return thresholdValue;
- }
-
- public void setThresholdValue(Integer thresholdValue) {
- this.thresholdValue = thresholdValue;
- }
-
- public ThresholdUnit getThresholdUnits() {
- return thresholdUnits;
- }
-
- public void setThresholdUnits(ThresholdUnit thresholdUnits) {
- this.thresholdUnits = thresholdUnits;
- }
-
- public String getIncrements() {
- return increments;
- }
-
- public void setIncrements(String increments) {
- this.increments = increments;
- }
-
- public MultiChoiceOrOtherDto<OperationalScope> getOperationalScope() {
- return operationalScope;
- }
-
- public void setOperationalScope(MultiChoiceOrOtherDto<OperationalScope> operationalScope) {
- this.operationalScope = operationalScope;
- }
-
- public String getStartDate() {
- return startDate;
- }
-
- public void setStartDate(String startDate) {
- this.startDate = startDate;
- }
-
- public String getExpiryDate() {
- return expiryDate;
- }
-
- public void setExpiryDate(String expiryDate) {
- this.expiryDate = expiryDate;
- }
}
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-types/src/main/java/org/openecomp/sdcrests/vendorlicense/types/FeatureGroupDescriptorDto.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-types/src/main/java/org/openecomp/sdcrests/vendorlicense/types/FeatureGroupDescriptorDto.java
index 03bf2de..1e35fee 100644
--- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-types/src/main/java/org/openecomp/sdcrests/vendorlicense/types/FeatureGroupDescriptorDto.java
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-types/src/main/java/org/openecomp/sdcrests/vendorlicense/types/FeatureGroupDescriptorDto.java
@@ -21,7 +21,10 @@
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
+import lombok.Data;
+import org.openecomp.sdc.common.util.ValidationUtils;
+@Data
public class FeatureGroupDescriptorDto {
@NotNull
@@ -32,27 +35,15 @@
@NotNull
private String partNumber;
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- public String getDescription() {
- return description;
+ public void setName(final String name) {
+ this.name = ValidationUtils.sanitizeInputString(name);
}
public void setDescription(String description) {
- this.description = description;
- }
-
- public String getPartNumber() {
- return partNumber;
+ this.description = ValidationUtils.sanitizeInputString(description);
}
public void setPartNumber(String partNumber) {
- this.partNumber = partNumber;
+ this.partNumber = ValidationUtils.sanitizeInputString(partNumber);
}
}
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-types/src/main/java/org/openecomp/sdcrests/vendorlicense/types/LicenseAgreementDescriptorDto.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-types/src/main/java/org/openecomp/sdcrests/vendorlicense/types/LicenseAgreementDescriptorDto.java
index cd72d15..ab2f039 100644
--- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-types/src/main/java/org/openecomp/sdcrests/vendorlicense/types/LicenseAgreementDescriptorDto.java
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-types/src/main/java/org/openecomp/sdcrests/vendorlicense/types/LicenseAgreementDescriptorDto.java
@@ -22,8 +22,11 @@
import javax.validation.Valid;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
+import lombok.Data;
+import org.openecomp.sdc.common.util.ValidationUtils;
import org.openecomp.sdc.vendorlicense.dao.types.LicenseTerm;
+@Data
public class LicenseAgreementDescriptorDto {
@NotNull
@@ -37,35 +40,11 @@
@Size(max = 1000)
private String requirementsAndConstrains;
- public String getName() {
- return name;
+ public void setName(final String name) {
+ this.name = ValidationUtils.sanitizeInputString(name);
}
- public void setName(String name) {
- this.name = name;
- }
-
- public String getDescription() {
- return description;
- }
-
- public void setDescription(String description) {
- this.description = description;
- }
-
- public ChoiceOrOtherDto<LicenseTerm> getLicenseTerm() {
- return licenseTerm;
- }
-
- public void setLicenseTerm(ChoiceOrOtherDto<LicenseTerm> licenseTerm) {
- this.licenseTerm = licenseTerm;
- }
-
- public String getRequirementsAndConstrains() {
- return requirementsAndConstrains;
- }
-
- public void setRequirementsAndConstrains(String requirementsAndConstrains) {
- this.requirementsAndConstrains = requirementsAndConstrains;
+ public void setDescription(final String description) {
+ this.description = ValidationUtils.sanitizeInputString(description);
}
}
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-types/src/main/java/org/openecomp/sdcrests/vendorlicense/types/LicenseKeyGroupRequestDto.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-types/src/main/java/org/openecomp/sdcrests/vendorlicense/types/LicenseKeyGroupRequestDto.java
index 2eabb0a..f0f57af 100644
--- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-types/src/main/java/org/openecomp/sdcrests/vendorlicense/types/LicenseKeyGroupRequestDto.java
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-types/src/main/java/org/openecomp/sdcrests/vendorlicense/types/LicenseKeyGroupRequestDto.java
@@ -22,10 +22,13 @@
import javax.validation.Valid;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
+import lombok.Data;
+import org.openecomp.sdc.common.util.ValidationUtils;
import org.openecomp.sdc.vendorlicense.dao.types.LicenseKeyType;
import org.openecomp.sdc.vendorlicense.dao.types.OperationalScope;
import org.openecomp.sdc.vendorlicense.dao.types.ThresholdUnit;
+@Data
public class LicenseKeyGroupRequestDto {
@NotNull
@@ -46,83 +49,19 @@
@Size(max = 120)
private String increments;
- public String getName() {
- return name;
+ public void setName(final String name) {
+ this.name = ValidationUtils.sanitizeInputString(name);
}
- public void setName(String name) {
- this.name = name;
+ public void setManufacturerReferenceNumber(final String manufacturerReferenceNumber) {
+ this.manufacturerReferenceNumber = ValidationUtils.sanitizeInputString(manufacturerReferenceNumber);
}
- public String getManufacturerReferenceNumber() {
- return manufacturerReferenceNumber;
+ public void setDescription(final String description) {
+ this.description = ValidationUtils.sanitizeInputString(description);
}
- public void setManufacturerReferenceNumber(String manufacturerReferenceNumber) {
- this.manufacturerReferenceNumber = manufacturerReferenceNumber;
- }
-
- public String getDescription() {
- return description;
- }
-
- public void setDescription(String description) {
- this.description = description;
- }
-
- public LicenseKeyType getType() {
- return type;
- }
-
- public void setType(LicenseKeyType type) {
- this.type = type;
- }
-
- public MultiChoiceOrOtherDto<OperationalScope> getOperationalScope() {
- return operationalScope;
- }
-
- public void setOperationalScope(MultiChoiceOrOtherDto<OperationalScope> operationalScope) {
- this.operationalScope = operationalScope;
- }
-
- public String getStartDate() {
- return startDate;
- }
-
- public void setStartDate(String startDate) {
- this.startDate = startDate;
- }
-
- public String getExpiryDate() {
- return expiryDate;
- }
-
- public void setExpiryDate(String expiryDate) {
- this.expiryDate = expiryDate;
- }
-
- public Integer getThresholdValue() {
- return thresholdValue;
- }
-
- public void setThresholdValue(Integer thresholdValue) {
- this.thresholdValue = thresholdValue;
- }
-
- public ThresholdUnit getThresholdUnits() {
- return thresholdUnits;
- }
-
- public void setThresholdUnits(ThresholdUnit thresholdUnits) {
- this.thresholdUnits = thresholdUnits;
- }
-
- public String getIncrements() {
- return increments;
- }
-
- public void setIncrements(String increments) {
- this.increments = increments;
+ public void setIncrements(final String increments) {
+ this.increments = ValidationUtils.sanitizeInputString(increments);
}
}
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-types/src/main/java/org/openecomp/sdcrests/vendorlicense/types/LimitEntityDto.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-types/src/main/java/org/openecomp/sdcrests/vendorlicense/types/LimitEntityDto.java
index a22bb0a..b9b0181 100644
--- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-types/src/main/java/org/openecomp/sdcrests/vendorlicense/types/LimitEntityDto.java
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-types/src/main/java/org/openecomp/sdcrests/vendorlicense/types/LimitEntityDto.java
@@ -19,6 +19,10 @@
*/
package org.openecomp.sdcrests.vendorlicense.types;
+import lombok.Data;
+import org.openecomp.sdc.common.util.ValidationUtils;
+
+@Data
public class LimitEntityDto {
private String id;
@@ -31,75 +35,39 @@
private String aggregationFunction;
private String time;
- public String getId() {
- return id;
+ public void setId(final String id) {
+ this.id = ValidationUtils.sanitizeInputString(id);
}
- public void setId(String id) {
- this.id = id;
+ public void setName(final String name) {
+ this.name = ValidationUtils.sanitizeInputString(name);
}
- public String getName() {
- return name;
+ public void setType(final String type) {
+ this.type = ValidationUtils.sanitizeInputString(type);
}
- public void setName(String name) {
- this.name = name;
+ public void setDescription(final String description) {
+ this.description = ValidationUtils.sanitizeInputString(description);
}
- public String getType() {
- return type;
+ public void setMetric(final String metric) {
+ this.metric = ValidationUtils.sanitizeInputString(metric);
}
- public void setType(String type) {
- this.type = type;
+ public void setUnit(final String unit) {
+ this.unit = ValidationUtils.sanitizeInputString(unit);
}
- public String getDescription() {
- return description;
+ public void setAggregationFunction(final String aggregationFunction) {
+ this.aggregationFunction = ValidationUtils.sanitizeInputString(aggregationFunction);
}
- public void setDescription(String description) {
- this.description = description;
+ public void setTime(final String time) {
+ this.time = ValidationUtils.sanitizeInputString(time);
}
- public String getMetric() {
- return metric;
- }
-
- public void setMetric(String metric) {
- this.metric = metric;
- }
-
- public String getUnit() {
- return unit;
- }
-
- public void setUnit(String unit) {
- this.unit = unit;
- }
-
- public String getAggregationFunction() {
- return aggregationFunction;
- }
-
- public void setAggregationFunction(String aggregationFunction) {
- this.aggregationFunction = aggregationFunction;
- }
-
- public String getTime() {
- return time;
- }
-
- public void setTime(String time) {
- this.time = time;
- }
-
- public String getValue() {
- return value;
- }
-
- public void setValue(String value) {
- this.value = value;
+ public void setValue(final String value) {
+ this.value = ValidationUtils.sanitizeInputString(value);
}
}
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-types/src/main/java/org/openecomp/sdcrests/vendorlicense/types/VendorLicenseModelRequestDto.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-types/src/main/java/org/openecomp/sdcrests/vendorlicense/types/VendorLicenseModelRequestDto.java
index 625cc72..ba8fd96 100644
--- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-types/src/main/java/org/openecomp/sdcrests/vendorlicense/types/VendorLicenseModelRequestDto.java
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-license-rest/vendor-license-rest-types/src/main/java/org/openecomp/sdcrests/vendorlicense/types/VendorLicenseModelRequestDto.java
@@ -22,7 +22,10 @@
import io.swagger.v3.oas.annotations.media.Schema;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
+import lombok.Data;
+import org.openecomp.sdc.common.util.ValidationUtils;
+@Data
@Schema(description = "VendorLicenseModelRequest")
public class VendorLicenseModelRequestDto {
@@ -35,27 +38,11 @@
@NotNull
private String iconRef;
- public String getVendorName() {
- return vendorName;
+ public void setVendorName(final String vendorName) {
+ this.vendorName = ValidationUtils.sanitizeInputString(vendorName);
}
- public void setVendorName(String vendorName) {
- this.vendorName = vendorName;
- }
-
- public String getDescription() {
- return description;
- }
-
- public void setDescription(String description) {
- this.description = description;
- }
-
- public String getIconRef() {
- return iconRef;
- }
-
- public void setIconRef(String iconRef) {
- this.iconRef = iconRef;
+ public void setDescription(final String description) {
+ this.description = ValidationUtils.sanitizeInputString(description);
}
}
diff --git a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-types/src/main/java/org/openecomp/sdcrests/vendorsoftwareproducts/types/VspDescriptionDto.java b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-types/src/main/java/org/openecomp/sdcrests/vendorsoftwareproducts/types/VspDescriptionDto.java
index 010e0d3..90a094e 100644
--- a/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-types/src/main/java/org/openecomp/sdcrests/vendorsoftwareproducts/types/VspDescriptionDto.java
+++ b/openecomp-be/api/openecomp-sdc-rest-webapp/vendor-software-products-rest/vendor-software-products-rest-types/src/main/java/org/openecomp/sdcrests/vendorsoftwareproducts/types/VspDescriptionDto.java
@@ -17,6 +17,7 @@
import javax.validation.constraints.NotNull;
import lombok.Data;
+import org.openecomp.sdc.common.util.ValidationUtils;
import org.openecomp.sdc.vendorsoftwareproduct.dao.type.LicenseType;
import org.openecomp.sdc.vendorsoftwareproduct.types.LicensingData;
@@ -36,8 +37,19 @@
private String vendorName;
@NotNull
private String vendorId; // this will be populated with vlm id
-
private String licensingVersion; // this will be populated with vlm version
private LicenseType licenseType;
private LicensingData licensingData;
+
+ public void setName(final String name) {
+ this.name = ValidationUtils.sanitizeInputString(name);
+ }
+
+ public void setVendorName(final String vendorName) {
+ this.vendorName = ValidationUtils.sanitizeInputString(vendorName);
+ }
+
+ public void setDescription(final String description) {
+ this.description = ValidationUtils.sanitizeInputString(description);
+ }
}
diff --git a/openecomp-ui/src/sdc-app/onboarding/licenseModel/LicenseModelReducer.js b/openecomp-ui/src/sdc-app/onboarding/licenseModel/LicenseModelReducer.js
index f102d28..05c6654 100644
--- a/openecomp-ui/src/sdc-app/onboarding/licenseModel/LicenseModelReducer.js
+++ b/openecomp-ui/src/sdc-app/onboarding/licenseModel/LicenseModelReducer.js
@@ -90,7 +90,8 @@
errorText: '',
validations: [
{ type: 'required', data: true },
- { type: 'maxLength', data: 1000 }
+ { type: 'maxLength', data: 1000 },
+ { type: 'validateName', data: true }
]
}
}
diff --git a/openecomp-ui/src/sdc-app/onboarding/licenseModel/creation/LicenseModelCreationReducer.js b/openecomp-ui/src/sdc-app/onboarding/licenseModel/creation/LicenseModelCreationReducer.js
index 5922a47..cbd192d 100644
--- a/openecomp-ui/src/sdc-app/onboarding/licenseModel/creation/LicenseModelCreationReducer.js
+++ b/openecomp-ui/src/sdc-app/onboarding/licenseModel/creation/LicenseModelCreationReducer.js
@@ -32,7 +32,8 @@
errorText: '',
validations: [
{ type: 'required', data: true },
- { type: 'maxLength', data: 1000 }
+ { type: 'maxLength', data: 1000 },
+ { type: 'validateName', data: true }
]
},
vendorName: {
diff --git a/openecomp-ui/src/sdc-app/onboarding/licenseModel/entitlementPools/EntitlementPoolsEditorReducer.js b/openecomp-ui/src/sdc-app/onboarding/licenseModel/entitlementPools/EntitlementPoolsEditorReducer.js
index 674a8eb..c66cbbc 100644
--- a/openecomp-ui/src/sdc-app/onboarding/licenseModel/entitlementPools/EntitlementPoolsEditorReducer.js
+++ b/openecomp-ui/src/sdc-app/onboarding/licenseModel/entitlementPools/EntitlementPoolsEditorReducer.js
@@ -48,13 +48,17 @@
errorText: '',
validations: [
{ type: 'required', data: true },
- { type: 'maxLength', data: 120 }
+ { type: 'maxLength', data: 120 },
+ { type: 'validateName', data: true }
]
},
description: {
isValid: true,
errorText: '',
- validations: [{ type: 'maxLength', data: 1000 }]
+ validations: [
+ { type: 'maxLength', data: 1000 },
+ { type: 'validateName', data: true }
+ ]
},
type: {
isValid: true,
@@ -64,7 +68,10 @@
increments: {
isValid: true,
errorText: '',
- validations: [{ type: 'maxLength', data: 120 }]
+ validations: [
+ { type: 'maxLength', data: 120 },
+ { type: 'validateName', data: true }
+ ]
},
thresholdUnits: {
isValid: true,
@@ -91,7 +98,8 @@
errorText: '',
validations: [
{ type: 'required', data: true },
- { type: 'maxLength', data: 100 }
+ { type: 'maxLength', data: 100 },
+ { type: 'validateName', data: true }
]
}
},
diff --git a/openecomp-ui/src/sdc-app/onboarding/licenseModel/entitlementPools/components/FormContent.jsx b/openecomp-ui/src/sdc-app/onboarding/licenseModel/entitlementPools/components/FormContent.jsx
index 9eb38de..cc8a6e8 100644
--- a/openecomp-ui/src/sdc-app/onboarding/licenseModel/entitlementPools/components/FormContent.jsx
+++ b/openecomp-ui/src/sdc-app/onboarding/licenseModel/entitlementPools/components/FormContent.jsx
@@ -232,6 +232,7 @@
onChange={increments =>
onDataChanged({ increments }, SP_ENTITLEMENT_POOL_FORM)
}
+ errorText={genericFieldInfo.increments.errorText}
label={i18n('Increments')}
value={increments}
data-test-id="create-ep-increments"
diff --git a/openecomp-ui/src/sdc-app/onboarding/licenseModel/featureGroups/FeatureGroupsEditorReducer.js b/openecomp-ui/src/sdc-app/onboarding/licenseModel/featureGroups/FeatureGroupsEditorReducer.js
index f6b9a86..c2135ec 100644
--- a/openecomp-ui/src/sdc-app/onboarding/licenseModel/featureGroups/FeatureGroupsEditorReducer.js
+++ b/openecomp-ui/src/sdc-app/onboarding/licenseModel/featureGroups/FeatureGroupsEditorReducer.js
@@ -32,7 +32,10 @@
description: {
isValid: true,
errorText: '',
- validations: [{ type: 'maxLength', data: 1000 }],
+ validations: [
+ { type: 'maxLength', data: 1000 },
+ { type: 'validateName', data: true }
+ ],
tabId:
FeatureGroupStateConstants
.SELECTED_FEATURE_GROUP_TAB.GENERAL
@@ -40,7 +43,10 @@
partNumber: {
isValid: true,
errorText: '',
- validations: [{ type: 'required', data: true }],
+ validations: [
+ { type: 'required', data: true },
+ { type: 'validateName', data: true }
+ ],
tabId:
FeatureGroupStateConstants
.SELECTED_FEATURE_GROUP_TAB.GENERAL
@@ -50,7 +56,8 @@
errorText: '',
validations: [
{ type: 'required', data: true },
- { type: 'maxLength', data: 120 }
+ { type: 'maxLength', data: 120 },
+ { type: 'validateName', data: true }
],
tabId:
FeatureGroupStateConstants
diff --git a/openecomp-ui/src/sdc-app/onboarding/licenseModel/licenseAgreement/LicenseAgreementEditorReducer.js b/openecomp-ui/src/sdc-app/onboarding/licenseModel/licenseAgreement/LicenseAgreementEditorReducer.js
index 03157cb..bca06a8 100644
--- a/openecomp-ui/src/sdc-app/onboarding/licenseModel/licenseAgreement/LicenseAgreementEditorReducer.js
+++ b/openecomp-ui/src/sdc-app/onboarding/licenseModel/licenseAgreement/LicenseAgreementEditorReducer.js
@@ -32,7 +32,10 @@
description: {
isValid: true,
errorText: '',
- validations: [{ type: 'maxLength', data: 1000 }],
+ validations: [
+ { type: 'maxLength', data: 1000 },
+ { type: 'validateName', data: true }
+ ],
tabId:
LicenseAgreementEnums.SELECTED_LICENSE_AGREEMENT_TAB
.GENERAL
@@ -56,7 +59,8 @@
errorText: '',
validations: [
{ type: 'required', data: true },
- { type: 'maxLength', data: 25 }
+ { type: 'maxLength', data: 25 },
+ { type: 'validateName', data: true }
],
tabId:
LicenseAgreementEnums.SELECTED_LICENSE_AGREEMENT_TAB
diff --git a/openecomp-ui/src/sdc-app/onboarding/licenseModel/licenseKeyGroups/LicenseKeyGroupsEditorReducer.js b/openecomp-ui/src/sdc-app/onboarding/licenseModel/licenseKeyGroups/LicenseKeyGroupsEditorReducer.js
index 6895316..d3af8be 100644
--- a/openecomp-ui/src/sdc-app/onboarding/licenseModel/licenseKeyGroups/LicenseKeyGroupsEditorReducer.js
+++ b/openecomp-ui/src/sdc-app/onboarding/licenseModel/licenseKeyGroups/LicenseKeyGroupsEditorReducer.js
@@ -49,14 +49,18 @@
description: {
isValid: true,
errorText: '',
- validations: [{ type: 'maxLength', data: 1000 }]
+ validations: [
+ { type: 'maxLength', data: 1000 },
+ { type: 'validateName', data: true }
+ ]
},
name: {
isValid: true,
errorText: '',
validations: [
{ type: 'required', data: true },
- { type: 'maxLength', data: 120 }
+ { type: 'maxLength', data: 120 },
+ { type: 'validateName', data: true }
]
},
type: {
@@ -77,7 +81,10 @@
increments: {
isValid: true,
errorText: '',
- validations: [{ type: 'maxLength', data: 120 }]
+ validations: [
+ { type: 'maxLength', data: 120 },
+ { type: 'validateName', data: true }
+ ]
},
startDate: {
isValid: true,
@@ -92,7 +99,10 @@
manufacturerReferenceNumber: {
isValid: true,
errorText: '',
- validations: [{ type: 'maxLength', data: 100 }]
+ validations: [
+ { type: 'maxLength', data: 100 },
+ { type: 'validateName', data: true }
+ ]
}
}
};
diff --git a/openecomp-ui/src/sdc-app/onboarding/licenseModel/licenseKeyGroups/components/FormContent.jsx b/openecomp-ui/src/sdc-app/onboarding/licenseModel/licenseKeyGroups/components/FormContent.jsx
index 2486428..fe7873f 100644
--- a/openecomp-ui/src/sdc-app/onboarding/licenseModel/licenseKeyGroups/components/FormContent.jsx
+++ b/openecomp-ui/src/sdc-app/onboarding/licenseModel/licenseKeyGroups/components/FormContent.jsx
@@ -207,6 +207,9 @@
LKG_FORM_NAME
)
}
+ errorText={
+ genericFieldInfo.manufacturerReferenceNumber.errorText
+ }
label={i18n('Manufacturer Reference Number')}
value={manufacturerReferenceNumber}
data-test-id="create-ep-mrn"
@@ -219,6 +222,7 @@
onChange={increments =>
onDataChanged({ increments }, LKG_FORM_NAME)
}
+ errorText={genericFieldInfo.increments.errorText}
label={i18n('Increments')}
value={increments}
data-test-id="create-ep-increments"
diff --git a/openecomp-ui/src/sdc-app/onboarding/softwareProduct/details/SoftwareProductDetailsReducer.js b/openecomp-ui/src/sdc-app/onboarding/softwareProduct/details/SoftwareProductDetailsReducer.js
index 1e4a0df..fb8dbe4 100644
--- a/openecomp-ui/src/sdc-app/onboarding/softwareProduct/details/SoftwareProductDetailsReducer.js
+++ b/openecomp-ui/src/sdc-app/onboarding/softwareProduct/details/SoftwareProductDetailsReducer.js
@@ -42,7 +42,10 @@
description: {
isValid: true,
errorText: '',
- validations: [{ type: 'required', data: true }]
+ validations: [
+ { type: 'validateName', data: true },
+ { type: 'required', data: true }
+ ]
}
},
data: action.response
diff --git a/openecomp-ui/test/softwareProduct/details/detailsView.test.js b/openecomp-ui/test/softwareProduct/details/detailsView.test.js
index 46983f5..136ecde 100644
--- a/openecomp-ui/test/softwareProduct/details/detailsView.test.js
+++ b/openecomp-ui/test/softwareProduct/details/detailsView.test.js
@@ -77,7 +77,7 @@
'description': {
isValid: true,
errorText: '',
- validations: [{type: 'required', data: true}]
+ validations: [{type: 'validateName', data: true}, {type: 'required', data: true}]
}
};
qGenericFieldInfo = SchemaGenericFieldInfoFactory.build();
@@ -151,7 +151,7 @@
dataMap
}
},
- finalizedLicenseModelList: finalizedLicenseModelList,
+ finalizedLicenseModelList: finalizedLicenseModelList,
archivedLicenseModelList: [],
archivedSoftwareProductList: [],
licenseModel: {
diff --git a/openecomp-ui/test/softwareProduct/details/test.js b/openecomp-ui/test/softwareProduct/details/test.js
index 6050624..92390f6 100644
--- a/openecomp-ui/test/softwareProduct/details/test.js
+++ b/openecomp-ui/test/softwareProduct/details/test.js
@@ -67,8 +67,8 @@
await SoftwareProductActionHelper.fetchSoftwareProductList(store.dispatch);
await SoftwareProductActionHelper.fetchFinalizedSoftwareProductList(store.dispatch);
await SoftwareProductActionHelper.fetchArchivedSoftwareProductList(store.dispatch);
-
- expect(store.getState()).toEqual(expectedStore);
+
+ expect(store.getState()).toEqual(expectedStore);
});
it('Add Software Product', () => {
@@ -116,7 +116,7 @@
'description': {
isValid: true,
errorText: '',
- validations: [{type: 'required', data: true}]
+ validations: [{type: 'validateName', data: true}, {type: 'required', data: true}]
}
};
const expectedFormName = forms.VENDOR_SOFTWARE_PRODUCT_DETAILS;