可以通过OWASP ZAP测试rest-api吗?要攻击的Url仅适用于GET请求。

例如,我的api控制器只使用token。我有TokenController和这个控制器需要通过JSON的POST数据,包括密码和登录数据。我可以通过OWASP来测试这个控制器吗?
发布于 2018-08-06 19:26:09
简短的回答是肯定的。答案很长--这很复杂:)
测试REST API比测试web API要难一些--你必须给Zap提供关于你的API的信息--它有哪些端点,参数等等。你能分享更多关于你的API的信息吗?它有OpenAPI/Swagger文档吗?你有现成的测试吗?您可以使用其中任何一个来执行此任务。
我做了一个关于如何实现这一点的演讲--你可以找到录音here。
发布于 2019-09-14 02:44:39
使用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://stackoverflow.com/questions/51706298
复制相似问题