无法发送 zap-api-scan.py 的自定义标头,标头在 options.prop 中声明
我想使用 zap 扫描需要授权和 X-api-key 标头的 REST API 端点。
为了指定标头,我已在 options.prop 文件中配置了这些。
但是当我跑步时
docker run -v $(pwd):/zap/wrk/:rw -t owasp/zap2docker-weekly zap-api-scan.py -t
我觉得道具文件没有被选中。我收到 401 错误,因为我的授权令牌未被获取。
下面是我的 options.prop 文件的样子
replacer.full_list(0).description=Authorization
replacer.full_list(0).enabled=true replacer.full_list(0).matchtype=REQ_HEADER
replacer.full_list(0).matchstr=Authorization
replacer.full_list(0).regex=false
replacer.full_list(0).replacement=<Token>
replacer.full_list(1).description=x-api-key
replacer.full_list(1).enabled=true
replacer.full_list(1).matchtype=REQ_HEADER
replacer.full_list(1).matchstr=x-api-key
replacer.full_list(1).regex=false
replacer.full_list(1).replacement=<Value>
您可以使用此格式添加“option.prop”:
replacer.full_list(0).description=Authorization_Basic
replacer.full_list(0).enabled=true
replacer.full_list(0).matchtype=REQ_HEADER
replacer.full_list(0).matchstr=Authorization
replacer.full_list(0).regex=false
replacer.full_list(0).replacement=<your_value>
欲了解更多详情: https://groups.google.com/g/zaproxy-users/c/Db07FvKUdCU/m/OOykkPr2AwAJ https://www.zaproxy.org/faq/how-do-you-find-out-what-key-to-use-to-set-a-config-value-on-the-command-line/ https://www.zaproxy.org/blog/2017-06-19-scanning-apis-with-zap/#authentication