Skip to content
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

Web: Clarify that OS.get_unique_id is not supported #82441

Merged
merged 1 commit into from
Oct 2, 2023

Conversation

akien-mga
Copy link
Member

Remove the base error message in OS, we no longer really error out this way for not implemented methods. Instead, each platform should override them to provide the context they want.

Fixes #82439.

Remove the base error message in `OS`, we no longer really error out this
way for not implemented methods. Instead, each platform should override them
to provide the context they want.

Fixes godotengine#82439.
@akien-mga akien-mga added enhancement platform:web topic:porting cherrypick:3.x Considered for cherry-picking into a future 3.x release labels Sep 27, 2023
@akien-mga akien-mga added this to the 4.2 milestone Sep 27, 2023
@akien-mga akien-mga requested a review from Faless September 27, 2023 13:18
@akien-mga akien-mga requested review from a team as code owners September 27, 2023 13:18
@@ -449,7 +449,7 @@
<description>
Returns a string that is unique to the device.
[b]Note:[/b] This string may change without notice if the user reinstalls/upgrades their operating system or changes their hardware. This means it should generally not be used to encrypt persistent data as the data saved before an unexpected ID change would become inaccessible. The returned string may also be falsified using external programs, so do not rely on the string returned by [method get_unique_id] for security purposes.
[b]Note:[/b] Returns an empty string on Web, as this method isn't implemented on this platform yet.
[b]Note:[/b] Returns an empty string and prints an error on Web, as this method cannot be implemented on this platform.
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's my understanding at least, please confirm @Faless.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indeed, or at least, no intended way to do this.
User/Device fingerprinting is detrimental for privacy, so web browsers actively fight against it.
There a bunch of known fingerprinting techniques (see e.g. Canvas fingerprinting), but none of those are there on purpose, and might be mitigated by browsers in the future (to the point of breaking your app).
The way I see it, the only "proper" way to implement this, would be to randomly generate an ID, and store it in local storage / cookie / etc.
The ID will change if the user delete local storage and will be always different when using a private window.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The way I see it, the only "proper" way to implement this, would be to randomly generate an ID, and store it in local storage / cookie / etc.
The ID will change if the user delete local storage and will be always different when using a private window.

That seems like an interesting compromise. I guess it would also mean have a different unique ID for each game, which might also be desired for privacy reason? You'll only be recognized by the game when you play that same game.

Copy link
Member

@fire fire left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Returning an empty string solves the issue problem. It is arguable better than a random uuid. If a game developer wants to generate a unique id they can inject one outside of Godot Engine via their website via javascript and for example a single signon.

@akien-mga akien-mga merged commit 5fe97c5 into godotengine:master Oct 2, 2023
15 checks passed
@akien-mga akien-mga deleted the web-clarify-get_unique_id branch October 2, 2023 11:21
@Mickeon Mickeon mentioned this pull request Dec 30, 2023
4 tasks
@akien-mga
Copy link
Member Author

Cherry-picked for 3.6.

@akien-mga akien-mga removed the cherrypick:3.x Considered for cherry-picking into a future 3.x release label Jan 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

OS.get_unique_id() returns empty string on Web target
3 participants