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

new Authorization workflow fix #1

Merged
merged 45 commits into from
Jun 26, 2023
Merged

Conversation

ABaumher
Copy link
Collaborator

As of March 2023, Steam updated their authentication flow for steam network connections. See FriendsOfGalaxy#159

This version implements the new auth flow. PyTest is largely broken; i do not expect this PR to go through initially. But i would like for it to be reviewed so we can make any changes you all deem necessary

@gherpai
Copy link

gherpai commented May 15, 2023

Thank you for your work. Let me know if an unprofessional like me can help with anything.

@ABaumher
Copy link
Collaborator Author

Thank you for your work. Let me know if an unprofessional like me can help with anything.

@gherpai
If you want to test things, i can always use testers. See FriendsOfGalaxy#169. Also, if you're learning python as your profile suggests, and want to look into pytest, we have to fix all of those and i have no idea what that entails (disclaimer, i have ~4 months experience in Python. I have years in statically-typed, OOP languages, and therefore have some very strong opinions on python, which i'll keep to myself. So you probably have as much knowledge as i do, if not more)

@ABaumher ABaumher marked this pull request as draft June 4, 2023 16:56
@UncleGoogle
Copy link

UncleGoogle commented Jun 4, 2023

Wow, a lot of changes. I can try to make a review (security). For now (quick scan) a few comments/questions:

  1. was public profiles removed because it didn't work as well? In general it would be nice to fix it/reactivate later as it was a nice to skip passing password (see Steam Galaxy integration wants username and password FriendsOfGalaxy/galaxy-integration-steam#2)
  2. green tests are must have even if starting with very low coverage; IMO better to remove obsolete tests and write just a few from the very begging a better isolation (if the high coupling was the main reason they are broken)
  3. nice to see locked deps
  4. I wonder if that won't be better if we start to treat this plugin as yours and sync for updates periodically from your fork as from the main upstream. What do you feel about maintaining this plugin?

@ABaumher
Copy link
Collaborator Author

ABaumher commented Jun 4, 2023

@UncleGoogle sorry, i've been editing this as i understand the issue you mentioned in point 1 more.

  1. was public profiles removed because it didn't work as well? In general it would be nice to fix it/reactivate later as it was a nice to skip passing password (see Steam Galaxy integration wants username and password FriendsOfGalaxy/galaxy-integration-steam#2)

I thought it was added to address FriendsOfGalaxy#74. I didn't even see #2. The reason it was removed was that it was also broken in the latest steam update and the new auth flow fixed FriendsOfGalaxy#74.

As far as security goes, the new flow is more secure than the previous flow. The password is RSA encrypted before we send it along the websocket. Steam gives us that public key, and only steam has the private key. They also seem to generate a new public/private key pair each time we provide a username. Even if it does not change from the last call. The new auth flow also gives us a refresh token, so we don't get any web cookies or credentials. The refresh token can be revoked at any point using the steam app or the desktop application.

The new flow is the exact same as what the desktop Steam Application does. If you cannot trust our code with the username and password, you cannot trust steam.exe either. The only difference i can see is how we get your username and password. We do it through GOG's internal browser. Steam has a dedicated login page, but i'm almost positive that's their internal browser. Both are chromium based, so i'm not seeing a security change there. Now, we could get your password in a more secure manner than a url param, but if that url is not exposed it's not an issue. An aside, i do not understand how sending it over the web is more secure than a socket connection. Both are sent over TLS, and from my incomplete knowledge, doing a man-in-the-middle attack over https is easier than a direct socket connection. Both are exceedingly difficult to attack

The most secure thing to do would be to send it back to us as a post request with a protected JWT but that requires running a local http server and that's absolutely overkill.

One security concern that is worth addressing is the use of RSA over pycryptodome. RSA is a pure python implementation, whereas pytcrpytodome is mostly pure but does use cpython. I do not know which is considered more secure. I used rsa for simplicity, but if that's the cost of business, so to speak, i'll switch to pycryptodome

@ABaumher
Copy link
Collaborator Author

ABaumher commented Jun 4, 2023

2. green tests are must have even if starting with very low coverage; IMO better to remove obsolete tests and write just a few from the very begging a better isolation (if the high coupling was the main reason they are broken)
3. nice to see locked deps

