mozilla / minion-zap-plugin

Minion ZAP Plugin
15 stars 8 forks source link

Add basic authentication support to the zap plugin #10

Closed yeukhon closed 11 years ago

yeukhon commented 11 years ago

Sites that send www-authenticate headers will prompt or expect basic auth. Example sites from mozilla are intranet and ldap.

yeukhon commented 11 years ago

I have attempted to do basic authentication via the following code:


from zapv2 import ZAPv2 as zap
z = zap(proxies={'http': 'http'://127.0.0.1:9999'})
z.context.new_context()
z.auth.set_login_url(1, 'http://127.0.0.1:5000/', postdata='username=user&password=pwd')
z.auth.set_login_indicator(1, 'you are logged in')
z.auth.login(1)

But the code will return false.

So postdata submits strings, so apps like Flask cannot regonize that if Flask uses request.authorization which is really the correct method here. Therefore, sites that uses basic auth can't login with postdata either.

It also turns out that, according to @psiinon, the python api doesn't have the proper power to do basic auth either. The two ways possible:

I believe we are after the 2nd method, using profile to perform login.