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

fix(engine): add safety checks to savefile loading/storing #1330

Merged
merged 3 commits into from
Feb 20, 2025

Conversation

locked-chest
Copy link
Contributor

@locked-chest locked-chest commented Feb 19, 2025

Several changes which should increase robustness of the login/logout processing.

  • Prevent passing an invalid savefile from the LoginServer to World on login
  • Prevent passing an invalid savefile from the LoginServer to World on reconnect
  • Prevent passing an empty savefile from the LoginServer to World if the user has previously logged in (and therefore should have a .sav.)
  • Prevent overwriting an existing savefile with one that has less time played than the existing one (existingSave.playtime > newSave.playtime); this should prevent such cases that have somehow been resetted from being permanently saved on disk.

If for some reason we try to access savefile for a player that should
have one, and it's either absent from the filesystem or has invalid
data, we now reject the login attempt under a generic "Please try again"
message.

Previously, there were no sanity checks on reading the savefile data, or
if we didn't find a savefile for a player which should have one
(`logout_time != null`). In theory, if something went wrong here, it
would be sent to the player as a completely reset tutorial island
account. Then, when they logged out, the new savefile would be written.
A last-ditch effort to prevent overwriting an existing save with one
that has been reset back to tutorial island.
@locked-chest locked-chest changed the title fix(engine): add safety checks to savefile loading fix(engine): add safety checks to savefile loading/storing Feb 19, 2025
@Pazaz Pazaz merged commit d34f984 into 2004Scape:main Feb 20, 2025
5 checks passed
Pazaz added a commit that referenced this pull request Feb 21, 2025
## Content Changes

### Fixes

* #1299
* #1304
* #1306
* #1307
* #1316
* #1317
* #1318
* #1323
* #1324
* #1325
* #1327
* #1331
* #1332
* #1337
* #1340
* #1342
* #1343

## Engine Changes

### Features

* #1297

### Fixes

* #1301
* #1302
* #1329
* #1330
* #1338
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.

2 participants