Reputation: 309
I'm using RestAssured for API testing, and I've implemented a logging filter to integrate with Report Portal and Allure. I've configured it to blacklist sensitive headers like x-key to prevent them from being logged. However, I'm still seeing this header in the logs on Report Portal.
Here’s a snippet of my code:
public static RequestSpecification prepareRequest() {
return given()
.filters(
new ReportPortalRestAssuredLoggingFilter(42, LogLevel.INFO,
SanitizingHttpHeaderConverter.INSTANCE,
DefaultHttpHeaderConverter.INSTANCE)
.setBodyTypeMap(BODY_TYPE_MAP),
new AllureRestAssured())
.config(RestAssuredConfig.config().logConfig(LogConfig.logConfig().blacklistHeader("x-key")));
}
// Example API call
response = prepareRequest()
.config(setConnectionTimeout())
.header("Content-Type", "application/json")
.headers("x-key", myKey())
.body(requestPayload.toString())
.post(baseURL)
.andReturn();
Issue: Despite blacklisting the x-key header, it still appears in the logs on Report Portal. I expected that the header would be excluded from the logged output due to the blacklist configuration.
Questions: Is the blacklist functionality in RestAssured correctly implemented for use with Report Portal? How can I ensure that sensitive headers do not appear in the Report Portal logs? Are there alternative approaches to securely handle and log sensitive headers while using RestAssured and Report Portal?
Upvotes: 0
Views: 36