[LIBREPORT PATCH] ask user to create a private report if it contains sensitive data - rhbz#960549

Jiri Moskovcak jmoskovc at redhat.com
Tue Aug 20 15:27:37 UTC 2013


Signed-off-by: Jiri Moskovcak <jmoskovc at redhat.com>
---
 libreport.spec.in               |  1 +
 src/gtk-helpers/ask_dialogs.c   |  3 +++
 src/gui-wizard-gtk/wizard.c     | 16 +++++++++++++++-
 src/include/Makefile.am         |  3 ++-
 src/plugins/reporter-bugzilla.c | 12 ++++++++++--
 5 files changed, 31 insertions(+), 4 deletions(-)

diff --git a/libreport.spec.in b/libreport.spec.in
index 6e02768..be4f09d 100644
--- a/libreport.spec.in
+++ b/libreport.spec.in
@@ -400,6 +400,7 @@ gtk-update-icon-cache %{_datadir}/icons/hicolor &>/dev/null || :
 %{_includedir}/libreport/internal_abrt_dbus.h
 %{_includedir}/libreport/internal_libreport.h
 %{_includedir}/libreport/xml_parser.h
+%{_includedir}/libreport/libreportconst.h
 %{_libdir}/libreport.so
 %{_libdir}/libabrt_dbus.so
 %{_libdir}/pkgconfig/libreport.pc
diff --git a/src/gtk-helpers/ask_dialogs.c b/src/gtk-helpers/ask_dialogs.c
index 19fed1f..a038126 100644
--- a/src/gtk-helpers/ask_dialogs.c
+++ b/src/gtk-helpers/ask_dialogs.c
@@ -76,6 +76,9 @@ static int run_ask_yes_no_save_generic_result_dialog(ask_yes_no_dialog_flags fla
                                                GTK_BUTTONS_NONE,
                                                "%s", message);
 
+    /* let's try to use the text as markup
+     * this allows us to use hyperlinks to man pages  */
+    gtk_message_dialog_set_markup(GTK_MESSAGE_DIALOG(dialog), message);
     gtk_dialog_add_button(GTK_DIALOG(dialog), _("_Yes"), GTK_RESPONSE_YES);
     GtkWidget *no_button = gtk_dialog_add_button(GTK_DIALOG(dialog), _("_No"), GTK_RESPONSE_NO);
 
diff --git a/src/gui-wizard-gtk/wizard.c b/src/gui-wizard-gtk/wizard.c
index 69f68d1..540db2e 100644
--- a/src/gui-wizard-gtk/wizard.c
+++ b/src/gui-wizard-gtk/wizard.c
@@ -21,6 +21,7 @@
 #include "client.h"
 #include "internal_libreport_gtk.h"
 #include "wizard.h"
+#include "libreportconst.h"
 
 #define DEFAULT_WIDTH   800
 #define DEFAULT_HEIGHT  500
@@ -2275,8 +2276,21 @@ static void highlight_forbidden(void)
 {
     GList *forbidden_words = load_forbidden_words();
 
-    if (highligh_words_in_tabs(forbidden_words))
+    if (highligh_words_in_tabs(forbidden_words)) {
+        int response = run_ask_yes_no_save_result_dialog(
+            CREATE_PRIVATE_TICKET,
+            _("Possible sensitive data detected, "
+            "do you want to restrict access to the report? "
+            "<a href=\"https://github.com/abrt/abrt/wiki/FAQ#reports-with-restricted-access\">(What does it mean)</a>"),
+            g_wnd_assistant);
+
+        if (response)
+        {
+            xsetenv(CREATE_PRIVATE_TICKET, "1");
+            add_warning(_("A private ticket has been requested."));
+        }
         add_warning(_("Possible sensitive data detected, please review the highlighted tabs carefully."));
+    }
 
     list_free_with_free(forbidden_words);
 }
diff --git a/src/include/Makefile.am b/src/include/Makefile.am
index 806b93e..d51957a 100644
--- a/src/include/Makefile.am
+++ b/src/include/Makefile.am
@@ -14,4 +14,5 @@ libreport_include_HEADERS = \
     file_obj.h \
     internal_libreport.h \
     internal_abrt_dbus.h \
-    xml_parser.h
+    xml_parser.h \
+    libreportconst.h
diff --git a/src/plugins/reporter-bugzilla.c b/src/plugins/reporter-bugzilla.c
index 024d0da..38ef633 100644
--- a/src/plugins/reporter-bugzilla.c
+++ b/src/plugins/reporter-bugzilla.c
@@ -20,6 +20,7 @@
 #include "client.h"
 #include "abrt_xmlrpc.h"
 #include "rhbz.h"
+#include "libreportconst.h"
 
 #include <satyr/stacktrace.h>
 #include <satyr/abrt.h>
@@ -737,8 +738,15 @@ static void set_settings(struct bugzilla_struct *b, map_string_t *settings)
     environ = getenv("Bugzilla_DontMatchComponents");
     b->b_DontMatchComponents = environ ? environ : get_map_string_item_or_empty(settings, "DontMatchComponents");
 
-    environ = getenv("Bugzilla_CreatePrivate");
-    b->b_create_private = string_to_bool(environ ? environ : get_map_string_item_or_empty(settings, "Bugzilla_CreatePrivate"));
+    environ = getenv(CREATE_PRIVATE_TICKET);
+    if (environ)
+        b->b_create_private = string_to_bool(environ);
+
+    if (!b->b_create_private)
+    {
+        environ = getenv("Bugzilla_CreatePrivate");
+        b->b_create_private = string_to_bool(environ ? environ : get_map_string_item_or_empty(settings, "Bugzilla_CreatePrivate"));
+    }
     VERB1 log("create private bz ticket: '%s'", b->b_create_private ? "YES": "NO");
 
     environ = getenv("Bugzilla_PrivateGroups");
-- 
1.8.3.1



More information about the Crash-catcher mailing list