Skip to content
Snippets Groups Projects
Commit 3fa815f9 authored by Martin Lowe's avatar Martin Lowe :flag_ca:
Browse files

Merge branch 'malowe/main/157' into 'main'

Iss #157 - Add email obfuscation to the status json return

Closes #157

See merge request !206
parents 25086fc8 58b54112
No related branches found
No related tags found
1 merge request!206Iss #157 - Add email obfuscation to the status json return
Pipeline #52894 passed
......@@ -80,7 +80,7 @@ public class EclipseQuteTemplateExtensions {
* @param email the address to obfuscate
* @return the obfuscated address, or empty string if (the string could not be parsed as an email address.
*/
static String obfuscateEmail(String email) {
public static String obfuscateEmail(String email) {
if (StringUtils.isBlank(email)) {
return "";
}
......
......@@ -15,6 +15,7 @@ import java.util.List;
import org.apache.commons.lang3.StringUtils;
import org.eclipsefoundation.efservices.api.models.Project;
import org.eclipsefoundation.git.eca.config.EclipseQuteTemplateExtensions;
import org.eclipsefoundation.git.eca.dto.CommitValidationStatus;
import org.eclipsefoundation.git.eca.helper.GithubValidationHelper;
import org.eclipsefoundation.git.eca.helper.ProjectHelper;
......@@ -86,7 +87,17 @@ public class StatusResource extends CommonResource {
@GET
@Path("{fingerprint}")
public Response getCommitValidation(@PathParam("fingerprint") String fingerprint) {
return Response.ok(validationStatus.getHistoricValidationStatus(wrapper, fingerprint)).build();
List<CommitValidationStatus> statuses = validationStatus.getHistoricValidationStatus(wrapper, fingerprint);
// for each of the statuses, obfuscate the emails before return
statuses.forEach(s -> {
s.setUserMail(EclipseQuteTemplateExtensions.obfuscateEmail(s.getUserMail()));
s.getErrors().stream().forEach(e -> {
e.setAuthorEmail(EclipseQuteTemplateExtensions.obfuscateEmail(e.getAuthorEmail()));
e.setCommitterEmail(EclipseQuteTemplateExtensions.obfuscateEmail(e.getCommitterEmail()));
});
});
return Response.ok(statuses).build();
}
/**
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment