I need to set https://<user>:<password>@xxxxx.com:9200 for my secured elasticsearch cluster and i also konw that we can use anonymize_url when calling logger.xxx().
However, I had found that the message <user>:<password> still could be known from the Traceback.
For Example,
https://github.com/chaoss/grimoirelab-elk/blob/5db69f80e0d436ccf9be2403ae1bf98529337545/grimoire_elk/elastic.py#L181-L182
res = self.requests.put(url + '?refresh=true', data=bulk_json, headers=headers)
res.raise_for_status()
Here, url would be https://<user>:<password>@xxxxx.com:9200.
But if there a wrong status_code in raise_for_status, the messge would be :
https://github.com/psf/requests/blob/1e5fad7433772b648fcbc921e2a79de5c4c6be8b/requests/models.py#L954
http_error_msg = u'%s Client Error: %s for url: %s' % (self.status_code, reason, self.url)
and raise HTTPError with self.url which contains the message <user>:<password>.
Like #309 (comment)
requests.exceptions.HTTPError: 400 Client Error: Bad Request for url: https://XXX:[email protected]:9243/.kibana/doc/dashboard:Overview.
I had tried to use anonymize_url in the method feed_backend in elk.py but the message <user>:<password> still be shown in Traceback
https://github.com/chaoss/grimoirelab-elk/blob/5db69f80e0d436ccf9be2403ae1bf98529337545/grimoire_elk/elk.py#L178
- error_msg = "Error feeding raw from {} ({}): {}".format(backend_name, backend.origin, ex)
+ error_msg = "Error feeding raw from {} ({}): {}".format(backend_name, backend.origin, anonymize_url(str(ex)))
I need to set
https://<user>:<password>@xxxxx.com:9200for my secured elasticsearch cluster and i also konw that we can useanonymize_urlwhen callinglogger.xxx().However, I had found that the message
<user>:<password>still could be known from theTraceback.For Example,
https://github.com/chaoss/grimoirelab-elk/blob/5db69f80e0d436ccf9be2403ae1bf98529337545/grimoire_elk/elastic.py#L181-L182
Here,
urlwould behttps://<user>:<password>@xxxxx.com:9200.But if there a wrong status_code in
raise_for_status, the messge would be :https://github.com/psf/requests/blob/1e5fad7433772b648fcbc921e2a79de5c4c6be8b/requests/models.py#L954
and raise HTTPError with
self.urlwhich contains the message<user>:<password>.Like #309 (comment)
requests.exceptions.HTTPError: 400 Client Error: Bad Request for url: https://XXX:[email protected]:9243/.kibana/doc/dashboard:Overview.I had tried to use
anonymize_urlin the methodfeed_backendinelk.pybut the message<user>:<password>still be shown inTraceback