There's an open PR on my repo (ABaumher#16) that's in progress that is attempting to fix the test cases. as i last heard, we have about half passing, 1/4 failing, and 1/4 hanging. Unfortunately the devs helping me who are working on this have other priorities, so that may take some time. It also looks to update our dependencies to newer versions, so long as they don't introduce breaking changes. One current pinned dependency (pip-tools) is actually broken on MacOS when building from scratch (a later version fixes it), so it's definitely something that needs doing.

4. I wonder if that won't be better if we start to treat this plugin as yours and sync for updates periodically from your fork as from the main upstream. What do you feel about maintaining this plugin?

I'm basically the de facto maintainer by this point, so that doesn't really feel any different than it is now. That said, I'd like to be able to hand it off to a group of maintainers (including me) so if for whatever reason I'm unable to keep the plugin up to date we don't have another friends of Galaxy situation.

@ebonato
Copy link

ebonato commented Jun 5, 2023

I`ve got steam back to work with 1.0.5-beta release of steam plugin.
Thanks a lot @ABaumher.
Nice project @urwrstkn8mare.. hope GOG-Nebula could be the official repo for GOG Client, as people are tired from getting fixes around for FriendsOfGalaxy plugins...
hope that CD Projekt Red recognizes all your work at least with a bunch of GOG vouchers.

@ebonato
Copy link

ebonato commented Jun 5, 2023

I`ve got steam back to work with 1.0.5-beta release of steam plugin.
Thanks a lot @ABaumher.
Nice project @urwrstkn8mare.. hope GOG-Nebula could be the official repo for GOG Client, as people are tired from getting fixes around for FriendsOfGalaxy plugins...
hope that CD Projekt Red recognizes all your work at least with a bunch of GOG vouchers

@ABaumher
Copy link
Collaborator Author

ABaumher commented Jun 7, 2023

Quick note: ~40 files are just dealing with protobuf changes. We now store the .proto files we use so they're easier to work with. The new protos are then compiled, which changes all the _pb2.py files. Additionally, the code and documentation on how to get them is in a dedicated file. It was missing from the releases.
A bunch of files have been changed to add type hinting with no actual code changes. Ideally we'd get full type hint coverage but that's not likely to happen.

Also, i commit often so apologies for the high commit total

@ABaumher
Copy link
Collaborator Author

ABaumher commented Jun 7, 2023

As for #2, if they really do not trust gog's browser, it's possible to ask for their username, then provide them an RSA public key. This is straight from steam, we cannot decode anything encoded with this key. Have another program create the public key from the provided modulus and exponent, then provide it their password. Then paste in the generated cipher text.

Normally we do this internally but retrieve the password through gog's browser. Adding this "feature" adds another layer of complexity, but by all means, let's be more 'secure' than the steam client itself

@UncleGoogle
Copy link

UncleGoogle commented Jun 7, 2023

Hi, thanks for the response.

regarding FriendsOfGalaxy#2:

  • I'm just making sure you are aware about this

The new flow is the exact same as what the desktop Steam Application does. If you cannot trust our code with the username and password, you cannot trust steam.exe either. The only difference i can see is how we get your username and password. We do it through GOG's internal browser. Steam has a dedicated login page, but i'm almost positive that's their internal browser. Both are chromium based, so i'm not seeing a security change there.

yes, that difference was exactly about that: gog browser is not a Steam, but more importantly we (plugin) are not Steam, so users who don't read the plugin code can't know if they are not a victim of a phishing. And this is really a thing -- it is possible to use Galaxy browser to pass bare creds to plugin code and send it to the malicious actor. From that perspective I understand why GOG is hesitant about changing the cfg source which also means that plugins will autoupdate based on "update_url" in manifest.json. Also because of that Steam may be suspicious for such projects as our -- just with their users protection in mind.

That being said, in my perspective "public profiles" backend was a nice trade-off (I was using it privately too), so people don't have to choose to trust to anyone if they are scared.

But if it does not work any longer so it is definitely not a thing to block by me.

possible to ask for their username, then provide them an RSA public key.

for sure not for now, but sounds great. Probably not as a separate backend but as a variant of current login flow?


I'm basically the de facto maintainer by this point, so that doesn't really feel any different than it is now. That said, I'd like to be able to hand it off to a group of maintainers (including me) so if for whatever reason I'm unable to keep the plugin up to date we don't have another friends of Galaxy situation.

