Skip to content

Commit 50a88ed

Browse files
[fix]: [CDS-14581]: Revert ExceptionMessageSanitizer changes (#30625)
1 parent a259ac4 commit 50a88ed

46 files changed

Lines changed: 139 additions & 499 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

260-delegate/src/main/java/io/harness/delegate/app/resource/HealthResource.java

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,3 @@
1-
/*
2-
* Copyright 2022 Harness Inc. All rights reserved.
3-
* Use of this source code is governed by the PolyForm Free Trial 1.0.0 license
4-
* that can be found in the licenses directory at the root of this repository, also available at
5-
* https://polyformproject.org/wp-content/uploads/2020/05/PolyForm-Free-Trial-1.0.0.txt.
6-
*/
7-
81
package io.harness.delegate.app.resource;
92

103
import static io.harness.annotations.dev.HarnessTeam.DEL;
@@ -54,4 +47,4 @@ public ResponseDTO<String> get() throws Exception {
5447
}
5548
throw new HealthException(check.getMessage(), check.getError());
5649
}
57-
}
50+
}

260-delegate/src/main/java/software/wings/delegatetasks/azure/common/ArtifactDownloaderService.java

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,3 @@
1-
/*
2-
* Copyright 2022 Harness Inc. All rights reserved.
3-
* Use of this source code is governed by the PolyForm Free Trial 1.0.0 license
4-
* that can be found in the licenses directory at the root of this repository, also available at
5-
* https://polyformproject.org/wp-content/uploads/2020/05/PolyForm-Free-Trial-1.0.0.txt.
6-
*/
7-
81
package software.wings.delegatetasks.azure.common;
92

103
import static io.harness.annotations.dev.HarnessTeam.CDP;

260-delegate/src/main/java/software/wings/delegatetasks/azure/common/ArtifactDownloaderServiceLogWrapper.java

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,3 @@
1-
/*
2-
* Copyright 2022 Harness Inc. All rights reserved.
3-
* Use of this source code is governed by the PolyForm Free Trial 1.0.0 license
4-
* that can be found in the licenses directory at the root of this repository, also available at
5-
* https://polyformproject.org/wp-content/uploads/2020/05/PolyForm-Free-Trial-1.0.0.txt.
6-
*/
7-
81
package software.wings.delegatetasks.azure.common;
92

103
import static io.harness.annotations.dev.HarnessTeam.CDP;

260-delegate/src/main/java/software/wings/delegatetasks/azure/common/AutoCloseableWorkingDirectory.java

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,3 @@
1-
/*
2-
* Copyright 2022 Harness Inc. All rights reserved.
3-
* Use of this source code is governed by the PolyForm Free Trial 1.0.0 license
4-
* that can be found in the licenses directory at the root of this repository, also available at
5-
* https://polyformproject.org/wp-content/uploads/2020/05/PolyForm-Free-Trial-1.0.0.txt.
6-
*/
7-
81
package software.wings.delegatetasks.azure.common;
92

103
import static io.harness.azure.model.AzureConstants.UNIX_SEPARATOR;

260-delegate/src/main/java/software/wings/delegatetasks/azure/common/AzureContainerRegistryService.java

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,3 @@
1-
/*
2-
* Copyright 2022 Harness Inc. All rights reserved.
3-
* Use of this source code is governed by the PolyForm Free Trial 1.0.0 license
4-
* that can be found in the licenses directory at the root of this repository, also available at
5-
* https://polyformproject.org/wp-content/uploads/2020/05/PolyForm-Free-Trial-1.0.0.txt.
6-
*/
7-
81
package software.wings.delegatetasks.azure.common;
92

103
import static io.harness.annotations.dev.HarnessTeam.CDP;

260-delegate/src/main/java/software/wings/delegatetasks/azure/common/context/ArtifactDownloaderContext.java

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,3 @@
1-
/*
2-
* Copyright 2022 Harness Inc. All rights reserved.
3-
* Use of this source code is governed by the PolyForm Free Trial 1.0.0 license
4-
* that can be found in the licenses directory at the root of this repository, also available at
5-
* https://polyformproject.org/wp-content/uploads/2020/05/PolyForm-Free-Trial-1.0.0.txt.
6-
*/
7-
81
package software.wings.delegatetasks.azure.common.context;
92

