From 6b983719f36a0a07b5626206ce0bd3f5f6c39fbf Mon Sep 17 00:00:00 2001 From: Natalia Portillo Date: Sun, 27 May 2018 16:20:52 +0100 Subject: [PATCH] GDPR compliance. --- DiscImageChef.Settings/Settings.cs | 17 ++++++++- DiscImageChef/Commands/Configure.cs | 54 +++++++++++++++++++++++++++-- DiscImageChef/Main.cs | 4 ++- 3 files changed, 71 insertions(+), 4 deletions(-) diff --git a/DiscImageChef.Settings/Settings.cs b/DiscImageChef.Settings/Settings.cs index 1a8a9c1c..95b218e0 100644 --- a/DiscImageChef.Settings/Settings.cs +++ b/DiscImageChef.Settings/Settings.cs @@ -45,6 +45,11 @@ namespace DiscImageChef.Settings /// public class DicSettings { + /// + /// Level for GDPR compliance checking. Every time a new feature may share user information this level should go up, and the user asked to opt-in. + /// + public const ulong GdprLevel = 1; + /// /// If set to true, reports will be saved locally /// @@ -57,6 +62,10 @@ namespace DiscImageChef.Settings /// Statistics /// public StatsSettings Stats; + /// + /// Set of GDPR compliance, if lower than , ask user for compliance. + /// + public ulong GdprCompliance; } // TODO: Use this @@ -283,6 +292,8 @@ namespace DiscImageChef.Settings } else Current.Stats = null; + Current.GdprCompliance = parsedPreferences.TryGetValue("GdprCompliance", out obj) ? (ulong)((NSNumber)obj).ToLong() : 0; + prefsFs.Close(); } else @@ -319,6 +330,7 @@ namespace DiscImageChef.Settings Current.SaveReportsGlobally = Convert.ToBoolean(key.GetValue("SaveReportsGlobally")); Current.ShareReports = Convert.ToBoolean(key.GetValue("ShareReports")); + Current.GdprCompliance = Convert.ToUInt64(key.GetValue("GdprCompliance")); bool stats = Convert.ToBoolean(key.GetValue("Statistics")); if(stats) @@ -385,7 +397,8 @@ namespace DiscImageChef.Settings NSDictionary root = new NSDictionary { {"SaveReportsGlobally", Current.SaveReportsGlobally}, - {"ShareReports", Current.ShareReports} + {"ShareReports", Current.ShareReports}, + {"GdprCompliance", Current.GdprCompliance} }; if(Current.Stats != null) { @@ -431,6 +444,7 @@ namespace DiscImageChef.Settings { key.SetValue("SaveReportsGlobally", Current.SaveReportsGlobally); key.SetValue("ShareReports", Current.ShareReports); + key.SetValue("GdprCompliance", Current.GdprCompliance); if(Current.Stats != null) { @@ -498,6 +512,7 @@ namespace DiscImageChef.Settings { SaveReportsGlobally = true, ShareReports = true, + GdprCompliance = 0, Stats = new StatsSettings { BenchmarkStats = true, diff --git a/DiscImageChef/Commands/Configure.cs b/DiscImageChef/Commands/Configure.cs index b001d38e..cb073793 100644 --- a/DiscImageChef/Commands/Configure.cs +++ b/DiscImageChef/Commands/Configure.cs @@ -38,19 +38,67 @@ namespace DiscImageChef.Commands { static class Configure { - internal static void DoConfigure() + internal static void DoConfigure(bool gdprChange) { + if(gdprChange) + { + DicConsole.WriteLine("In compliance with the European Union General Data Protection Regulation 2016/679 (GDPR),\n" + + "we must give you the following information about DiscImageChef and ask if you want to opt-in\n" + + "in some information sharing."); + DicConsole.WriteLine(); + DicConsole.WriteLine("Disclaimer: Because DiscImageChef is an open source software this information, and therefore,\n" + + "compliance with GDPR only holds true if you obtained a certificated copy from its original\n" + + "authors. In case of doubt, close DiscImageChef now and ask in our IRC support channel."); + DicConsole.WriteLine(); + DicConsole.WriteLine("For any information sharing your IP address may be stored in our server, in a way that is not\n" + + "possible for any person, manual, or automated process, to link with your identity, unless\n" + + "specified otherwise."); + } ConsoleKeyInfo pressedKey = new ConsoleKeyInfo(); + #region Device reports + DicConsole.WriteLine(); + DicConsole.WriteLine("With the 'device-report' command, DiscImageChef creates a report of a device, that includes its\n" + + "manufacturer, model, firmware revision and/or version, attached bus, size, and supported commands.\n" + + "The serial number of the device is not stored in the report. If used with the debug parameter,\n" + + "extra information about the device will be stored in the report. This information is known to contain\n" + + "the device serial number in non-standard places that prevent the automatic removal of it on a handful\n" + + "of devices. A human-readable copy of the report in XML format is always created in the same directory\n" + + "where DiscImageChef is being run from."); + while(pressedKey.Key != ConsoleKey.Y && pressedKey.Key != ConsoleKey.N) { - DicConsole.Write("Do you want to save device reports globally? (Y/N): "); + DicConsole.Write("Do you want to save device reports in shared folder of your computer? (Y/N): "); pressedKey = System.Console.ReadKey(); DicConsole.WriteLine(); } Settings.Settings.Current.SaveReportsGlobally = pressedKey.Key == ConsoleKey.Y; + pressedKey = new ConsoleKeyInfo(); + DicConsole.WriteLine(); + DicConsole.WriteLine("Sharing a report with us will send it to our server, that's in the european union territory, where it\n" + + "will be manually analized by an european union citizen to remove any trace of personal identification\n" + + "from it. Once that is done, it will be shared in our stats website, http://discimagechef.claunia.com\n" + + "These report will be used to improve DiscImageChef support, and in some cases, to provide emulation of the\n" + + "devices to other open-source projects. In any case, no information linking the report to you will be stored."); + while(pressedKey.Key != ConsoleKey.Y && pressedKey.Key != ConsoleKey.N) + { + DicConsole.Write("Do you want to share your device reports with us? (Y/N): "); + pressedKey = System.Console.ReadKey(); + DicConsole.WriteLine(); + } + + Settings.Settings.Current.ShareReports = pressedKey.Key == ConsoleKey.Y; + #endregion Device reports + + #region Statistics + DicConsole.WriteLine(); + DicConsole.WriteLine("DiscImageChef can store some usage statistics. These statistics are limited to the number of times a\n" + + "command is executed, a filesystem, partition, or device is used, the operating system version, and other.\n" + + "In no case, any information besides pure statistical usage numbers is stored, and they're just joint to the\n" + + "pool with no way of using them to identify you."); + pressedKey = new ConsoleKeyInfo(); while(pressedKey.Key != ConsoleKey.Y && pressedKey.Key != ConsoleKey.N) { @@ -174,7 +222,9 @@ namespace DiscImageChef.Commands Settings.Settings.Current.Stats.VerifyStats = pressedKey.Key == ConsoleKey.Y; } else Settings.Settings.Current.Stats = null; + #endregion Statistics + Settings.Settings.Current.GdprCompliance = Settings.DicSettings.GdprLevel; Settings.Settings.SaveSettings(); } } diff --git a/DiscImageChef/Main.cs b/DiscImageChef/Main.cs index d8c6cd0a..8f4aee53 100644 --- a/DiscImageChef/Main.cs +++ b/DiscImageChef/Main.cs @@ -48,6 +48,8 @@ namespace DiscImageChef DicConsole.ErrorWriteLineEvent += System.Console.Error.WriteLine; Settings.Settings.LoadSettings(); + if(Settings.Settings.Current.GdprCompliance < Settings.DicSettings.GdprLevel) + Configure.DoConfigure(true); Statistics.LoadStats(); if(Settings.Settings.Current.Stats != null && Settings.Settings.Current.Stats.ShareStats) Statistics.SubmitStats(); @@ -196,7 +198,7 @@ namespace DiscImageChef }).WithParsed(opts => { PrintCopyright(); - Configure.DoConfigure(); + Configure.DoConfigure(false); }).WithParsed(opts => { PrintCopyright();