Commit fdd126303a115423f2583edb976aafb0909def65
Committed by
Andrew Shvayka
1 parent
d4718ae3
Validate more entities' fields
Showing
10 changed files
with
27 additions
and
1 deletions
@@ -19,14 +19,18 @@ import com.fasterxml.jackson.annotation.JsonProperty; | @@ -19,14 +19,18 @@ import com.fasterxml.jackson.annotation.JsonProperty; | ||
19 | import org.thingsboard.server.common.data.id.CustomerId; | 19 | import org.thingsboard.server.common.data.id.CustomerId; |
20 | import org.thingsboard.server.common.data.id.DashboardId; | 20 | import org.thingsboard.server.common.data.id.DashboardId; |
21 | import org.thingsboard.server.common.data.id.TenantId; | 21 | import org.thingsboard.server.common.data.id.TenantId; |
22 | +import org.thingsboard.server.common.data.validation.NoXss; | ||
22 | 23 | ||
24 | +import javax.validation.Valid; | ||
23 | import java.util.HashSet; | 25 | import java.util.HashSet; |
24 | import java.util.Set; | 26 | import java.util.Set; |
25 | 27 | ||
26 | public class DashboardInfo extends SearchTextBased<DashboardId> implements HasName, HasTenantId { | 28 | public class DashboardInfo extends SearchTextBased<DashboardId> implements HasName, HasTenantId { |
27 | 29 | ||
28 | private TenantId tenantId; | 30 | private TenantId tenantId; |
31 | + @NoXss | ||
29 | private String title; | 32 | private String title; |
33 | + @Valid | ||
30 | private Set<ShortCustomerInfo> assignedCustomers; | 34 | private Set<ShortCustomerInfo> assignedCustomers; |
31 | 35 | ||
32 | public DashboardInfo() { | 36 | public DashboardInfo() { |
@@ -19,6 +19,7 @@ import lombok.AllArgsConstructor; | @@ -19,6 +19,7 @@ import lombok.AllArgsConstructor; | ||
19 | import lombok.Getter; | 19 | import lombok.Getter; |
20 | import lombok.Setter; | 20 | import lombok.Setter; |
21 | import org.thingsboard.server.common.data.id.CustomerId; | 21 | import org.thingsboard.server.common.data.id.CustomerId; |
22 | +import org.thingsboard.server.common.data.validation.NoXss; | ||
22 | 23 | ||
23 | /** | 24 | /** |
24 | * Created by igor on 2/27/18. | 25 | * Created by igor on 2/27/18. |
@@ -31,6 +32,7 @@ public class ShortCustomerInfo { | @@ -31,6 +32,7 @@ public class ShortCustomerInfo { | ||
31 | private CustomerId customerId; | 32 | private CustomerId customerId; |
32 | 33 | ||
33 | @Getter @Setter | 34 | @Getter @Setter |
35 | + @NoXss | ||
34 | private String title; | 36 | private String title; |
35 | 37 | ||
36 | @Getter @Setter | 38 | @Getter @Setter |
@@ -19,6 +19,7 @@ import lombok.Data; | @@ -19,6 +19,7 @@ import lombok.Data; | ||
19 | import lombok.EqualsAndHashCode; | 19 | import lombok.EqualsAndHashCode; |
20 | import lombok.extern.slf4j.Slf4j; | 20 | import lombok.extern.slf4j.Slf4j; |
21 | import org.thingsboard.server.common.data.id.TbResourceId; | 21 | import org.thingsboard.server.common.data.id.TbResourceId; |
22 | +import org.thingsboard.server.common.data.validation.NoXss; | ||
22 | 23 | ||
23 | @Slf4j | 24 | @Slf4j |
24 | @Data | 25 | @Data |
@@ -27,6 +28,7 @@ public class TbResource extends TbResourceInfo { | @@ -27,6 +28,7 @@ public class TbResource extends TbResourceInfo { | ||
27 | 28 | ||
28 | private static final long serialVersionUID = 7379609705527272306L; | 29 | private static final long serialVersionUID = 7379609705527272306L; |
29 | 30 | ||
31 | + @NoXss | ||
30 | private String fileName; | 32 | private String fileName; |
31 | 33 | ||
32 | private String data; | 34 | private String data; |
@@ -20,6 +20,7 @@ import lombok.EqualsAndHashCode; | @@ -20,6 +20,7 @@ import lombok.EqualsAndHashCode; | ||
20 | import lombok.extern.slf4j.Slf4j; | 20 | import lombok.extern.slf4j.Slf4j; |
21 | import org.thingsboard.server.common.data.id.TbResourceId; | 21 | import org.thingsboard.server.common.data.id.TbResourceId; |
22 | import org.thingsboard.server.common.data.id.TenantId; | 22 | import org.thingsboard.server.common.data.id.TenantId; |
23 | +import org.thingsboard.server.common.data.validation.NoXss; | ||
23 | 24 | ||
24 | @Slf4j | 25 | @Slf4j |
25 | @Data | 26 | @Data |
@@ -27,6 +28,7 @@ import org.thingsboard.server.common.data.id.TenantId; | @@ -27,6 +28,7 @@ import org.thingsboard.server.common.data.id.TenantId; | ||
27 | public class TbResourceInfo extends SearchTextBased<TbResourceId> implements HasTenantId { | 28 | public class TbResourceInfo extends SearchTextBased<TbResourceId> implements HasTenantId { |
28 | 29 | ||
29 | private TenantId tenantId; | 30 | private TenantId tenantId; |
31 | + @NoXss | ||
30 | private String title; | 32 | private String title; |
31 | private ResourceType resourceType; | 33 | private ResourceType resourceType; |
32 | private String resourceKey; | 34 | private String resourceKey; |
@@ -25,6 +25,7 @@ import java.util.List; | @@ -25,6 +25,7 @@ import java.util.List; | ||
25 | public class DeviceProfileData implements Serializable { | 25 | public class DeviceProfileData implements Serializable { |
26 | 26 | ||
27 | private DeviceProfileConfiguration configuration; | 27 | private DeviceProfileConfiguration configuration; |
28 | + @Valid | ||
28 | private DeviceProfileTransportConfiguration transportConfiguration; | 29 | private DeviceProfileTransportConfiguration transportConfiguration; |
29 | private DeviceProfileProvisionConfiguration provisionConfiguration; | 30 | private DeviceProfileProvisionConfiguration provisionConfiguration; |
30 | @Valid | 31 | @Valid |
@@ -17,11 +17,14 @@ package org.thingsboard.server.common.data.device.profile; | @@ -17,11 +17,14 @@ package org.thingsboard.server.common.data.device.profile; | ||
17 | 17 | ||
18 | import lombok.Data; | 18 | import lombok.Data; |
19 | import org.thingsboard.server.common.data.DeviceTransportType; | 19 | import org.thingsboard.server.common.data.DeviceTransportType; |
20 | +import org.thingsboard.server.common.data.validation.NoXss; | ||
20 | 21 | ||
21 | @Data | 22 | @Data |
22 | public class MqttDeviceProfileTransportConfiguration implements DeviceProfileTransportConfiguration { | 23 | public class MqttDeviceProfileTransportConfiguration implements DeviceProfileTransportConfiguration { |
23 | 24 | ||
25 | + @NoXss | ||
24 | private String deviceTelemetryTopic = MqttTopics.DEVICE_TELEMETRY_TOPIC; | 26 | private String deviceTelemetryTopic = MqttTopics.DEVICE_TELEMETRY_TOPIC; |
27 | + @NoXss | ||
25 | private String deviceAttributesTopic = MqttTopics.DEVICE_ATTRIBUTES_TOPIC; | 28 | private String deviceAttributesTopic = MqttTopics.DEVICE_ATTRIBUTES_TOPIC; |
26 | private TransportPayloadTypeConfiguration transportPayloadTypeConfiguration; | 29 | private TransportPayloadTypeConfiguration transportPayloadTypeConfiguration; |
27 | 30 |
@@ -20,6 +20,7 @@ import org.thingsboard.server.common.data.BaseData; | @@ -20,6 +20,7 @@ import org.thingsboard.server.common.data.BaseData; | ||
20 | import org.thingsboard.server.common.data.HasTenantId; | 20 | import org.thingsboard.server.common.data.HasTenantId; |
21 | import org.thingsboard.server.common.data.id.TenantId; | 21 | import org.thingsboard.server.common.data.id.TenantId; |
22 | import org.thingsboard.server.common.data.id.WidgetTypeId; | 22 | import org.thingsboard.server.common.data.id.WidgetTypeId; |
23 | +import org.thingsboard.server.common.data.validation.NoXss; | ||
23 | 24 | ||
24 | @Data | 25 | @Data |
25 | public class BaseWidgetType extends BaseData<WidgetTypeId> implements HasTenantId { | 26 | public class BaseWidgetType extends BaseData<WidgetTypeId> implements HasTenantId { |
@@ -27,8 +28,11 @@ public class BaseWidgetType extends BaseData<WidgetTypeId> implements HasTenantI | @@ -27,8 +28,11 @@ public class BaseWidgetType extends BaseData<WidgetTypeId> implements HasTenantI | ||
27 | private static final long serialVersionUID = 8388684344603660756L; | 28 | private static final long serialVersionUID = 8388684344603660756L; |
28 | 29 | ||
29 | private TenantId tenantId; | 30 | private TenantId tenantId; |
31 | + @NoXss | ||
30 | private String bundleAlias; | 32 | private String bundleAlias; |
33 | + @NoXss | ||
31 | private String alias; | 34 | private String alias; |
35 | + @NoXss | ||
32 | private String name; | 36 | private String name; |
33 | 37 | ||
34 | public BaseWidgetType() { | 38 | public BaseWidgetType() { |
@@ -15,14 +15,15 @@ | @@ -15,14 +15,15 @@ | ||
15 | */ | 15 | */ |
16 | package org.thingsboard.server.common.data.widget; | 16 | package org.thingsboard.server.common.data.widget; |
17 | 17 | ||
18 | -import com.fasterxml.jackson.databind.JsonNode; | ||
19 | import lombok.Data; | 18 | import lombok.Data; |
20 | import org.thingsboard.server.common.data.id.WidgetTypeId; | 19 | import org.thingsboard.server.common.data.id.WidgetTypeId; |
20 | +import org.thingsboard.server.common.data.validation.NoXss; | ||
21 | 21 | ||
22 | @Data | 22 | @Data |
23 | public class WidgetTypeDetails extends WidgetType { | 23 | public class WidgetTypeDetails extends WidgetType { |
24 | 24 | ||
25 | private String image; | 25 | private String image; |
26 | + @NoXss | ||
26 | private String description; | 27 | private String description; |
27 | 28 | ||
28 | public WidgetTypeDetails() { | 29 | public WidgetTypeDetails() { |
@@ -17,12 +17,15 @@ package org.thingsboard.server.common.data.widget; | @@ -17,12 +17,15 @@ package org.thingsboard.server.common.data.widget; | ||
17 | 17 | ||
18 | import lombok.Data; | 18 | import lombok.Data; |
19 | import org.thingsboard.server.common.data.id.WidgetTypeId; | 19 | import org.thingsboard.server.common.data.id.WidgetTypeId; |
20 | +import org.thingsboard.server.common.data.validation.NoXss; | ||
20 | 21 | ||
21 | @Data | 22 | @Data |
22 | public class WidgetTypeInfo extends BaseWidgetType { | 23 | public class WidgetTypeInfo extends BaseWidgetType { |
23 | 24 | ||
24 | private String image; | 25 | private String image; |
26 | + @NoXss | ||
25 | private String description; | 27 | private String description; |
28 | + @NoXss | ||
26 | private String widgetType; | 29 | private String widgetType; |
27 | 30 | ||
28 | public WidgetTypeInfo() { | 31 | public WidgetTypeInfo() { |
@@ -19,6 +19,7 @@ import org.thingsboard.server.common.data.HasTenantId; | @@ -19,6 +19,7 @@ import org.thingsboard.server.common.data.HasTenantId; | ||
19 | import org.thingsboard.server.common.data.SearchTextBased; | 19 | import org.thingsboard.server.common.data.SearchTextBased; |
20 | import org.thingsboard.server.common.data.id.TenantId; | 20 | import org.thingsboard.server.common.data.id.TenantId; |
21 | import org.thingsboard.server.common.data.id.WidgetsBundleId; | 21 | import org.thingsboard.server.common.data.id.WidgetsBundleId; |
22 | +import org.thingsboard.server.common.data.validation.NoXss; | ||
22 | 23 | ||
23 | import java.util.Arrays; | 24 | import java.util.Arrays; |
24 | 25 | ||
@@ -27,9 +28,12 @@ public class WidgetsBundle extends SearchTextBased<WidgetsBundleId> implements H | @@ -27,9 +28,12 @@ public class WidgetsBundle extends SearchTextBased<WidgetsBundleId> implements H | ||
27 | private static final long serialVersionUID = -7627368878362410489L; | 28 | private static final long serialVersionUID = -7627368878362410489L; |
28 | 29 | ||
29 | private TenantId tenantId; | 30 | private TenantId tenantId; |
31 | + @NoXss | ||
30 | private String alias; | 32 | private String alias; |
33 | + @NoXss | ||
31 | private String title; | 34 | private String title; |
32 | private String image; | 35 | private String image; |
36 | + @NoXss | ||
33 | private String description; | 37 | private String description; |
34 | 38 | ||
35 | public WidgetsBundle() { | 39 | public WidgetsBundle() { |