[英]Passing config values to OWASP ZAP rest api script as a file: format?
[英]Owasp Zap Testing rest api
简短的回答是肯定的。 答案很长 - 很复杂:)
测试REST API比测试Web API有点困难 - 您必须提供有关您的API的Zap信息 - 它具有哪些端点,参数等。您能分享更多关于API的信息吗? 它有OpenAPI / Swagger文件吗? 你有现有的测试吗? 您可以使用其中任何一个执行此任务。
我谈到了如何实现这一点 - 你可以在这里找到录音。
可以使用OWASP ZAP自动化API testint,但是为了执行测试,我看到两个选项:提供一些使用模式,例如OpenAPI for ZAP考虑提取信息。 第二种选择是运行自动测试以将ZAP捕获为被动扫描信息,之后您可以测试会话信息。
我们建议使用OpenAPI文档。 黄瓜测试看起来像这样:
Feature: Security
This feature is to test pokemon service security
Scenario: Validate passive and active scan
Given I import context from open API specification "/v2/api-docs"
And I remove alerts
| url |
| http://.*/v2/api-docs* |
And I import scan policy "javaclean" from file "javaclean.policy"
When I run active scan
And I generate security test HTML report with name "java-clean-security-report"
Then the number of risks per category should not be greater than
| low | medium | high | informational |
| 0 | 0 | 0 | 0 |
我是ZAP的开发步骤,在GitHub中查看: https : //github.com/osvaldjr/easy-cucumber/wiki/Security-steps
导入OpenAPI文档的示例步骤:
@Given("^I import context from open API specification \"([^\"]*)\"$")
public void iImportContextFromOpenAPISpecification(String path)
throws ClientApiException, InterruptedException {
String url = getTargetUrl() + path;
log.info("Import Open API from url: " + url);
zapProxyApi.openapi.importUrl(url, null);
waitPassiveScanRunning();
verifyThatTheProxyHasCapturedHostInformation();
}
查看其他步骤: https : //github.com/osvaldjr/easy-cucumber/blob/master/src/main/java/io/github/osvaldjr/stepdefinitions/steps/SecuritySteps.java
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.