use of com.mercedesbenz.sechub.sereco.metadata.SerecoWebBody in project sechub by mercedes-benz.
the class AssertVulnerabilities method assertWebRequest.
public static void assertWebRequest(SerecoVulnerability toInspect, SerecoWebRequest expectedRequest) {
SerecoWeb vulnerabilityWeb = toInspect.getWeb();
if (vulnerabilityWeb == null) {
fail("vulnerability web is null!");
}
SerecoWebRequest foundRequest = vulnerabilityWeb.getRequest();
if (!expectedRequest.equals(foundRequest)) {
SerecoWebBody body1 = expectedRequest.getBody();
SerecoWebBody body2 = foundRequest.getBody();
internalAssertEquals(expectedRequest.getHeaders(), foundRequest.getHeaders(), "headers not as expected");
internalAssertEquals(body1, body2, "body not as expected");
fail("not equal but not detectable");
}
}
use of com.mercedesbenz.sechub.sereco.metadata.SerecoWebBody in project sechub by mercedes-benz.
the class SarifV1JSONImporter method handleWebResponse.
private void handleWebResponse(Result result, SerecoWeb serecoWeb) {
SerecoWebResponse serecoReponse = serecoWeb.getResponse();
WebResponse sarifWebResponse = result.getWebResponse();
serecoReponse.setProtocol(sarifWebResponse.getProtocol());
serecoReponse.setVersion(sarifWebResponse.getVersion());
serecoReponse.setReasonPhrase(sarifWebResponse.getReasonPhrase());
serecoReponse.setStatusCode(sarifWebResponse.getStatusCode());
serecoReponse.setNoResponseReceived(sarifWebResponse.isNoResponseReceived());
serecoReponse.getHeaders().putAll(sarifWebResponse.getHeaders());
/* body */
SerecoWebBody serecoWebResponseBody = serecoReponse.getBody();
com.mercedesbenz.sechub.sarif.model.Body sarifWebResponseBody = sarifWebResponse.getBody();
serecoWebResponseBody.setText(sarifWebResponseBody.getText());
serecoWebResponseBody.setBinary(sarifWebResponseBody.getBinary());
}
use of com.mercedesbenz.sechub.sereco.metadata.SerecoWebBody in project sechub by mercedes-benz.
the class SarifV1JSONImporter method handleWebRequest.
private void handleWebRequest(Result result, SerecoWeb serecoWeb) {
SerecoWebRequest serecoWebRequest = serecoWeb.getRequest();
WebRequest sarifWebRequest = result.getWebRequest();
serecoWebRequest.setProtocol(sarifWebRequest.getProtocol());
serecoWebRequest.setVersion(sarifWebRequest.getVersion());
serecoWebRequest.setMethod(sarifWebRequest.getMethod());
serecoWebRequest.setTarget(sarifWebRequest.getTarget());
serecoWebRequest.getHeaders().putAll(sarifWebRequest.getHeaders());
/* body */
SerecoWebBody serecoWebRequestBody = serecoWebRequest.getBody();
com.mercedesbenz.sechub.sarif.model.Body sarifWebRequestBody = sarifWebRequest.getBody();
serecoWebRequestBody.setText(sarifWebRequestBody.getText());
serecoWebRequestBody.setBinary(sarifWebRequestBody.getBinary());
}
use of com.mercedesbenz.sechub.sereco.metadata.SerecoWebBody in project sechub by mercedes-benz.
the class AssertVulnerabilities method assertWebResponse.
public static void assertWebResponse(SerecoVulnerability toInspect, SerecoWebResponse expectedResponse) {
SerecoWeb vulnerabilityWeb = toInspect.getWeb();
if (vulnerabilityWeb == null) {
fail("vulnerability web is null!");
}
SerecoWebResponse foundResponse = vulnerabilityWeb.getResponse();
if (!expectedResponse.equals(foundResponse)) {
SerecoWebBody body1 = expectedResponse.getBody();
SerecoWebBody body2 = foundResponse.getBody();
internalAssertEquals(expectedResponse.getHeaders(), foundResponse.getHeaders(), "headers not as expected");
internalAssertEquals(body1, body2, "body not as expected");
assertEquals("protocol", expectedResponse.getProtocol(), foundResponse.getProtocol());
assertEquals("version", expectedResponse.getVersion(), foundResponse.getVersion());
assertEquals("reasonPhrase", expectedResponse.getReasonPhrase(), foundResponse.getReasonPhrase());
assertEquals("statusCode", expectedResponse.getStatusCode(), foundResponse.getStatusCode());
fail("not equal but not detectable");
}
}
Aggregations