New style of reporting automatically processes event chains. The default event chain for report-gtk and report-cli contains analyze_RetraceServer event. This event sends a core file somewhere to the Internet. In the current state, a user notices that a core file is uploaded somewhere after uploading process started. If a core file is tiny a user won't most likely notice this uploading because of automatic execution of next event from event chain.
This set of patches adds a new event configuration option named 'sending-sensitive-data'. If an event has configured this option to value 'yes' a reporter must ask for permission to run the event.
Jakub Filak (4): trac#660: add support for sendining-sensitive-data event option trac#660: report-gtk: introduce generic ask_yes_no() function for options trac#660: report-gtk asks for permission to send sensitive data trac#660: report-cli asks for premission to send sensitive data
src/cli/cli-report.c | 11 +++++++ src/gui-wizard-gtk/wizard.c | 79 ++++++++++++++++++++++++++++++++++----------- src/include/event_config.h | 1 + src/lib/event_xml_parser.c | 5 +++ 4 files changed, 77 insertions(+), 19 deletions(-)
* configuration parser reads a value of the 'sendining-sensitive-data' xml element * the default value for this option is false * the option means that 'an event sends possibly sensitive data somewhere' * core file is an example of sensitive data * this option is required for automatic execution of events from event chain (a user have to get an approval)
Signed-off-by: Jakub Filak jfilak@redhat.com --- src/include/event_config.h | 1 + src/lib/event_xml_parser.c | 5 +++++ 2 files changed, 6 insertions(+)
diff --git a/src/include/event_config.h b/src/include/event_config.h index 15ebf52..0ca3bda 100644 --- a/src/include/event_config.h +++ b/src/include/event_config.h @@ -80,6 +80,7 @@ typedef struct bool ec_exclude_binary_items; long ec_minimal_rating; bool ec_skip_review; + bool ec_sending_sensitive_data;
GList *options; } event_config_t; diff --git a/src/lib/event_xml_parser.c b/src/lib/event_xml_parser.c index cd99784..157b717 100644 --- a/src/lib/event_xml_parser.c +++ b/src/lib/event_xml_parser.c @@ -32,6 +32,7 @@ #define DEFAULT_VALUE_ELEMENT "default-value" #define MINIMAL_RATING_ELEMENT "minimal-rating" #define GUI_REVIEW_ELEMENTS "gui-review-elements" +#define SENDING_SENSITIVE_DATA_ELEMENT "sending-sensitive-data"
#define REQUIRES_ELEMENT "requires-items" #define EXCL_BY_DEFAULT_ELEMENT "exclude-items-by-default" @@ -423,6 +424,10 @@ static void text(GMarkupParseContext *context, { ui->ec_skip_review = !string_to_bool(text_copy); } + else if (strcmp(inner_element, SENDING_SENSITIVE_DATA_ELEMENT) == 0) + { + ui->ec_sending_sensitive_data = string_to_bool(text_copy); + } } free(text_copy); }
* the generic ask_yes_no() function shows a standard 'yes/no' dialog with a checkbox * if user checks the checkbox the ask_yes_no() function immediately returns 'yes' in the future calls
Signed-off-by: Jakub Filak jfilak@redhat.com --- src/gui-wizard-gtk/wizard.c | 52 ++++++++++++++++++++++++++++----------------- 1 file changed, 33 insertions(+), 19 deletions(-)
diff --git a/src/gui-wizard-gtk/wizard.c b/src/gui-wizard-gtk/wizard.c index ce7b742..861d922 100644 --- a/src/gui-wizard-gtk/wizard.c +++ b/src/gui-wizard-gtk/wizard.c @@ -310,46 +310,60 @@ static void update_window_title(void) free(title); }
-static void on_toggle_ask_steal_cb(GtkToggleButton *tb, gpointer user_data) +static void on_toggle_ask_yes_no_save_result_cb(GtkToggleButton *tb, gpointer user_data) { - set_user_setting("ask_steal_dir", gtk_toggle_button_get_active(tb) ? "no" : "yes"); + set_user_setting(user_data, gtk_toggle_button_get_active(tb) ? "no" : "yes"); }
-static bool ask_continue_before_steal(const char *base_dir, const char *dump_dir) +/* + * Function shows a dialog with 'Yes/No' buttons and a check box allowing to + * remeber the answer. The answer is stored in configuration file under + * 'option_name' key. + */ +static bool ask_yes_no_save_result(const char *message, const char *option_name) { - const char *ask_steal_dir = get_user_setting("ask_steal_dir"); + const char *ask_result = get_user_setting(option_name);
- if (ask_steal_dir && string_to_bool(ask_steal_dir) == false) + if (ask_result && string_to_bool(ask_result) == false) return true;
GtkWidget *dialog = gtk_message_dialog_new(GTK_WINDOW(g_wnd_assistant), - GTK_DIALOG_DESTROY_WITH_PARENT, - GTK_MESSAGE_QUESTION, - GTK_BUTTONS_OK_CANCEL, - _("Need writable directory, but '%s' is not writable." - " Move it to '%s' and operate on the moved data?"), - dump_dir, base_dir - ); + GTK_DIALOG_DESTROY_WITH_PARENT, + GTK_MESSAGE_QUESTION, + GTK_BUTTONS_YES_NO, + "%s", message);
gint response = GTK_RESPONSE_CANCEL; - g_signal_connect(G_OBJECT(dialog), "response", G_CALLBACK(save_dialog_response), &response); + g_signal_connect(G_OBJECT(dialog), "response", + G_CALLBACK(save_dialog_response), &response);
- GtkWidget *ask_steal_cb = gtk_check_button_new_with_label(_("Don't ask me again")); + GtkWidget *ask_yes_no_cb = gtk_check_button_new_with_label(_("Don't ask me again")); gtk_box_pack_start(GTK_BOX(gtk_dialog_get_content_area(GTK_DIALOG(dialog))), - ask_steal_cb, TRUE, TRUE, 0); - g_signal_connect(ask_steal_cb, "toggled", G_CALLBACK(on_toggle_ask_steal_cb), NULL); + ask_yes_no_cb, TRUE, TRUE, 0); + g_signal_connect(ask_yes_no_cb, "toggled", + G_CALLBACK(on_toggle_ask_yes_no_save_result_cb), (gpointer)option_name);
/* check it by default if it's shown for the first time */ - if (!ask_steal_dir) - gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(ask_steal_cb), TRUE); + if (!ask_result) + gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(ask_yes_no_cb), TRUE);
- gtk_widget_show(ask_steal_cb); + gtk_widget_show(ask_yes_no_cb); gtk_dialog_run(GTK_DIALOG(dialog)); gtk_widget_destroy(dialog);
return response == GTK_RESPONSE_OK; }
+static bool ask_continue_before_steal(const char *base_dir, const char *dump_dir) +{ + char *msg = xasprintf(_("Need writable directory, but '%s' is not writable." + " Move it to '%s' and operate on the moved data?"), + dump_dir, base_dir); + const bool response = ask_yes_no_save_result(msg, "ask_steal_dir"); + free(msg); + return response; +} + struct dump_dir *wizard_open_directory_for_writing(const char *dump_dir_name) { struct dump_dir *dd = open_directory_for_writing(dump_dir_name,
* if the currently process event has configured 'sending-sensitive-data' report-gtk asks for permission to continue with processing of the event
Signed-off-by: Jakub Filak jfilak@redhat.com --- src/gui-wizard-gtk/wizard.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+)
diff --git a/src/gui-wizard-gtk/wizard.c b/src/gui-wizard-gtk/wizard.c index 861d922..26ec654 100644 --- a/src/gui-wizard-gtk/wizard.c +++ b/src/gui-wizard-gtk/wizard.c @@ -2028,6 +2028,22 @@ static void on_page_prepare(GtkNotebook *assistant, GtkWidget *page, gpointer us } }
+static bool get_sensitive_data_permission(const char *event_name) +{ + event_config_t *event_cfg = get_event_config(event_name); + + if (!event_cfg || !event_cfg->ec_sending_sensitive_data) + return true; + + char *msg = xasprintf(_("Event '%s' requires permision to send possibly sensitive data." + "\nDo you want to continue?"), + event_cfg->screen_name ? event_cfg->screen_name : event_name); + const bool response = ask_yes_no_save_result(msg, "ask_send_sensitive_data"); + free(msg); + + return response; +} + static gint select_next_page_no(gint current_page_no, gpointer data) { GtkWidget *page; @@ -2049,6 +2065,17 @@ static gint select_next_page_no(gint current_page_no, gpointer data) }
free(g_event_selected); + + if (!get_sensitive_data_permission(event)) + { + g_event_selected = NULL; + gtk_label_set_text(g_lbl_event_log, _("Reporting was interrupted. Can't continue without" + " permission to send sensitive data. Thank you!")); + terminate_event_chain(); + current_page_no = pages[PAGENO_EVENT_PROGRESS].page_no - 1; + goto again; + } + g_event_selected = xstrdup(event);
if (check_event_config(g_event_selected) != 0)
On 08/09/2012 10:05 AM, Jakub Filak wrote:
- if the currently process event has configured 'sending-sensitive-data' report-gtk asks for permission to continue with processing of the event
Signed-off-by: Jakub Filak jfilak@redhat.com
src/gui-wizard-gtk/wizard.c | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+)
diff --git a/src/gui-wizard-gtk/wizard.c b/src/gui-wizard-gtk/wizard.c index 861d922..26ec654 100644 --- a/src/gui-wizard-gtk/wizard.c +++ b/src/gui-wizard-gtk/wizard.c @@ -2028,6 +2028,22 @@ static void on_page_prepare(GtkNotebook *assistant, GtkWidget *page, gpointer us } }
+static bool get_sensitive_data_permission(const char *event_name) +{
- event_config_t *event_cfg = get_event_config(event_name);
- if (!event_cfg || !event_cfg->ec_sending_sensitive_data)
return true;
- char *msg = xasprintf(_("Event '%s' requires permision to send possibly sensitive data."
Typo. should be "permission" (two 's').
"\nDo you want to continue?"),
event_cfg->screen_name ? event_cfg->screen_name : event_name);
- const bool response = ask_yes_no_save_result(msg, "ask_send_sensitive_data");
- free(msg);
- return response;
+}
static gint select_next_page_no(gint current_page_no, gpointer data) { GtkWidget *page; @@ -2049,6 +2065,17 @@ static gint select_next_page_no(gint current_page_no, gpointer data) }
free(g_event_selected);
if (!get_sensitive_data_permission(event))
{
g_event_selected = NULL;
gtk_label_set_text(g_lbl_event_log, _("Reporting was interrupted. Can't continue without"
" permission to send sensitive data. Thank you!"));
I propose to remove "thank you" (everywhere. I already see it in git in other places). When people are under stress, program trying to emulate human emotions (and inevitably getting it wrong) looks... well, misplaced.
Why "thank you"? How stupid program may know whether thanking is appropriate? Why "!" (shouting)? Let's be short and to the point.
In short: I propose "Processing was cancelled". That's it.
* We do not know that the event is a "reporting" one. Thus, more generic "Processing". * User does know that he just now pressed "no" to the question "Do you want to send sensitive data?", there is no pressing need to repeat that info again.
terminate_event_chain();
current_page_no = pages[PAGENO_EVENT_PROGRESS].page_no - 1;
goto again;
}
g_event_selected = xstrdup(event); if (check_event_config(g_event_selected) != 0)
* if the currently process event has configured 'sending-sensitive-data' report-cli asks for permission to continue with processing of the event
Signed-off-by: Jakub Filak jfilak@redhat.com --- src/cli/cli-report.c | 11 +++++++++++ 1 file changed, 11 insertions(+)
diff --git a/src/cli/cli-report.c b/src/cli/cli-report.c index 77ae34a..2f988fa 100644 --- a/src/cli/cli-report.c +++ b/src/cli/cli-report.c @@ -1003,6 +1003,17 @@ int run_events_chain(const char *dump_dir_name, GList *chain)
if (config) { + if (config->ec_sending_sensitive_data) + { + char *msg = xasprintf(_("Event '%s' requires permision to send possibly sensitive data." + " Do you want to continue?"), + config->screen_name ? config->screen_name : event); + const bool response = ask_yesno(msg); + free(msg); + if (!response) + break; + } + /* can't fail */ ask_for_missing_settings(event);
crash-catcher@lists.fedorahosted.org