northstack / northstack-client

NorthStack Client
https://northstack.com
GNU General Public License v3.0
7 stars 1 forks source link

Get the low-hanging fruit of sensitive data out of the debug log #49

Closed mm-pagely closed 5 years ago

mm-pagely commented 5 years ago

Copy request objects and sanitize some well-known sensitive data before passing them through to the logging context:

 $ DEBUG=1 northstack auth:login user@org.com
[2018-11-21 10:11:53] [debug] Using default workdir (/home/michaelm/ns-test); set $NS_PWD to override
[2018-11-21 10:11:53] [debug] Running in DEV mode
Password: 
[2018-11-21 18:11:58] CLI.DEBUG: API Request: POST https://api.northstack.com/auth/access_token {"api":"auth","request":"POST /auth/access_token HTTP/1.1\r\nContent-Length: 77\r\nUser-Agent: GuzzleHttp/6.3.3 curl/7.61.1 PHP/7.2.11\r\nContent-Type: application/x-www-form-urlencoded\r\nHost: api.northstack.com\r\n\r\nclient_id=org&username=user%40org.com&password=REDACTED&grant_type=org_password","uri":"[object] (GuzzleHttp\\Psr7\\Uri: https://api.northstack.com/auth/access_token)","method":"POST"} []
[2018-11-21 18:11:59] CLI.DEBUG: API Response: POST https://api.northstack.com/auth/access_token = 200 {"api":"auth","code":200,"uri":"[object] (GuzzleHttp\\Psr7\\Uri: https://api.northstack.com/auth/access_token)","method":"POST"} []
Logged in

sanitizeResponse() is just a no-op for now