Unsicherer ObjektbindungsprüfungenJava

Java-Forum
Anonymous
 Unsicherer Objektbindungsprüfungen

Post by Anonymous »

Ich werde in CheckMarx -Scan aufmerksam machen, und sagt, dass unsichere Objektbindung im Saveall () Aufruf.

Code: Select all

The columnConfigSet at src\main\java\com\ge\digital\oa\moa\controller\ConfigController.java in line 45 may unintentionally allow setting the value of saveAll in setColumnsConfig, in the object src\main\java\com\ge\digital\oa\moa\service\ConfigService.java at line 170.
< /code>
Jede Idee, wie man den Code umschreibt, so dass der CheckMarx nicht mehr beschwert.@PutMapping("/columns")
@ResponseStatus(OK)
public void setColumnsConfig(@RequestBody(required=true) ColumnConfigSetDto columnConfigSet) {
service.setColumnsConfig(columnConfigSet);
}
< /code>

public void setColumnsConfig(ColumnConfigSetDto columnConfigSet) {

String userId = columnConfigSet.getUserId();
String viewName = columnConfigSet.getViewName();

List configs = new ArrayList();

for (ColumnConfigDto colConfig : columnConfigSet.getColumns()) {

// build a db config row only for the visibility property for now
ColumnConfigId confId = new ColumnConfigId();

confId.setUserId(userId);
confId.setViewName(viewName);
confId.setKey(colConfig.getKey());
confId.setProperty("visible");

ColumnConfig conf = new ColumnConfig();
conf.setColumnConfigId(confId);
conf.setValue(colConfig.getIsVisible() ? "true" : "false" );

configs.add(conf);
}

if (!configs.isEmpty()) {
configRepo.saveAll(configs);
}

}
< /code>

Below are my DTO Objects which is used in this code :
@Getter
@Setter
public class ColumnConfigSetDto {

@JsonProperty("userId")
private String userId;

@JsonProperty("viewName")
private String viewName;

@JsonProperty("columns")
private List columns;
}
< /code>

Below are my DTO code which is used in this
@Getter
@Setter
public class ColumnConfigDto {

@JsonProperty("key")
private String key;

@JsonProperty("label")
private String label;

@JsonProperty("isVisible")
private Boolean isVisible;

@JsonProperty("position")
private Integer position;

@JsonProperty("isSortable")
private Boolean isSortable;

@JsonProperty("isHideable")
private Boolean isHideable;

}

Quick Reply

Change Text Case: 
   
  • Similar Topics
    Replies
    Views
    Last post
  • Was schneller ist – unsicherer C#-Code oder rohes C++
    by Guest » » in C#
    0 Replies
    12 Views
    Last post by Guest
  • Was schneller ist – unsicherer C#-Code oder rohes C++
    by Guest » » in C++
    0 Replies
    6 Views
    Last post by Guest
  • Was schneller ist – unsicherer C#-Code oder rohes C++
    by Guest » » in C++
    0 Replies
    11 Views
    Last post by Guest