-
-
Notifications
You must be signed in to change notification settings - Fork 88
[plugin-web-app-to-rest-api] Add steps to check SSL rating using SSL Labs #4361
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Codecov Report
@@ Coverage Diff @@
## master #4361 +/- ##
============================================
- Coverage 97.32% 97.31% -0.01%
- Complexity 6381 6449 +68
============================================
Files 889 895 +6
Lines 18384 18526 +142
Branches 1226 1238 +12
============================================
+ Hits 17892 18029 +137
- Misses 384 387 +3
- Partials 108 110 +2
... and 6 files with indirect coverage changes 📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
vividus-plugin-web-app-to-rest-api/src/main/java/org/vividus/ssllabs/Grade.java
Outdated
Show resolved
Hide resolved
vividus-plugin-web-app-to-rest-api/src/main/java/org/vividus/ssllabs/SSLLabsClient.java
Outdated
Show resolved
Hide resolved
...dus-plugin-web-app-to-rest-api/src/main/java/org/vividus/steps/integration/SSLLabsSteps.java
Outdated
Show resolved
Hide resolved
vividus-plugin-web-app-to-rest-api/src/main/java/org/vividus/ssllabs/SSLLabsClient.java
Outdated
Show resolved
Hide resolved
eeff993
to
5f8088d
Compare
vividus-plugin-web-app-to-rest-api/src/main/java/org/vividus/ssllabs/Grade.java
Outdated
Show resolved
Hide resolved
vividus-plugin-web-app-to-rest-api/src/main/java/org/vividus/ssllabs/SSLLabsClient.java
Outdated
Show resolved
Hide resolved
vividus-plugin-web-app-to-rest-api/src/main/java/org/vividus/ssllabs/SSLLabsClient.java
Outdated
Show resolved
Hide resolved
...dus-plugin-web-app-to-rest-api/src/main/java/org/vividus/steps/integration/SSLLabsSteps.java
Outdated
Show resolved
Hide resolved
...dus-plugin-web-app-to-rest-api/src/main/java/org/vividus/steps/integration/SSLLabsSteps.java
Outdated
Show resolved
Hide resolved
...dus-plugin-web-app-to-rest-api/src/main/java/org/vividus/steps/integration/SSLLabsSteps.java
Outdated
Show resolved
Hide resolved
vividus-plugin-web-app-to-rest-api/src/main/resources/vividus-plugin/spring.xml
Show resolved
Hide resolved
vividus-tests/src/main/resources/story/integration/SSLLabsSteps.story
Outdated
Show resolved
Hide resolved
b17354a
to
141c364
Compare
vividus-plugin-web-app-to-rest-api/src/main/java/org/vividus/ssllabs/SslLabsSteps.java
Outdated
Show resolved
Hide resolved
vividus-plugin-web-app-to-rest-api/src/main/resources/properties/defaults/default.properties
Outdated
Show resolved
Hide resolved
vividus-plugin-web-app-to-rest-api/src/main/java/org/vividus/ssllabs/SslLabsSteps.java
Outdated
Show resolved
Hide resolved
vividus-tests/src/main/resources/story/system/SSLLabsSteps.story
Outdated
Show resolved
Hide resolved
vividus-tests/src/main/resources/story/system/SSLLabsSteps.story
Outdated
Show resolved
Hide resolved
vividus-plugin-web-app-to-rest-api/src/test/java/org/vividus/ssllabs/SslLabsClientTests.java
Outdated
Show resolved
Hide resolved
vividus-plugin-web-app-to-rest-api/src/test/java/org/vividus/ssllabs/SslLabsClientTests.java
Outdated
Show resolved
Hide resolved
ab02155
to
d8c5738
Compare
vividus-plugin-web-app-to-rest-api/src/main/java/org/vividus/ssllabs/SslLabsClient.java
Outdated
Show resolved
Hide resolved
|
||
private Optional<AnalyzeResponse> analyze(String host) | ||
{ | ||
AtomicBoolean sslScanFailed = new AtomicBoolean(false); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
such flags are not good practice, I've started refactoring, but it's not complete yet:
private Optional<HttpResponse> analyze(String host)
{
return WAITER.wait(() -> {
try
{
HttpResponse response = httpClient.doHttpGet(URI.create(
String.format("%s%s%s", sslLabHost, API_VERSION, String.format(ANALYZE_CALL, host))));
return Optional.of(response);
}
catch (IOException e)
{
LOGGER.atError().setCause(e).log("Unable to process request");
return Optional.empty();
}
}, response -> {
if (response.isEmpty())
{
return true;
}
HttpResponse httpResponse = response.get();
int statusCode = httpResponse.getStatusCode();
if (statusCode == HttpStatus.SC_OK)
{
return true;
}
LOGGER.atWarn().addArgument(statusCode).addArgument(httpResponse.getResponseBodyAsString()).log(
"Unexpected status code received: {}\nResponse body: {}");
if (statusCode != TOO_MANY_REQUESTS || statusCode != SERVICE_IS_OVERLOADED
|| statusCode != HttpStatus.SC_SERVICE_UNAVAILABLE)
{
return false;
}
LOGGER.atError().log(SSL_SCAN_FAILURE);
return true;
});
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reworked
Please check new solution
vividus-plugin-web-app-to-rest-api/src/main/java/org/vividus/ssllabs/SslLabsSteps.java
Outdated
Show resolved
Hide resolved
d8c5738
to
163ef74
Compare
vividus-plugin-web-app-to-rest-api/src/test/java/org/vividus/ssllabs/SslLabsClientTests.java
Outdated
Show resolved
Hide resolved
163ef74
to
8298840
Compare
try | ||
{ | ||
HttpResponse response = httpClient.doHttpGet(URI.create( | ||
String.format("%s%s%s", sslLabHost, API_VERSION, String.format(ANALYZE_CALL, host)))); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what if I specify https://api.ssllabs.com/ ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what if I specify https://api.ssllabs.com/ ?
Caused by: java.lang.IllegalArgumentException: URI path begins with multiple slashes
But I'm not sure that users will change the host too often to add processing for such cases
vividus-plugin-web-app-to-rest-api/src/main/java/org/vividus/ssllabs/SslLabsSteps.java
Outdated
Show resolved
Hide resolved
8298840
to
a537725
Compare
No description provided.