Is it possible to hide password in url from log?

Hi!

 

I'm fixing an old non-working channel plugin and I have an issue. This channel seems to use Login by GET instead of POST (I really don't know anything about HTTP so I have no idea what the difference is...) which seems to cause the password to be written in system.log. I.e. the password is part of the URL.

 

Is there a way to avoid this from being logged? I.e. the url is like

 

https://loginurl?request=%7B%22Email%22%3A%22myemail%40mail.se%22%2C%22Password%22%3A%22mypassword%22%3A%22%22%7D

 

br

JeppeTh

That really depends on what the website/service you’re logging into will accept. If you can log in via a POST request, then passing the username & password using either the values or data keyword args. They take a dict{} or URL-Encoded string, respectively.
Otherwise, it might be possible to pass the values as base64 encoded. They would still show up in the logs but would at least be obfuscated. That would still depend on the website/service accepting the arguments in that format.

Thx for your reply.


Post doesn’t work, I get method not allowed.


I can try the base64 method. How do I encode it like that the easiest way?

Thx for your reply.

Post doesn't work, I get method not allowed.

I can try the base64 method. How do I encode it like that the easiest way?

If you just want to test it in a browser, you can paste the text into an online encoder like the one at base64encode.org then copy the encoded string into your test URL. The plugin framework provides the String.Encode() method for use in plugin code.

Is the entire url supposed to be encoded like that, or only the query string parameters?


Because www.google.com is encoded into

http://d3d3Lmdvb2dsZS5jb20=

and that doesn’t work from my smartphone at least…

Is the entire url supposed to be encoded like that, or only the query string parameters?

Because www.google.com is encoded into
http://d3d3Lmdvb2dsZS5jb20=
and that doesn't work from my smartphone at least...

Should be just the query string params.

Ok - I tried to take this part
 

%7B%22Email%22%3A%22myemail%40mail.se%22%2C%22Password%22%3A%22mypassword%22%3A%22%22%7D
from
https://loginurl?request={“Email”%3A"myemail%40mail.se"%2C"Password"%3A"mypassword"%3A""}
And encoded it and the placed it after '?'
https://loginurl?
Also tried to only encode the data after '='
https://loginurl?request=
 
But unfortunately none of them the worked out…

I can’t think of any other possible work-arounds.

Ok, thx for the help at least. Would be nice with an Plex option to avoid logging then.


Perhaps I can make some temp solution which copies log before request then renames it back after the request. I.e in that way overwrite the log with password.

Ok, thx for the help at least. Would be nice with an Plex option to avoid logging then.

Perhaps I can make some temp solution which copies log before request then renames it back after the request. I.e in that way overwrite the log with password.

That's all of not much use, if it's not in the log it's still very easy to track the password just by checking the http requests made from the PMS machine.

That's all of not much use, if it's not in the log it's still very easy to track the password just by checking the http requests made from the PMS machine.


Even if it's https? At least it should be as "simple" to track the password from the web interface of the channel I guess.

Is there any nice API etc to get the path to “…Logs\PMS Plugin Logs”?

Is there any nice API etc to get the path to "...Logs\PMS Plugin Logs\"?

Try:
Core.storage.join_path(Core.app_support_path, Core.config.log_files_dir)

Try:
Core.storage.join_path(Core.app_support_path, Core.config.log_files_dir)

Hmm - can't access such class... I need to do some special? Can't import any Core or core either...

Ah, you'll need to set use the "elevated" plugin code policy in your Info.plist file to access those.

PlexPluginCodePolicy
Elevated

Even if it's https? At least it should be as "simple" to track the password from the web interface of the channel I guess.

Yup, https doesn't matter, you can always check what requests are being made.

Ah, you'll need to set use the "elevated" plugin code policy in your Info.plist file to access those.

PlexPluginCodePolicy
Elevated


Is this supposed to work also in ServiceInfo.plist? Since I want it in ServiceCode.pys - and adding this didn't help...

Yup, https doesn't matter, you can always check what requests are being made.

Easier to check from PMS than from Channel Homepage in Browser? Since I didn't manage to see the HTTPS request in wireshark from Browser - but perhaps there are other ways...

Is this supposed to work also in ServiceInfo.plist? Since I want it in ServiceCode.pys - and adding this didn't help...


I couldn't manage it in __init__.py either...

I couldn't manage it in __init__.py either...

Setting the "Elevated" flag in the Info.plist, then you don't need to import anything in the __init__.py. "Core" and other protected framework methods should be available. For example, check out how I use it in the Unsupported Appstore code. I'm not sure if it's possible to access them in ServiceCode. By nature, Services are intended to run in an even smaller sandbox than plugin code. I'll see what I can find out.