From 4af094ed47846b0e332cf546b79d852c91846c2a Mon Sep 17 00:00:00 2001 From: JustArchi Date: Sun, 10 Dec 2017 01:08:01 +0100 Subject: [PATCH] Serialize sensitive details in /Api/Structure --- ArchiSteamFarm/BotConfig.cs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/ArchiSteamFarm/BotConfig.cs b/ArchiSteamFarm/BotConfig.cs index 3d912c898..b6eb4adba 100644 --- a/ArchiSteamFarm/BotConfig.cs +++ b/ArchiSteamFarm/BotConfig.cs @@ -138,9 +138,11 @@ namespace ArchiSteamFarm { [JsonProperty] internal string SteamPassword { get; set; } - public bool ShouldSerializeSteamLogin() => false; - public bool ShouldSerializeSteamParentalPIN() => false; - public bool ShouldSerializeSteamPassword() => false; + private bool ShouldSerializeSensitiveDetails = true; + + public bool ShouldSerializeSteamLogin() => ShouldSerializeSensitiveDetails; + public bool ShouldSerializeSteamParentalPIN() => ShouldSerializeSensitiveDetails; + public bool ShouldSerializeSteamPassword() => ShouldSerializeSensitiveDetails; internal static BotConfig Load(string filePath) { if (string.IsNullOrEmpty(filePath)) { @@ -166,6 +168,8 @@ namespace ArchiSteamFarm { return null; } + botConfig.ShouldSerializeSensitiveDetails = false; + // Support encrypted passwords if ((botConfig.PasswordFormat != CryptoHelper.ECryptoMethod.PlainText) && !string.IsNullOrEmpty(botConfig.SteamPassword)) { // In worst case password will result in null, which will have to be corrected by user during runtime