Skip to content
This repository was archived by the owner on Jul 21, 2025. It is now read-only.
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
14 changes: 14 additions & 0 deletions src/ADOGenerator/Services/ProjectService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2859,3 +2859,17 @@ public bool CheckForInstalledExtensions(string extensionJsonFile, string token,
}
}

public static class Utility
{
public static string SanitizeJson(string json)
{
// Implement sanitization logic to remove or mask sensitive information
// For example, remove password fields
var jsonObject = JObject.Parse(json);
if (jsonObject["password"] != null)
{
jsonObject["password"] = "****";
}
return jsonObject.ToString();
}
}
5 changes: 3 additions & 2 deletions src/RestAPI/Service/ServiceEndPoint.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ public ServiceEndpointModel CreateServiceEndPoint(string json, string project)

using (var client = GetHttpClient())
{
var jsonContent = new StringContent(json, Encoding.UTF8, "application/json");
var sanitizedJson = Utility.SanitizeJson(json);
var jsonContent = new StringContent(sanitizedJson, Encoding.UTF8, "application/json");
var method = new HttpMethod("POST");

var request = new HttpRequestMessage(method, project + "/_apis/distributedtask/serviceendpoints?api-version=" + _configuration.VersionNumber) { Content = jsonContent };
Expand All @@ -47,7 +48,7 @@ public ServiceEndpointModel CreateServiceEndPoint(string json, string project)
}
catch (Exception ex)
{
logger.Debug(DateTime.UtcNow.ToString("yyyy-MM-dd HH:mm:ss") + "\t" + "CreateServiceEndPoint" + "\t" + ex.Message + "\t" + "\n" + ex.StackTrace + "\n");
logger.Debug(DateTime.UtcNow.ToString("yyyy-MM-dd HH:mm:ss") + "\t" + "CreateServiceEndPoint" + "\t" + "An error occurred while creating the service endpoint." + "\n");
}
return new ServiceEndpointModel();
}
Expand Down
Loading