103
import static io.harness.annotations.dev.HarnessTeam.CDP;

260-delegate/src/main/java/software/wings/delegatetasks/azure/common/validator/ArtifactTypeSubset.java

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,3 @@
1-
/*
2-
* Copyright 2022 Harness Inc. All rights reserved.
3-
* Use of this source code is governed by the PolyForm Free Trial 1.0.0 license
4-
* that can be found in the licenses directory at the root of this repository, also available at
5-
* https://polyformproject.org/wp-content/uploads/2020/05/PolyForm-Free-Trial-1.0.0.txt.
6-
*/
7-
81
package software.wings.delegatetasks.azure.common.validator;
92

103
import static java.lang.annotation.ElementType.ANNOTATION_TYPE;

260-delegate/src/main/java/software/wings/delegatetasks/azure/common/validator/ArtifactTypeSubsetValidator.java

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,3 @@
1-
/*
2-
* Copyright 2022 Harness Inc. All rights reserved.
3-
* Use of this source code is governed by the PolyForm Free Trial 1.0.0 license
4-
* that can be found in the licenses directory at the root of this repository, also available at
5-
* https://polyformproject.org/wp-content/uploads/2020/05/PolyForm-Free-Trial-1.0.0.txt.
6-
*/
7-
81
package software.wings.delegatetasks.azure.common.validator;
92

103
import software.wings.utils.ArtifactType;

260-delegate/src/main/java/software/wings/delegatetasks/helm/HelmValuesFetchTask.java

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -31,11 +31,9 @@
3131
import io.harness.delegate.task.AbstractDelegateRunnableTask;
3232
import io.harness.delegate.task.TaskParameters;
3333
import io.harness.logging.CommandExecutionStatus;
34-
import io.harness.secret.SecretSanitizerThreadLocal;
3534

3635
import software.wings.beans.command.ExecutionLogCallback;
3736
import software.wings.delegatetasks.DelegateLogService;
38-
import software.wings.delegatetasks.ExceptionMessageSanitizer;
3937
import software.wings.helpers.ext.helm.request.HelmChartConfigParams;
4038
import software.wings.helpers.ext.helm.request.HelmValuesFetchTaskParameters;
4139
import software.wings.helpers.ext.helm.response.HelmValuesFetchTaskResponse;
@@ -59,7 +57,6 @@ public class HelmValuesFetchTask extends AbstractDelegateRunnableTask {
5957
public HelmValuesFetchTask(DelegateTaskPackage delegateTaskPackage, ILogStreamingTaskClient logStreamingTaskClient,
6058
Consumer<DelegateTaskResponse> consumer, BooleanSupplier preExecute) {
6159
super(delegateTaskPackage, logStreamingTaskClient, consumer, preExecute);
62-
SecretSanitizerThreadLocal.addAll(delegateTaskPackage.getSecrets());
6360
}
6461

6562
@Override
@@ -92,13 +89,12 @@ public HelmValuesFetchTaskResponse run(TaskParameters parameters) {
9289
.mapK8sValuesLocationToContent(mapK8sValuesLocationToContent)
9390
.build();
9491
} catch (Exception e) {
95-
Exception sanitizedException = ExceptionMessageSanitizer.sanitizeException(e);
96-
log.error("HelmValuesFetchTask execution failed with exception ", sanitizedException);
97-
executionLogCallback.saveExecutionLog(sanitizedException.getMessage(), ERROR, CommandExecutionStatus.FAILURE);
92+
log.error("HelmValuesFetchTask execution failed with exception ", e);
93+
executionLogCallback.saveExecutionLog(e.getMessage(), ERROR, CommandExecutionStatus.FAILURE);
9894

9995
return HelmValuesFetchTaskResponse.builder()
10096
.commandExecutionStatus(FAILURE)
101-
.errorMessage("Execution failed with Exception: " + sanitizedException.getMessage())
97+
.errorMessage("Execution failed with Exception: " + e.getMessage())
10298
.build();
10399
}
104100
}

260-delegate/src/main/java/software/wings/delegatetasks/k8s/K8sTask.java

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,7 @@
2929
import io.harness.k8s.K8sGlobalConfigService;
3030
import io.harness.k8s.model.K8sDelegateTaskParams;
3131
import io.harness.logging.CommandExecutionStatus;
32-
import io.harness.secret.SecretSanitizerThreadLocal;
3332

