From d2ba7d8f1dd91b1d866fa0fb360c12fb7662dda6 Mon Sep 17 00:00:00 2001 From: Carson McManus Date: Sun, 25 Jun 2023 19:52:48 -0400 Subject: [PATCH] fix null OAuthToken field in SDA accounts causing migrations to crash and burn (#227) --- src/accountmanager/legacy.rs | 2 +- src/accountmanager/migrate.rs | 4 ++++ .../compat/null-oauthtoken/manifest.json | 17 +++++++++++++++++ .../null-oauthtoken/nulloauthtoken.maFile | 1 + 4 files changed, 23 insertions(+), 1 deletion(-) create mode 100644 src/fixtures/maFiles/compat/null-oauthtoken/manifest.json create mode 100644 src/fixtures/maFiles/compat/null-oauthtoken/nulloauthtoken.maFile diff --git a/src/accountmanager/legacy.rs b/src/accountmanager/legacy.rs index aa5c2c5..cf0c9f2 100644 --- a/src/accountmanager/legacy.rs +++ b/src/accountmanager/legacy.rs @@ -155,7 +155,7 @@ pub struct Session { #[serde(default, rename = "WebCookie")] pub web_cookie: Option, #[serde(default, rename = "OAuthToken")] - pub token: String, + pub token: Option, #[serde(rename = "SteamID")] pub steam_id: u64, } diff --git a/src/accountmanager/migrate.rs b/src/accountmanager/migrate.rs index 388698a..36fca31 100644 --- a/src/accountmanager/migrate.rs +++ b/src/accountmanager/migrate.rs @@ -294,6 +294,10 @@ mod tests { manifest: "src/fixtures/maFiles/compat/no-webcookie/manifest.json", passkey: None, }, + Test { + manifest: "src/fixtures/maFiles/compat/null-oauthtoken/manifest.json", + passkey: None, + }, ]; for case in cases { eprintln!("testing: {:?}", case); diff --git a/src/fixtures/maFiles/compat/null-oauthtoken/manifest.json b/src/fixtures/maFiles/compat/null-oauthtoken/manifest.json new file mode 100644 index 0000000..a005606 --- /dev/null +++ b/src/fixtures/maFiles/compat/null-oauthtoken/manifest.json @@ -0,0 +1,17 @@ +{ + "encrypted": false, + "first_run": true, + "entries": [ + { + "encryption_iv": null, + "encryption_salt": null, + "filename": "nulloauthtoken.maFile", + "steamid": 1234 + } + ], + "periodic_checking": false, + "periodic_checking_interval": 5, + "periodic_checking_checkall": false, + "auto_confirm_market_transactions": false, + "auto_confirm_trades": false +} \ No newline at end of file diff --git a/src/fixtures/maFiles/compat/null-oauthtoken/nulloauthtoken.maFile b/src/fixtures/maFiles/compat/null-oauthtoken/nulloauthtoken.maFile new file mode 100644 index 0000000..c8f574b --- /dev/null +++ b/src/fixtures/maFiles/compat/null-oauthtoken/nulloauthtoken.maFile @@ -0,0 +1 @@ +{"shared_secret":"zvIayp3JPvtvX/QGHqsqKBk/44s=","serial_number":"kljasfhds","revocation_code":"R12345","uri":"otpauth://totp/Steam:example?secret=ASDF&issuer=Steam","server_time":1602522478,"account_name":"example","token_gid":"jkkjlhkhjgf","identity_secret":"kjsdlwowiqe=","secret_1":"sklduhfgsdlkjhf=","status":1,"device_id":"android:99d2ad0e-4bad-4247-b111-26393aae0be3","fully_enrolled":true,"Session":{"SessionID":"a;lskdjf","SteamLogin":"983498437543","SteamLoginSecure":"dlkjdsl;j%7C%32984730298","WebCookie":"asdk;lf;dsjlkfd","OAuthToken":null,"SteamID":1234}} \ No newline at end of file