Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,14 @@
*/
package org.exoplatform.task.service;

import org.exoplatform.commons.utils.ListAccess;
import java.util.List;
import java.util.Set;

import org.exoplatform.task.dao.OrderBy;
import org.exoplatform.task.dao.ProjectQuery;
import org.exoplatform.task.dto.ProjectDto;
import org.exoplatform.task.exception.EntityNotFoundException;

import java.util.List;
import java.util.Set;


public interface ProjectService {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,6 @@ public ProjectDto getProject(Long id) throws EntityNotFoundException {
@Override
public List<ProjectDto> getSubProjects(long parentId, int offset, int limit) {
try {
ProjectDto parent = getProject(parentId);
return projectStorage.getSubProjects(parentId, offset, limit);
} catch (Exception ex) {
return new ArrayList<ProjectDto>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -226,17 +226,14 @@ public static ProjectDto projectToDto(Project project, ProjectStorage projectSto
}
ProjectDto projectDto = new ProjectDto();
projectDto.setId(project.getId());
projectDto.setName(project.getName());
projectDto.setName(HTMLSanitizer.sanitize(project.getName()));
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
projectDto.setName(HTMLSanitizer.sanitize(project.getName()));
projectDto.setName(project.getName());

As reminded here:

Please ensure to not workaround the best practice that we adopted since the beginning: don't alter user data when saving , but sanitize the data on display only. If there is an executable JS to purify, please ensure that it's considered here (Html rendering), here (Html rendering) and here (For Email notifs especially)
In other terms, the architectural choice made is: Sanitize OnRead from DB and not altering data OnWrite on DB.
There are centralized Sanitizers, adapt them globally instead of making the modification in each html apart.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@boubaker good catch, fixed here

projectDto.setDescription(project.getDescription());
projectDto.setColor(project.getColor());
projectDto.setDueDate(project.getDueDate());
projectDto.setLastModifiedDate(project.getLastModifiedDate());
projectDto.setParticipator(projectStorage.getParticipator(project.getId()));
projectDto.setManager(projectStorage.getManager(project.getId()));
projectDto.setParent(projectToDto(project.getParent(),projectStorage));
//if(project.getStatus()!=null)projectDto.setStatus(project.getStatus().stream().map(status -> statusToDTO(status,projectStorage)).collect(Collectors.toSet()));

//if(project.getChildren()!=null)projectDto.setChildren(project.getChildren().stream().map(this::projectToDto).collect(Collectors.toList()));
return projectDto;
}

Expand Down
Loading