I see, it is always better (difficult to achieve open source world) to have more active maintainers.

The idea of Nebula in current shape was to maintain a new cfg repo for GOG and provide auto updates only for reviewed changes (see https://github.com/GOG-Nebula/.github/blob/main/profile/README.md#non-goals-for-now). In case of unmaintained plugin we can switch to fork... a new, actively developed fork OR maintain the plugin directly here as you propose to do now, right?. For the first case we have automated solution to create PRs from the repo we fork https://github.com/GOG-Nebula/action-sync-fork. Then someone do a review and merge changes to broader audience. The latter case is more like switching a mode from bundle maintainer to being actual maintainer and dealing with issues, PRs ect. -- in general people would expect we maintain it and in case we lost a main project driver (now it is you), people will less likely to find take the project over from Nebula and for now I'm also not convinced to freely accept new members (at least if those members have a power of accepting PRs from other plugins to be shipped for thousands of people).

Trying to compare both solutions:

So from the one hand (Nebula auto-sync your repo)

  • for the org. workload it is wiser split responsibility and prove firstly that we are able to efficiently maintain security reviews of changing upstreams, then work on utils for all devs instead of focusing on particular plugins
  • it would also provide clearer division between stable (Nebula accepted) and nightly/beta (developer) builds for users (or is that only my impression?)
  • probably(?) easier to find another active fork if the previous become unmaintained

From the other hand (Plugin maintained directly)

  • there is less burden (even if PRs are automated) when working directly on one codebase - e.i. quicker fixes as there is no need to have a PR fix accepted by 1) you 2) then someone from Nebula; especially for such big and important plugin like Steam
  • there could be potentially a better cooperation between us (psychological effect of working on one thing instead of "your toys" and "our toys")

What do you think @ABaumher, @urwrstkn8mare, @Mixaill @AndrewDWhite ?

Also, i commit often so apologies for the high commit total

No worries, I just need to find a free hour or two, unfortunately, my free hour today were just eaten on writing this messages 😂

@ABaumher
Copy link
Collaborator Author

ABaumher commented Jun 8, 2023

I guess the question is do they trust the public key we give them? Because in theory, if they don't view our source code, they could think we're just giving them a public key we generated, and we're still guilty of that phishing attack.

I'll implement the "here's a rsa key, generate your own encoded text" flow as an option for the current flow during the overall rework. It's what i had when testing the new flow but it was not worth the headaches of making it user friendly. It's rather difficult to cleanly swap back to the username page if you realize you mistyped your username.

