How to access proxy user from inline script

I’m running mitmdump with the nonanonymous flag enabled. I’m trying to get the value of the proxy username which is stored in the self.username variable that’s defined in the BasicProxyAuth class:

I’ve tried tracing the code, and looking at the events available to inline scripts:

I’ve tried looking at the clientconnect and request events, and I just haven’t been able to find the data I need.

Any help would be appreciated.

Hi @AnalogJ,

looks like there is indeed no good way to do this at the moment - we clean the headers here before passing the request to the inline script. I’d be happy to accept a PR that keeps the authentication at this place but moves the cleaning part below the process_request_hook call! :slight_smile: