Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DTS-37340 Develop : codeql log injection issue fix for Marriott #1064

Open
wants to merge 45 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 5 commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
b417959
DTS-37340 test log user input sanitize for codeql
Jun 7, 2024
47e7078
DTS-37340 test log user input sanitize for codeql
Jun 7, 2024
a3a2444
DTS-37340 test log user input sanitize for codeql
Jun 7, 2024
9ad16fc
DTS-37340 test for access request class
Jun 7, 2024
ae23ded
Merge pull request #1060 from PublicisSapient/DTS-37340-codeql-logInj…
rapkalya Jun 10, 2024
fbf7e19
DTS-37340 for new code
Jun 10, 2024
5b4ffad
DTS-37340 ProjectToolConfigController
Jun 10, 2024
32cccd5
DTS-37340 AccessRequestsController security fix
Jun 10, 2024
157c5cf
DTS-37340 KPIHelperUtil security fix
Jun 10, 2024
c5110b9
Merge pull request #1061 from PublicisSapient/DTS-37340-codeql-logInj…
hirbabar Jun 10, 2024
f56720d
DTS-37340 SignupRequestsController security fix
Jun 10, 2024
94b64a7
DTS-37340 RolesController security fix
Jun 10, 2024
0090cd5
DTS-37340 ConnectionController security fix
Jun 10, 2024
335eab2
DTS-37340 ForgotPasswordController security fix
Jun 10, 2024
9c53648
DTS-37340 FieldMappingStructureController security fix
Jun 10, 2024
f833b0d
DTS-37340 CommentsServiceImpl logs removed
Jun 10, 2024
408bfa4
DTS-37340 KPIExcelDataController logs removed
Jun 10, 2024
dc2556a
DTS-37340 KpiRequest requestTrackerId sanitize
Jun 10, 2024
5e6fb62
Merge pull request #1066 from PublicisSapient/DTS-37340-codeql-logInj…
hirbabar Jun 10, 2024
d5f9b0d
DTS-37340 SprintTraceLogServiceImp sanitize
Jun 10, 2024
129768b
DTS-37340 SprintTraceLogServiceImp sanitize
Jun 10, 2024
d9b6b57
DTS-37340 BambooController sanitize
Jun 10, 2024
aa3fb71
DTS-37340 log removed
Jun 10, 2024
1fda440
DTS-37340 AzureToolConfigServiceImpl sanitise
Jun 10, 2024
dea16d7
DTS-37340 KPIrequest remove logs
Jun 11, 2024
a17edbc
Merge pull request #1070 from PublicisSapient/DTS-37340-codeql-logInj…
hirbabar Jun 11, 2024
1937b12
DTS-37340 KPI request related remove logs
Jun 11, 2024
9c82f40
DTS-37340 sanitity method apply
Jun 11, 2024
8277c7c
DTS-37340 sanitity method apply
Jun 11, 2024
a5bdb19
Merge pull request #1081 from PublicisSapient/DTS-37340-codeql-logInj…
hirbabar Jun 11, 2024
5f14761
DTS-37340 removed logs
Jun 11, 2024
c3a5cb4
Merge pull request #1084 from PublicisSapient/DTS-37340-codeql-logInj…
hirbabar Jun 11, 2024
cdddccd
DTS-37340 removed logs
Jun 11, 2024
7e7698d
Merge pull request #1087 from PublicisSapient/DTS-37340-codeql-logInj…
gipathak Jun 12, 2024
1b7fa33
fix review comment and added testcase
Jun 13, 2024
a5d2b7f
Merge pull request #1099 from PublicisSapient/DTS-37340-codeql-logInj…
hirbabar Jun 13, 2024
88ad289
Marriot security issues
aksshriv1 Jul 7, 2024
9d5e088
Marriot security issues fix
aksshriv1 Jul 7, 2024
f37445a
issue fix
aksshriv1 Jul 8, 2024
568a80b
SSRF issue fix
aksshriv1 Jul 8, 2024
8abbcf2
SSRF issue fix
aksshriv1 Jul 8, 2024
e1827a0
SSRF issue fix 1
aksshriv1 Jul 8, 2024
29e07ff
SSRF issue fix 1
aksshriv1 Jul 8, 2024
3dbb176
SSRF issue fix 2
aksshriv1 Jul 8, 2024
c61613a
Merge pull request #1186 from PublicisSapient/DTS-38320
aksshriv1 Jul 9, 2024
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 @@ -100,6 +100,7 @@
@GetMapping(value = "/{id}")
@PreAuthorize("hasPermission(null,'GET_ACCESS_REQUEST')")
public ResponseEntity<ServiceResponse> getAccessRequestById(@PathVariable("id") String id) {

log.info("Getting request@{}", id);
return ResponseEntity.status(HttpStatus.OK).body(accessRequestsHelperService.getAccessRequestById(id));
}
Expand All @@ -114,6 +115,7 @@
@GetMapping(value = "/user/{username}")
@PreAuthorize("hasPermission(#username,'GET_ACCESS_REQUESTS_OF_USER')")
public ResponseEntity<ServiceResponse> getAccessRequestByUsername(@PathVariable("username") String username) {
CommonUtils.sanitizeUserInput(username);
log.info("Getting all requests under user {}", username);
return ResponseEntity.status(HttpStatus.OK)
.body(accessRequestsHelperService.getAccessRequestByUsername(username));
Expand All @@ -129,6 +131,7 @@
@GetMapping(value = "/status/{status}")
@PreAuthorize("hasPermission(#status,'ACCESS_REQUEST_STATUS')")
public ResponseEntity<ServiceResponse> getAccessRequestByStatus(@PathVariable("status") String status) {
CommonUtils.sanitizeUserInput(status);
log.info("Getting all requests with current status {}", status);
return ResponseEntity.status(HttpStatus.OK).body(accessRequestsHelperService.getAccessRequestByStatus(status));
}
Expand All @@ -148,7 +151,7 @@
@Valid @RequestBody AccessRequestDecision accessRequestDecision) {

ServiceResponse[] serviceResponse = new ServiceResponse[1];

CommonUtils.sanitizeUserInput(id);
if (Constant.ACCESS_REQUEST_STATUS_APPROVED.equalsIgnoreCase(accessRequestDecision.getStatus())) {
log.info("Approve access {}", id);

Expand Down Expand Up @@ -229,9 +232,8 @@
*/
@DeleteMapping("/{id}")
public ResponseEntity<ServiceResponse> deleteAccessRequestById(@PathVariable("id") String id) {
log.info("request received for deleting access request with id @{}", id);

id = CommonUtils.handleCrossScriptingTaintedValue(id);
log.info("request received for deleting access request with id @{}", id);
Fixed Show fixed Hide fixed
ServiceResponse response = null;

if (projectAccessManager.deleteAccessRequestById(id)) {
Expand All @@ -255,6 +257,7 @@
@RequestMapping(value = "/{status}/notification", method = RequestMethod.GET, consumes = MediaType.APPLICATION_JSON_VALUE, produces = MediaType.APPLICATION_JSON_VALUE) // NOSONAR
public ResponseEntity<ServiceResponse> getNotificationByStatus(@PathVariable("status") String status,
HttpServletRequest request) {
CommonUtils.sanitizeUserInput(status);
log.info("Getting requests count with current status {}", status);
return ResponseEntity.status(HttpStatus.OK)
.body(accessRequestsHelperService.getNotificationByStatus(status , false));
Expand All @@ -271,6 +274,7 @@
@RequestMapping(value = "/{status}/notification/central", method = RequestMethod.GET, consumes = MediaType.APPLICATION_JSON_VALUE, produces = MediaType.APPLICATION_JSON_VALUE) // NOSONAR
public ResponseEntity<ServiceResponse> getNotificationByStatusForCentral(@PathVariable("status") String status,
HttpServletRequest request) {
CommonUtils.sanitizeUserInput(status);
log.info("Getting requests count with current status {}", status);
return ResponseEntity.status(HttpStatus.OK)
.body(accessRequestsHelperService.getNotificationByStatus(status , true));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
import java.util.stream.Stream;
import java.util.stream.StreamSupport;

import com.publicissapient.kpidashboard.apis.util.CommonUtils;
import org.apache.commons.collections4.CollectionUtils;
import org.bson.types.ObjectId;
import org.modelmapper.ModelMapper;
Expand Down Expand Up @@ -680,7 +681,7 @@ public UserBoardConfigDTO saveUserBoardConfig(UserBoardConfigDTO userBoardConfig
public void deleteUser(String userName) {
log.info("UserBoardConfigServiceImpl::deleteUser start");
userBoardConfigRepository.deleteByUsername(userName);
log.info(userName + " deleted Successfully from user_board_config");
log.info(CommonUtils.sanitizeUserInput(userName) + " deleted Successfully from user_board_config");
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@
import org.springframework.http.HttpHeaders;
import org.springframework.web.util.UriComponentsBuilder;

import com.publicissapient.kpidashboard.apis.auth.AuthProperties;
import com.publicissapient.kpidashboard.apis.constant.Constant;
import com.publicissapient.kpidashboard.apis.enums.KPISource;
import com.publicissapient.kpidashboard.apis.model.SymbolValueUnit;
Expand All @@ -60,6 +59,7 @@
*/
@Slf4j
public final class CommonUtils {
private static final Pattern ALPHANUMERIC_PATTERN = Pattern.compile("[^a-zA-Z0-9]");

public static final int FIFTH_DAY_OF_WEEK = 5;

Expand Down Expand Up @@ -581,4 +581,8 @@ public static String getAPIEndPointURL(String centralAuthEndPoint, String resour
}

// -- auth-N-auth changes ends here ------
public static String sanitizeUserInput(String input) {
return ALPHANUMERIC_PATTERN.matcher(input).replaceAll("");
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -256,17 +256,18 @@
}

if (null == root) {
throw new ApplicationException(KpiRequest.class, "kpiRequestTrackerId", kpiRequest.getRequestTrackerId());
throw new ApplicationException(KpiRequest.class, "kpiRequestTrackerId", CommonUtils.sanitizeUserInput(kpiRequest.getRequestTrackerId()));
}
if (kpiRequest.getRequestTrackerId().matches("\\w*")) {
log.debug("[CREATED-TREE][{}]. Tree created from nodes {}", kpiRequest.getRequestTrackerId(), root);
Fixed Show fixed Hide fixed
}

log.debug("[CREATED-TREE][{}]. Tree created from nodes {}", kpiRequest.getRequestTrackerId(), root);

List<Node> leafNodeList = new ArrayList<>();
List<Node> projectNodeList = new ArrayList<>();
getLeafNodes(root, leafNodeList);
getProjectNodes(root, projectNodeList);

log.debug("[LEAF_NODES][{}]. Leaf nodes of the tree {}", kpiRequest.getRequestTrackerId(), leafNodeList);
log.debug("[LEAF_NODES][{}]. Leaf nodes of the tree {}", CommonUtils.sanitizeUserInput(kpiRequest.getRequestTrackerId()), leafNodeList);

Map<String, List<Node>> result = leafNodeList.stream().distinct()
.collect(Collectors.groupingBy(Node::getGroupName, Collectors.toList()));
Expand Down