With the rework, I'm trying to drastically simplify the code structure, which should make your review process (and by extension, GOG's) much easier. All the callback nonsense between protobuf client, protocol client, and websocket client will be removed. I'm not using asyncio queue to separate the websocket and gog plugin code, because that's caused no shortage of headaches (i think this was added because they misunderstood how async works. It's not multithreading, it's just delaying execution instead of blocking). The backend code will be 3 major classes: model, view, and controller, and a few helpers to parse data and keep the files clean. Type hints will be added everywhere i can (and haven't already)

Currently i have a branch that updates the deps and switches to betterproto instead of protobuf. This gives us compile-time classes for the protos which are significantly easier to work with. If this all works as intended i can start simplifying the protobuf/protocol/websocket client code.

A final option would be to truly implement parallel processing between the model (steam via websocket) and the controller (the code that calls them). Since python has GIL, multithreading is essentially useless, but we could do multi-process code instead. This in theory could speed up i/o on massive libraries since we don't need to wait for the gog-side code to process them

@ABaumher
Copy link
Collaborator Author

ABaumher commented Jun 8, 2023

As for the pros/cons of solo maintainer and upstream pulls vs maintained here, I'd greatly prefer having a team develop the plugins for the following reasons:

  • more uniform code. If we have code standards and common designs for each plugin we have, it's far easier to understand all of them, which makes maintenance easier. Obviously each plugin is different so we can't have the same code, but if they all do MVC or component based or whatever it's the same concept. With solo maintainers it's largely whatever code style they choose.
  • redundancy: if life changes force a developer to stop maintaining a plugin, others can take over. If the code is similarly structured this is a lot easier.
  • divide & conquer: ymmv, but from my experience, having others to code with/ bounce ideas off of makes it easier to stay motivated and helps find bugs, etc.

But i do recognize that maybe Nebula should not be that group. If we're trying to take over the cfg and make it so we're the security team that prevents malicious users from inserting bad faith code, then we should not be accepting PRs, etc.

Would it be possible to compromise? Have a second group that includes everyone here that maintains the plugins and we use that as our upstream? That group could accept users a little more leniently, and ensure the code is kept clean. Then, Nebula could do security reviews before merging the upstream source, preferably with gog members as part of the team so gog can ensure they aren't letting malicious code slip through.

@UncleGoogle
Copy link

UncleGoogle commented Jun 9, 2023

@ABaumher
image

Would it be possible to compromise? Have a second group that includes everyone here that maintains the plugins and we use that as our upstream? That group could accept users a little more leniently, and ensure the code is kept clean. Then, Nebula could do security reviews before merging the upstream source, preferably with gog members as part of the team so gog can ensure they aren't letting malicious code slip through.

sounds good, but a bit too complex for now. I hardly have a time to answer in those threads. I got hyped some time ago (we all did whoever made his own plugin), and get burned out with time i think. You joined the party late, but with a big inpact. This seems to be the last chance for GOG to regain community trust, otherwise nobody will waste time any longer.

That being said, let just make working Steam plugin ready and cfg ready without complication and see what happen.
(it means I'm ok with having this fork directly in Nebula now)

UPDATE 10.06:

image

Copy link

@UncleGoogle UncleGoogle left a comment

Choose a reason for hiding this comment

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

I didn't finish but I'm publishing all comments I have because I got sick and don't want to block you. I'm sorry if some comment are more like drafts -- I still didn't understand all the flow and didn't test it very well.

Some comments are not only about security, because it wasn't decided if it goes only with the external org or inside Nebula. But you can create internal issues for some, this MR is too big to handle it at once.

README.md Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
current_version.json Outdated Show resolved Hide resolved
galaxy-integration-steam.pyproj Show resolved Hide resolved
protobuf_files/README_UPDATE_PROTOBUF_FILES.md Outdated Show resolved Hide resolved
src/steam_network/websocket_client.py Outdated Show resolved Hide resolved
src/steam_network/steam_auth_polling_data.py Outdated Show resolved Hide resolved
src/steam_network/steam_auth_polling_data.py Outdated Show resolved Hide resolved
src/steam_network/user_info_cache.py Show resolved Hide resolved
src/steam_network/steam_public_key.py Outdated Show resolved Hide resolved
@ABaumher
Copy link
Collaborator Author

From your current review, i definitely need to clean up the readmes and the comments.

I'd like to have type hints everywhere and annotated classes and functions but I'm doing that as part of the larger refactor and a lot of it will be thrown out or changed so I'm not doing it right now

@ABaumher
Copy link
Collaborator Author

Also, i tend to comment above a function instead of below, because that's what c/++, C#, Java all do. so a lot of these need to be fixed to be part of function, below the definition.

@ABaumher
Copy link
Collaborator Author

The reviewed issues marked so far have been addressed. The readme is still a little rough; let me know if it still needs updating. bumped Release version to 1.0.6 to address a bug for long passwords and/or illegal characters

@ABaumher ABaumher marked this pull request as ready for review June 15, 2023 01:22
@ABaumher
Copy link
Collaborator Author

as i look to refactor i'm learning there's a lot i can clean up, but the plugin is very stable at the moment, though extremely large libraries still hit bottlenecks. We can try band-aid fixing them in the meantime but the only real solution is to rewrite the code and optimize a little better. They tend to sync up, it just takes a lot longer than it should.

@urwrstkn8mare
Copy link
Member

urwrstkn8mare commented Jun 15, 2023

alr exams done ill try to help out as much as possible

Nice project @urwrstkn8mare

Thanks @ebonato! I think @UncleGoogle @AndrewDWhite and @Mixaill also deserve credit for the inception of this project.

So from the one hand (Nebula auto-sync your repo)

  • for the org. workload it is wiser split responsibility and prove firstly that we are able to efficiently maintain security reviews of changing upstreams, then work on utils for all devs instead of focusing on particular plugins
  • it would also provide clearer division between stable (Nebula accepted) and nightly/beta (developer) builds for users (or is that only my impression?)
  • probably(?) easier to find another active fork if the previous become unmaintained

From the other hand (Plugin maintained directly)

  • there is less burden (even if PRs are automated) when working directly on one codebase - e.i. quicker fixes as there is no need to have a PR fix accepted by 1) you 2) then someone from Nebula; especially for such big and important plugin like Steam
  • there could be potentially a better cooperation between us (psychological effect of working on one thing instead of "your toys" and "our toys")