34-
import software.wings.delegatetasks.ExceptionMessageSanitizer;
3533
import software.wings.delegatetasks.k8s.taskhandler.K8sTaskHandler;
3634
import software.wings.helpers.ext.container.ContainerDeploymentDelegateHelper;
3735
import software.wings.helpers.ext.k8s.request.K8sTaskParameters;
@@ -56,7 +54,6 @@ public class K8sTask extends AbstractDelegateRunnableTask {
5654
public K8sTask(DelegateTaskPackage delegateTaskPackage, ILogStreamingTaskClient logStreamingTaskClient,
5755
Consumer<DelegateTaskResponse> consumer, BooleanSupplier preExecute) {
5856
super(delegateTaskPackage, logStreamingTaskClient, consumer, preExecute);
59-
SecretSanitizerThreadLocal.addAll(delegateTaskPackage.getSecrets());
6057
}
6158

6259
@Override
@@ -75,12 +72,11 @@ public K8sTaskExecutionResponse run(TaskParameters parameters) {
7572
return k8sCommandTaskTypeToTaskHandlerMap.get(k8sTaskParameters.getCommandType().name())
7673
.executeTask(k8sTaskParameters, null);
7774
} catch (Exception ex) {
78-
Exception sanitizedException = ExceptionMessageSanitizer.sanitizeException(ex);
7975
log.error("Exception in processing K8s task [{}]",
80-
k8sTaskParameters.getCommandName() + ":" + k8sTaskParameters.getCommandType(), sanitizedException);
76+
k8sTaskParameters.getCommandName() + ":" + k8sTaskParameters.getCommandType(), ex);
8177
return K8sTaskExecutionResponse.builder()
8278
.commandExecutionStatus(CommandExecutionStatus.FAILURE)
83-
.errorMessage(ExceptionUtils.getMessage(sanitizedException))
79+
.errorMessage(ExceptionUtils.getMessage(ex))
8480
.build();
8581
}
8682
} else {
@@ -118,12 +114,11 @@ public K8sTaskExecutionResponse run(TaskParameters parameters) {
118114
return k8sCommandTaskTypeToTaskHandlerMap.get(k8sTaskParameters.getCommandType().name())
119115
.executeTask(k8sTaskParameters, k8SDelegateTaskParams);
120116
} catch (Exception ex) {
121-
Exception sanitizedException = ExceptionMessageSanitizer.sanitizeException(ex);
122117
log.error("Exception in processing K8s task [{}]",
123-
k8sTaskParameters.getCommandName() + ":" + k8sTaskParameters.getCommandType(), sanitizedException);
118+
k8sTaskParameters.getCommandName() + ":" + k8sTaskParameters.getCommandType(), ex);
124119
return K8sTaskExecutionResponse.builder()
125120
.commandExecutionStatus(CommandExecutionStatus.FAILURE)
126-
.errorMessage(ExceptionUtils.getMessage(sanitizedException))
121+
.errorMessage(ExceptionUtils.getMessage(ex))
127122
.build();
128123
} finally {
129124
cleanup(workingDirectory);
@@ -136,7 +131,7 @@ private void logK8sVersion(K8sTaskParameters k8sTaskParameters, K8sDelegateTaskP
136131
k8sCommandTaskTypeToTaskHandlerMap.get(K8sTaskType.VERSION.name())
137132
.executeTask(k8sTaskParameters, k8sDelegateTaskParams);
138133
} catch (Exception ex) {
139-
log.error("Error fetching K8s Server Version: ", ExceptionMessageSanitizer.sanitizeException(ex));
134+
log.error("Error fetching K8s Server Version: ", ex);
140135
}
141136
}
142137

@@ -145,7 +140,7 @@ private void cleanup(String workingDirectory) {
145140
log.warn("Cleaning up directory " + workingDirectory);
146141
deleteDirectoryAndItsContentIfExists(workingDirectory);
147142
} catch (Exception ex) {
148-
log.warn("Exception in directory cleanup.", ExceptionMessageSanitizer.sanitizeException(ex));
143+
log.warn("Exception in directory cleanup.", ex);
149144
}
150145
}
151146
}

0 commit comments

Comments
 (0)