From e4466c90fa4a4fc857caeeec1c2996fa54bd77c1 Mon Sep 17 00:00:00 2001 From: Byron Jones Date: Wed, 16 May 2012 15:36:41 +0800 Subject: Bug 752544: updates to the lost device investigation form --- extensions/BMO/Extension.pm | 48 +++++++++--- .../bug/create/comment-employee-incident.txt.tmpl | 18 +++-- .../bug/create/create-employee-incident.html.tmpl | 87 ++++++++++++++-------- 3 files changed, 104 insertions(+), 49 deletions(-) (limited to 'extensions') diff --git a/extensions/BMO/Extension.pm b/extensions/BMO/Extension.pm index ab0be0819..4b9a1d2fb 100644 --- a/extensions/BMO/Extension.pm +++ b/extensions/BMO/Extension.pm @@ -859,7 +859,6 @@ sub post_bug_after_creation { my ($self, $args) = @_; my $vars = $args->{vars}; my $bug = $vars->{bug}; - my $template = Bugzilla->template; if (Bugzilla->input_params->{format} && Bugzilla->input_params->{format} eq 'employee-incident' @@ -868,9 +867,12 @@ sub post_bug_after_creation { my $error_mode_cache = Bugzilla->error_mode; Bugzilla->error_mode(ERROR_MODE_DIE); - my $new_bug; + my $template = Bugzilla->template; + my $cgi = Bugzilla->cgi; + + my ($investigate_bug, $ssh_key_bug); + my $old_user = Bugzilla->user; eval { - my $old_user = Bugzilla->user; Bugzilla->set_user(Bugzilla::User->new({ name => 'nobody@mozilla.org' })); my $new_user = Bugzilla->user; @@ -880,13 +882,15 @@ sub post_bug_after_creation { Bugzilla::Group->new({ name => 'infra' }), Bugzilla::Group->new({ name => 'infrasec' }) ]; - my $comment; - $vars->{no_display_action_needed} = 1; + my $recipients = { changer => $new_user }; $vars->{original_reporter} = $old_user; + + my $comment; + $cgi->param('display_action', ''); $template->process('bug/create/comment-employee-incident.txt.tmpl', $vars, \$comment) || ThrowTemplateError($template->error()); - $new_bug = Bugzilla::Bug->create({ + $investigate_bug = Bugzilla::Bug->create({ short_desc => 'Investigate Lost Device', product => 'mozilla.org', component => 'Security Assurance: Incident', @@ -900,17 +904,39 @@ sub post_bug_after_creation { version => 'other', dependson => $bug->bug_id, }); - - my $recipients = { changer => $new_user }; - Bugzilla::BugMail::Send($new_bug->id, $recipients); + $bug->set_all({ blocked => { add => [ $investigate_bug->bug_id ] }}); + Bugzilla::BugMail::Send($investigate_bug->id, $recipients); Bugzilla->set_user($old_user); + $vars->{original_reporter} = ''; + $comment = ''; + $cgi->param('display_action', 'ssh'); + $template->process('bug/create/comment-employee-incident.txt.tmpl', $vars, \$comment) + || ThrowTemplateError($template->error()); + + $ssh_key_bug = Bugzilla::Bug->create({ + short_desc => 'Disable/Regenerate SSH Key', + product => $bug->product, + component => $bug->component, + bug_severity => 'critical', + cc => $bug->cc, + groups => [ map { $_->{name} } @{ $bug->groups } ], + comment => $comment, + op_sys => 'All', + rep_platform => 'All', + version => 'other', + dependson => $bug->bug_id, + }); + $bug->set_all({ blocked => { add => [ $ssh_key_bug->bug_id ] }}); + Bugzilla::BugMail::Send($ssh_key_bug->id, $recipients); }; + my $error = $@; + Bugzilla->set_user($old_user); Bugzilla->error_mode($error_mode_cache); - if ($@ || !$new_bug) { - warn "Failed to create secondary employee-incident bug: $@" if $@; + if ($error || !$investigate_bug || !$ssh_key_bug) { + warn "Failed to create additional employee-incident bug: $error" if $error; $vars->{'message'} = 'employee_incident_creation_failed'; } } diff --git a/extensions/BMO/template/en/default/bug/create/comment-employee-incident.txt.tmpl b/extensions/BMO/template/en/default/bug/create/comment-employee-incident.txt.tmpl index ebd700e16..1b0902d64 100644 --- a/extensions/BMO/template/en/default/bug/create/comment-employee-incident.txt.tmpl +++ b/extensions/BMO/template/en/default/bug/create/comment-employee-incident.txt.tmpl @@ -25,14 +25,20 @@ Reporter: [% original_reporter.identity FILTER none %] [%- END -%] - [% IF !no_display_action_needed %] -Action needed: Please immediately reset the LDAP password for this user. -The user reported that their mobile or laptop device has been lost or stolen. -This ticket was automatically generated from the employee incident reporting -form. A second ticket has been filed (see blocker bugs) for InfraSec to review the -impact of this lost device. + [% IF cgi.param('display_action') %] + [% IF cgi.param('display_action') == 'ldap' %] +Action needed: Please immediately reset the LDAP password for this user. + [% ELSIF cgi.param('display_action') == 'ssh' %] +Action needed: Please immediately disable the SSH key for this user. + [% END %] + +The user reported that their mobile or laptop device has been lost or stolen. +This ticket was automatically generated from the employee incident reporting +form. An additional ticket has been filed (see blocker bugs) for InfraSec to +review the impact of this lost device. [% END %] +Type of device: [% cgi.param('device') %] Was the device encrypted?: [% cgi.param('encrypted') %] Any user data on the device?: [% cgi.param('userdata') %] [% IF cgi.param('userdata') == 'Yes' %] diff --git a/extensions/BMO/template/en/default/bug/create/create-employee-incident.html.tmpl b/extensions/BMO/template/en/default/bug/create/create-employee-incident.html.tmpl index df7ba24df..2bbacdb12 100644 --- a/extensions/BMO/template/en/default/bug/create/create-employee-incident.html.tmpl +++ b/extensions/BMO/template/en/default/bug/create/create-employee-incident.html.tmpl @@ -18,19 +18,18 @@ # David Lawrence #%] -[% PROCESS global/variables.none.tmpl %] - -[% PROCESS global/header.html.tmpl - title = "Mozilla Corporation/Foundation Employee Incident" +[% PROCESS global/variables.none.tmpl %] + +[% PROCESS global/header.html.tmpl + title = "Mozilla Corporation/Foundation Employee Incident" %] - -[% USE Bugzilla %] + +[% USE Bugzilla %]

Please use this form for employee incidents only!

If you have a [% terms.bug %] to file, go here.

-

* Required Fields

+

* Required Fields

@@ -142,6 +145,7 @@ + @@ -161,7 +165,7 @@ * Summary: @@ -171,6 +175,25 @@ @@ -220,13 +243,13 @@ @@ -249,7 +272,7 @@ [% comment FILTER html %] - +
-
Stolen Details: + + + + @@ -197,10 +220,10 @@ - +
+ + + +
-
  @@ -262,4 +285,4 @@ Thanks for contacting us. You will be notified by email of any progress made in resolving your request.

-[% PROCESS global/footer.html.tmpl %] +[% PROCESS global/footer.html.tmpl %] -- cgit v1.2.3-24-g4f1b