I'm assuming 'plugin maintained directly' means maintained on this org? I think its a good idea in the case of this plugin.

sounds good, but a bit too complex for now. I hardly have a time to answer in those threads. I got hyped some time ago (we all did whoever made his own plugin), and get burned out with time i think. You joined the party late, but with a big inpact. This seems to be the last chance for GOG to regain community trust, otherwise nobody will waste time any longer.

That being said, let just make working Steam plugin ready and cfg ready without complication and see what happen.
(it means I'm ok with having this fork directly in Nebula now)

wholeheartedly agree thanks @ABaumher for your work. also a second group for maintaining the plugins are bad idea imo. i think as long as we have pull request security the rest could be manually maintained until someone sets up the github action stuff. i remember working on that but it was so long ago it could be outdated or something so i'll be reviewing that. btw the pull request security would only be on the master/main branch so iterative work can be done on other branches.

plugin is very stable at the moment, though extremely large libraries still hit bottlenecks. We can try band-aid fixing them in the meantime but the only real solution is to rewrite the code and optimize a little better. They tend to sync up, it just takes a lot longer than it should.

i havent had a chance to go through the changes as @UncleGoogle has but from what you said it seems that the plugin is stable. if you wanna do the bandaids and push it out we could do that. if you'd rather just do it right the first time and do a rewrite i'd recommend merging this pr into a branch something like rewrite and i could also help just a little with some PRs to that branch here and there before we create a new PR that is easier to review and merge.

@urwrstkn8mare
Copy link
Member

also @ABaumher ic that u and https://github.com/ValvePython/steam developed the new auth flow simulateneously. would it simplify the code if you used that package? i do understand that may negate alot of the hard work you put into implementing the auth flow yourself here. i could be very wrong btw i dont have the same experience as you

Copy link
Member

Choose a reason for hiding this comment

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

what is this and auto-copy-windows.bat for?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Since i don't have currently have it set up where you can get it by searching through gog (not sure how that works) you need to download my zipped releases, and replace the old code with the stuff in the zip. The batch file does that for you.

There's a MacOS command equivalent as well, which pulls double duty. Since I've been building the plugins myself instead of using github actions, macos security flags all the cpython the included modules have. This script still procs security, but if you allow it, it clears all the security flags on the cpython scripts.

My latest releases have a separate zip with the installer.

@ABaumher
Copy link
Collaborator Author

At this point it's more stable than version 1.0.3 (the last release from FoG) and better at pulling achievements. we haven't had any regressions as far as i can tell. The full on refactor is ongoing, but i have it on a separate branch on my repo. I could close this and wait until that's done for a PR, but that could take quite a while.

If you'd prefer to host my conversion branch i can do a pr here and let you create a branch for it, or you could contribute on my repo. I'm not sure which is easier or preferred. Not gonna lie, the place i'm doing active conversion is in an extremely rough, mostly broken state. I've been stripping down functions to nothing, adding type hints and documentation, then re-implementing them as i go. A good portion will remain the same or get slight optimizations, but i've found that a lot of code was poorly designed and going through each function like this lets me find them. I'm sure there's a better way but it's been working for me.
I do also have a test branch that is working but a little wonky. i'm not sure if this is because of the changes that have been made or if it's a cost of swapping to betterproto.

I'm 95% positive i can clean up the bottlenecks with a rewrite so any costs we take from using betterproto will be irrelevant.

@ABaumher
Copy link
Collaborator Author

ABaumher commented Jun 15, 2023

Seeing as you are both better at python than me, i'm wondering if you can take a look at a parallelizer i wrote. Some of our code converts Steam protobuf messages to their GOG equivalents, and for large libraries (>1k licenses, though we have some testers above 10k licenses) this blocks the other tasks. This has been especially annoying when it takes so long gog assumes the plugin is not responding and sends us a shutdown. I think using multiprocessing would allow me to not block the main thread but i have no idea if this code has a secret gotcha i'm missing.

https://github.com/ABaumher/galaxy-integration-steam/blob/4119e655bf73ffd88059aa414b56afd1628c4ad1/src/steam_network/protocol/task_parallelizer.py

edit: you can add a cast call on the await future to type List[U] so mypy doesn't complain. await <Future instance> returns Any but we know the type here is List[U]

@urwrstkn8mare
Copy link
Member

Setting up the repo on my M1 has proved annoying but I think I'm getting there. I agree that the original one is already broken so if this one is working and I'm pretty sure there's nothing malicious it's pretty safe to merge (consider this my unofficiak approval). @UncleGoogle probably will have more to say when he's free as he's done a more in-depth review

During your rewrite if possible try breaking it down into smaller chunks unless the rewrite is completely changing the major structure of the plugin and logic. This makes it easier to review and also allows the prod code to get better incrementally.

I'll have a look at the parallelise soon but I'm not means an expert. Let's leave the better python programmer title up to debate :)

Also once merged I think we should just manually create releases for now as we can make sure releases are secured by protecting the master branch of the cfg repo.

@ABaumher
Copy link
Collaborator Author

ABaumher commented Jun 15, 2023

If it's not too much of a hassle, can you document how you set it up on Mac? I use windows and have borrowed a Mac for setup but it was not pleasant for me because i am not confortable on a Mac.

I'm not sure if you prefer pycharm, xcode, or vs code, but any option would be preferred. The project has an existing .pyproj for VS/VS Code is you go that route. The instructions i have for Mac setup is using pyenv but when i did it i just installed python 3.7.9 straight from the python release page. One thing to note is that python likes to install as python3 on Unix and Linux (i used apt install pythonispython3 or whatever that is on my WSL Linux distro to address this, but that's not Unix) so some commands might not work right. like i said, document these if you can so we can fix the readme

