diff options
author | aribeiro <anderson.ribeiro@est.tech> | 2021-07-12 15:10:19 +0100 |
---|---|---|
committer | Michael Morris <michael.morris@est.tech> | 2021-07-23 15:43:41 +0000 |
commit | cba52c9e6c67ae2ee723c76f0c9ed165b657df63 (patch) | |
tree | b0f8a2abdd105caa0560c6f0fa278b33d50a2c90 | |
parent | a527fdac8996e4022879f1a871864ed49cf18325 (diff) |
Fix security vulnerabilities
Issue-ID: SDC-3634
Signed-off-by: aribeiro <anderson.ribeiro@est.tech>
Change-Id: I2ad864179cea8021773a9ea80953d995d75d36d0
27 files changed, 216 insertions, 527 deletions
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 a4b688085c..2a7289e259 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 @@ public class ActivityLogDto { 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 821b7713eb..15b08fc5b4 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 dec7c97674..7437aec6e3 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(String itemId) { - this.itemId = itemId; + public void setItemId(final String itemId) { + this.itemId = ValidationUtils.sanitizeInputString(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 38633fb6f7..34ad19fa7c 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 @@ public class ItemDto { 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 d7bd88f4be..e115388239 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 @@ public class RevisionDto { 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 3f4b4a94da..aa8ae2c7ae 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 83884d3a1d..38582beb19 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 @@ package org.openecomp.sdcrests.item.types; 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 @@ public class VersionDto { 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 81747d4612..628ffd294e 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 835d6fcbfe..a77c5c8347 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 @@ package org.openecomp.sdcrests.vendorlicense.types; 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 35e6f31e28..6439583d3e 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 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; -import javax.validation.Valid; -import javax.validation.constraints.NotNull; -import javax.validation.constraints.Size; +@Data @Schema(description = "EntitlementPoolRequest") @JsonIgnoreProperties({"time", "aggregationFunction", "entitlementMetric"}) public class EntitlementPoolRequestDto { @@ -52,83 +55,20 @@ public class EntitlementPoolRequestDto { private String startDate; private String expiryDate; - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public String getManufacturerReferenceNumber() { - return manufacturerReferenceNumber; - } - - public void setManufacturerReferenceNumber(String manufacturerReferenceNumber) { - this.manufacturerReferenceNumber = manufacturerReferenceNumber; - } - - public String getDescription() { - return description; - } - - public void setDescription(String description) { - this.description = description; - } - - public EntitlementPoolType getType() { - return type; + public void setName(final String name) { + this.name = ValidationUtils.sanitizeInputString(name); } - public void setType(EntitlementPoolType type) { - this.type = type; + public void setManufacturerReferenceNumber(final String manufacturerReferenceNumber) { + this.manufacturerReferenceNumber = ValidationUtils.sanitizeInputString(manufacturerReferenceNumber); } - public Integer getThresholdValue() { - return thresholdValue; + public void setDescription(final String description) { + this.description = ValidationUtils.sanitizeInputString(description); } - public void setThresholdValue(Integer thresholdValue) { - this.thresholdValue = thresholdValue; + public void setIncrements(final String increments) { + this.increments = ValidationUtils.sanitizeInputString(increments); } - 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 03bf2de328..1e35fee862 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 @@ package org.openecomp.sdcrests.vendorlicense.types; 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 @@ public class FeatureGroupDescriptorDto { @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 cd72d151dc..ab2f039267 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 @@ package org.openecomp.sdcrests.vendorlicense.types; 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 @@ public class LicenseAgreementDescriptorDto { @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 2eabb0aa4a..f0f57af287 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 @@ package org.openecomp.sdcrests.vendorlicense.types; 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 @@ public class LicenseKeyGroupRequestDto { @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 a22bb0a64d..b9b018144d 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 @@ public class LimitEntityDto { private String aggregationFunction; private String time; - public String getId() { - return id; - } - - public void setId(String id) { - this.id = id; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public String getType() { - return type; - } - - public void setType(String type) { - this.type = type; - } - - public String getDescription() { - return description; - } - - public void setDescription(String description) { - this.description = description; - } - - public String getMetric() { - return metric; - } - - public void setMetric(String metric) { - this.metric = metric; + public void setId(final String id) { + this.id = ValidationUtils.sanitizeInputString(id); } - public String getUnit() { - return unit; + public void setName(final String name) { + this.name = ValidationUtils.sanitizeInputString(name); } - public void setUnit(String unit) { - this.unit = unit; + public void setType(final String type) { + this.type = ValidationUtils.sanitizeInputString(type); } - public String getAggregationFunction() { - return aggregationFunction; + public void setDescription(final String description) { + this.description = ValidationUtils.sanitizeInputString(description); } - public void setAggregationFunction(String aggregationFunction) { - this.aggregationFunction = aggregationFunction; + public void setMetric(final String metric) { + this.metric = ValidationUtils.sanitizeInputString(metric); } - public String getTime() { - return time; + public void setUnit(final String unit) { + this.unit = ValidationUtils.sanitizeInputString(unit); } - public void setTime(String time) { - this.time = time; + public void setAggregationFunction(final String aggregationFunction) { + this.aggregationFunction = ValidationUtils.sanitizeInputString(aggregationFunction); } - public String getValue() { - return value; + public void setTime(final String time) { + this.time = ValidationUtils.sanitizeInputString(time); } - 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 625cc721a9..ba8fd96e6e 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 @@ package org.openecomp.sdcrests.vendorlicense.types; 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 @@ public class VendorLicenseModelRequestDto { @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 010e0d3818..90a094e817 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 @@ package org.openecomp.sdcrests.vendorsoftwareproducts.types; 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 @@ public class VspDescriptionDto { 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 f102d286f0..05c6654531 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 @@ export default combineReducers({ 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 5922a47822..cbd192d58e 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 @@ export default (state = {}, action) => { 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 674a8eba51..c66cbbc25b 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 @@ export default (state = {}, action) => { 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 @@ export default (state = {}, action) => { 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 @@ export default (state = {}, action) => { 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 9eb38dec64..cc8a6e844c 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 @@ export const EntitlementPoolsFormContent = ({ 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 f6b9a86f7a..c2135ec988 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 @@ export default (state = {}, action) => { 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 @@ export default (state = {}, action) => { 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 @@ export default (state = {}, action) => { 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 03157cb108..bca06a8ccd 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 @@ export default (state = {}, action) => { 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 @@ export default (state = {}, action) => { 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 68953169c1..d3af8bea5c 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 @@ export default (state = {}, action) => { 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 @@ export default (state = {}, action) => { 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 @@ export default (state = {}, action) => { 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 24864289e1..fe7873ff2e 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 @@ const LicenseKeyGroupFormContent = ({ LKG_FORM_NAME ) } + errorText={ + genericFieldInfo.manufacturerReferenceNumber.errorText + } label={i18n('Manufacturer Reference Number')} value={manufacturerReferenceNumber} data-test-id="create-ep-mrn" @@ -219,6 +222,7 @@ const LicenseKeyGroupFormContent = ({ 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 1e4a0df787..fb8dbe4564 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 @@ export default (state = {}, action) => { 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 46983f5d80..136ecde969 100644 --- a/openecomp-ui/test/softwareProduct/details/detailsView.test.js +++ b/openecomp-ui/test/softwareProduct/details/detailsView.test.js @@ -77,7 +77,7 @@ describe('Software Product Details: ', function () { '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 @@ describe('Software Product Details: ', function () { 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 60506243ff..92390f61ef 100644 --- a/openecomp-ui/test/softwareProduct/details/test.js +++ b/openecomp-ui/test/softwareProduct/details/test.js @@ -67,8 +67,8 @@ describe('Software Product Details Module Tests', function () { 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 @@ describe('Software Product Details Module Tests', function () { '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; |