-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
In case the macAddres is nos available, at least take the username trying to identify the user/machine #984
base: release-3.24.12.1
Are you sure you want to change the base?
Conversation
I'm not sure I agree with this approach. Getting the username of a machine has some privacy concerns asociated. I think it would be better to leave it at "Anonymous" in such case instead of returning a username. |
We dont collect the userName because we hasheasmos. The code tries to manage the machines that we can not collect the macAddres but we need a ID (trying to avoid a lot of anonymous that we handle as just one user) |
installer/api.py
Outdated
if userName is None or not userName: | ||
userName = 'Unknow' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as previous comment, only one condition.
Also: why "Unknown"? Now we have both "Anonymous" and "Unknown", i'd stick to only having one of them.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Edit 2: In case unknown is left, there is a typo, "UnknowN"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because we can hunt more casuistic.
Anonymous for users that havent macAddres
Unknown for users without macAddres and without username.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But I don't really see the point of having a unique hashed id for non-existing mac address and non-existing username:
The way it is now:
- mac == None --> mac = "Anonymous"
- user == None --> user = "Unknown"
- identifier = mac + user = "AnonymousUnknown"
- hash(identifier) = 3719hd01ncbuebvn09d1m
So, users with no username and no mac address won't show up as "Anonymous" or "Unknown", but instead with a non human-readable id resulting on the hash.
On the other hand:
- mac == "ff:ff:ff" --> mac = "ff:ff:ff"
- user == myuser --> user = "myuser"
- identifier = "ff:ff:ffmyuser"
- hash(identifier) = tevcbijsncaosnu183802cnjc
With this code, two users in the same machine will have different ids.
I'd suggest to only get the username when no mac address is found, and return "Anonymous", if neither of them exists. So:
- If mac address exists, only use mac adress
- If mac address dos not exist, only use username
- If none exist, return "Anonymous"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
By the way. Insead of doing:
status, output = runJobe("whoami")
if status == 0:
return output
You could just:
import getpass
return getpass.getuser()
It is standard Python library, no need to install anything else, and it works in mostly all OSs.
https://docs.python.org/3.8/library/getpass.html
Or even if you want it to work on ALL OSs, you can just:
try:
return getpass.getuser()
except KeyError, OSError: # From Python >= 3.13, only OSError can be returned, so KeyError could be removed
return "Anonymous"
|
Lets wait until we collect more details about the installations and the possible errors in the posting |
No description provided.