@ABaumher
Copy link
Collaborator Author

As for the rewrite, it's unfortunately looking like a full change. I might be able to tag it incremenetally so you can review the changes a little more easily. I could also do it one file at a time and then worry about integration hell when i get there.

ABaumher and others added 3 commits June 23, 2023 18:30
…ers or are too long.

Cleans up general code as per merge request fix suggestions.

updated the readmes for clarity.

fixed bug introduced into 1.0.6 beta during cleanup

Update dev.txt

This is fixed in other branches but required for new installs, and especially on MacOS.
…est to point there as well.

cleaned up user info cache (again) so the is_initialized call is clean (tested it). and updated enum message to be less scary.
enums: Corrected type hint in `to_TwoFactorMethod`
steam_auth_polling_data: Corrected 'any' check in 'has_valid_confirmation_method'. No 2FA's enum value is 0, which was being coerced to False.
backend_steam_network: The value from no two-factor is now returned instead of set to result and unused. The _handle_steam_guard_none function now properly calls the finish auth process so we're actually logged in. previously it'd just short-circuit that process and then error later. Properly does this, expected wrong UserActionRequired value and also wasn't awaited. in other words, several small, dumb mistakes.

bumped manifest and current version to 1.0.7 as a result of these changes.

Hardened the User Info Cache code so it would not error if the data somehow was cleared to Null and written to the credentials storage. It will also write an empty dict to the credentials instead of a dict of nulls.

Stripped the leading and trailing whitespace characters during 2FA code inputs so the whitespace wouldn't make your 2FA fail.

Properly type-hint 2FA code so it would resolve nicely in any IDE or MyPy

Fixed broken urls in current_version,json
Updated version.py to have 1.0.7 with relevant changelog information

Hardened the User Info Cache code so it would not error if the data somehow was cleared to Null and written to the credentials storage. It will also write an empty dict to the credentials instead of a dict of nulls.

Stripped the leading and trailing whitespace characters during 2FA code inputs so the whitespace wouldn't make your 2FA fail.

Properly type-hint 2FA code so it would resolve nicely in any IDE or MyPy

Fixed broken urls in current_version,json

update gitignore to avoid .gz files. The mac with installer is uses that compression. partially updated the batch file to deal with issues, still needs some tweaking
@ABaumher
Copy link
Collaborator Author

Squashed what i could, but since this is write protected i can't do that directly, and had to do it to my master. Once this is approved (again, sorry all), we should be able to just rebase and merge and be good.

@ABaumher
Copy link
Collaborator Author

