We have a Java TAF where we log test runs. We use Allure and Report Portal (both). For API calls we use RestAssured.
It is necessary to hide sensitive data. In the requests we should not log headers “Authorization”.
Here is the current solution:
public static RequestSpecification prepareRequest() {
return given()
.filters(
new ReportPortalRestAssuredLoggingFilter(42, LogLevel.INFO)
.setBodyTypeMap(BODY_TYPE_MAP)
.setContentPrettiers(MY_PRETTIERS),
new AllureRestAssured())
.config(RestAssuredConfig.config().logConfig(LogConfig.logConfig().blacklistHeader("Authorization")));
}
It helps us to mask headers “Authorization” in the Allure report. But they still exist in the Report Portal. Please advise on how to mask/hide/remove the header “Authorization” from logs (or, if the report portal does not allow it to hide it is acceptable to remove all headers from logs).
Additional findings:
In documentation (https://github.com/reportportal/logger-java-rest-assured/blob/develop/CHANGELOG.md) they introduced the method ReportPortalRestAssuredLoggingFilter.addRequestFilter() for skipping certain request logging. But I cannot understand how to prepare code with it. Please help to solve the problem.