I will admit i got pretty annoyed at the whole interactive rebase so about halfway through i stopped cleaning up the messages. If you need me to clean up the commit messages i can go back and do it (but i don't want to XD)

@ABaumher ABaumher force-pushed the master branch 2 times, most recently from 4da4926 to d856a02 Compare June 23, 2023 23:11
Fixed license.txt - missed a merge commit message mistake

Updated auto-copy-windows to use a full path. Was not done on nebula so i didn't break the reviews, but now that squashing did that anyway, i might as well.
@ABaumher
Copy link
Collaborator Author

ok, that should finally be all the squash merges handled. I actually missed removing a conflict message from my merge and visual studio does not normally enable the option to force push, so it was trying to pull than push and causing a whole big mess. I have that set properly on my other computer but not this one. It's now set here as well and should stop being a pain in the a**

urwrstkn8mare pushed a commit that referenced this pull request Jun 24, 2023
fix mobile confirm flow. not pretty but should work
urwrstkn8mare pushed a commit that referenced this pull request Jun 24, 2023
(try to) fix the protobuf file conflict voodoo
Copy link
Member

@urwrstkn8mare urwrstkn8mare left a comment

Choose a reason for hiding this comment

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

I'm getting a 😬:

method=initialize_cache, params={'data': '****'}
2023-06-24 19:36:55,620 - galaxy.api.plugin - ERROR - Unhandled exception during `handshake_complete` step
Traceback (most recent call last):
  File "/Users/*/Library/Application Support/GOG.com/Galaxy/plugins/installed/steam_ca27391f-2675-49b1-92c0-896d43afa4f8/galaxy/api/plugin.py", line 325, in _initialize_cache
    self.handshake_complete()
  File "/Users/*/Library/Application Support/GOG.com/Galaxy/plugins/installed/steam_ca27391f-2675-49b1-92c0-896d43afa4f8/plugin.py", line 103, in handshake_complete
    self.__backend = self._load_steam_network_backend()
  File "/Users/*/Library/Application Support/GOG.com/Galaxy/plugins/installed/steam_ca27391f-2675-49b1-92c0-896d43afa4f8/plugin.py", line 115, in _load_steam_network_backend
    return SteamNetworkBackend(http_client, ssl_context, persistent_storage_state, persistent_cache, update_user_presence, store_credentials, add_game)
  File "/Users/*/Library/Application Support/GOG.com/Galaxy/plugins/installed/steam_ca27391f-2675-49b1-92c0-896d43afa4f8/backend_steam_network.py", line 122, in __init__
    self._load_persistent_cache()
  File "/Users/*/Library/Application Support/GOG.com/Galaxy/plugins/installed/steam_ca27391f-2675-49b1-92c0-896d43afa4f8/backend_steam_network.py", line 126, in _load_persistent_cache
    self._games_cache.loads(self._persistent_cache["games"])
  File "/Users/*/Library/Application Support/GOG.com/Galaxy/plugins/installed/steam_ca27391f-2675-49b1-92c0-896d43afa4f8/steam_network/games_cache.py", line 185, in loads
    self._storing_map = LicensesCache.from_json(cache['licenses'])
  File "/Users/*/Library/Application Support/GOG.com/Galaxy/plugins/installed/steam_ca27391f-2675-49b1-92c0-896d43afa4f8/dataclasses_json/api.py", line 78, in from_json
    return cls.from_dict(kvs, infer_missing=infer_missing)
  File "/Users/*/Library/Application Support/GOG.com/Galaxy/plugins/installed/steam_ca27391f-2675-49b1-92c0-896d43afa4f8/dataclasses_json/api.py", line 85, in from_dict
    return _decode_dataclass(cls, kvs, infer_missing)
  File "/Users/*/Library/Application Support/GOG.com/Galaxy/plugins/installed/steam_ca27391f-2675-49b1-92c0-896d43afa4f8/dataclasses_json/core.py", line 194, in _decode_dataclass
    infer_missing)
  File "/Users/*/Library/Application Support/GOG.com/Galaxy/plugins/installed/steam_ca27391f-2675-49b1-92c0-896d43afa4f8/dataclasses_json/core.py", line 254, in _decode_generic
    res = _get_type_cons(type_)(xs)
  File "/Users/*/Library/Application Support/GOG.com/Galaxy/plugins/installed/steam_ca27391f-2675-49b1-92c0-896d43afa4f8/dataclasses_json/core.py", line 298, in <genexpr>
    for x in xs)
  File "/Users/*/Library/Application Support/GOG.com/Galaxy/plugins/installed/steam_ca27391f-2675-49b1-92c0-896d43afa4f8/dataclasses_json/core.py", line 150, in _decode_dataclass
    field_value = kvs[field.name]
KeyError: 'type'

i think unfortunately it changed something cause this error wasn't happening before im pretty sure

EDIT: it happens on master_not_nebula as well am i doing something wrong?

I will admit i got pretty annoyed at the whole interactive rebase so about halfway through i stopped cleaning up the messages. If you need me to clean up the commit messages i can go back and do it (but i don't want to XD)

yeah it is really annoying if you wanted i could've done the chore (least i could do). in the future lmk if u wan me to do any rebasing

current_version.json Show resolved Hide resolved
@@ -0,0 +1,12 @@
{
"name": "Galaxy Steam plugin Version 2",
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
"name": "Galaxy Steam plugin Version 2",
"name": "Steam plugin for GOG Galaxy",

not version 2 yet!

Copy link
Collaborator Author

@ABaumher ABaumher Jun 24, 2023

Choose a reason for hiding this comment

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

Was trying to differentiate between ours and FoGs.

Am open to suggestions on a better name

Choose a reason for hiding this comment

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

I'm not sure if this "name" makes any practical difference in Galaxy.
"version" is more important. 10.7 is ok for me, 2.0 is ok for me too as there is even a braking change (public profiles backend)

@ABaumher
Copy link
Collaborator Author

@urwrstkn8mare if you've been testing the better proto deps branch that key was renamed to type_ because type is a keyword (top level function iirc) and imo that's confusing.

I don't think our cache is forwards compatible. It's backwards compatible but you aren't expected to go back to an older version when the newer version is available. Unfortunately that branch is still in development so it's probably causing you issues. Idk if we bump the cache version (which is only stored in the games cache, idk why) so there's no way to recover in the legacy code.

Deleting your db file (i recommend backing it up so you don't have to wait for it to fill back up when switching back to development) will fix it.

@UncleGoogle
Copy link

I will admit i got pretty annoyed at the whole interactive rebase so about halfway through i stopped cleaning up the messages. If you need me to clean up the commit messages i can go back and do it (but i don't want to XD)

now I regret about what I proposed 🙈 . I hope you won't have to resolve the same conflicts again when you start to rebase your branches onto newly rebased master. If you will have to do it, better squash a lot on feature branches to separate and limit amount of commits, THEN rebase onto master.

@UncleGoogle UncleGoogle merged commit c18c3b9 into GOG-Nebula:master Jun 26, 2023
@engiefox
Copy link

One step closer to getting this fixed for everyone! Good job, you've all put a lot of work into this, you deserve some praise!

@urwrstkn8mare
Copy link
Member

I've created a release: https://github.com/GOG-Nebula/galaxy-integration-steam/releases/tag/v1.0.7

Feel free to upload the zips and modify the description however you'd like

@UncleGoogle
Copy link

UncleGoogle commented Jun 27, 2023

@urwrstkn8mare Nebula responsibility is would be to ensure release zips are prepared from source. We trust @ABaumher but for now lets be a honest for all the people around: we we don't certificate files you download from GOG-Neubla//galaxy-integration-steam repo yet, use releases on your own risk!

We approved the plugin when installing from source as described in the Readme ;)

Current plan to do it better is to have:

  • automated release process
  • zips with latest release commited to protected branch (used in links for auto updating)

@urwrstkn8mare
Copy link
Member

@UncleGoogle that sounds good. The only issue with automated release process is that unless we can figure out a way for maintainers to modify releases even if releases are automatically created they can be modified by members of this repo without changing the link to the file.

@UncleGoogle
Copy link

UncleGoogle commented Jun 27, 2023

@UncleGoogle that sounds good. The only issue with automated release process is that unless we can figure out a way for maintainers to modify releases even if releases are automatically created they can be modified by members of this repo without changing the link to the file.

I mean our automated release instead of creating actual github "release" object, can push commit to the repo on master branch and also commit a current_version_.json with a absolute link to commit sha (that would be 2 additional commits though).n

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.