Bug 23634: Prevent non-superlibrarians from editing superlibarian emails
This patchset prevents a non-superlibrarian user from editing a superlibrarians email address via memberentry. This is to prevent a privilege escalation vulnerability whereby a user could update a superlibrarians contact details to match their own and then request a password reset via the OPAC. Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
This commit is contained in:
parent
312cd6dfd2
commit
087af360cc
|
|
@ -222,7 +222,11 @@
|
|||
<label for="B_email">
|
||||
[% END %]
|
||||
Email: </label>
|
||||
[% IF ( NoUpdateEmail ) %]
|
||||
<input type="text" id="B_email" name="B_email" size="45" value="[% patron.B_email | html %]" disabled="disabled"/>
|
||||
[% ELSE %]
|
||||
<input type="text" id="B_email" name="B_email" size="45" value="[% patron.B_email | html %]" />
|
||||
[% END %]
|
||||
[% IF ( mandatoryB_email ) %]<span class="required">Required</span>[% END %]
|
||||
</li>
|
||||
[% END %]
|
||||
|
|
|
|||
|
|
@ -693,7 +693,11 @@ legend:hover {
|
|||
[% END %]
|
||||
Primary email:
|
||||
</label>
|
||||
[% IF ( NoUpdateEmail ) %]
|
||||
<input type="text" id="email" name="email" size="45" value="[% patron.email | html %]" disabled="disabled" />
|
||||
[% ELSE %]
|
||||
<input type="text" id="email" name="email" size="45" value="[% patron.email | html %]" />
|
||||
[% END %]
|
||||
[% IF ( mandatoryemail ) %]
|
||||
<span class="required">Required</span>
|
||||
[% END %]
|
||||
|
|
@ -710,12 +714,16 @@ legend:hover {
|
|||
[% END %]
|
||||
Secondary email:
|
||||
</label>
|
||||
[% IF ( NoUpdateEmail ) %]
|
||||
<input type="text" id="emailpro" name="emailpro" size="45" value="[% patron.emailpro | html %]" disabled="disabled"/>
|
||||
[% ELSE %]
|
||||
<input type="text" id="emailpro" name="emailpro" size="45" value="[% patron.emailpro | html %]" />
|
||||
[% END %]
|
||||
[% IF ( mandatoryemailpro ) %]
|
||||
<span class="required">Required</span>
|
||||
[% END %]
|
||||
</li>
|
||||
[% END # /UNLESS noemailpro %]
|
||||
[% END #/UNLESS noemailpro %]
|
||||
|
||||
[% UNLESS nofax %]
|
||||
<li>
|
||||
|
|
|
|||
|
|
@ -101,6 +101,7 @@ my $step = $input->param('step') || 0;
|
|||
my @errors;
|
||||
my $borrower_data;
|
||||
my $NoUpdateLogin;
|
||||
my $NoUpdateEmail;
|
||||
my $userenv = C4::Context->userenv;
|
||||
my @messages;
|
||||
|
||||
|
|
@ -170,6 +171,11 @@ if ( $op eq 'modify' or $op eq 'save' or $op eq 'duplicate' ) {
|
|||
my $logged_in_user = Koha::Patrons->find( $loggedinuser );
|
||||
output_and_exit_if_error( $input, $cookie, $template, { module => 'members', logged_in_user => $logged_in_user, current_patron => $patron } );
|
||||
|
||||
# check permission to modify email info.
|
||||
if ( $patron->is_superlibrarian && !$logged_in_user->is_superlibrarian ) {
|
||||
$NoUpdateEmail = 1;
|
||||
}
|
||||
|
||||
$borrower_data = $patron->unblessed;
|
||||
$borrower_data->{category_type} = $patron->category->category_type;
|
||||
}
|
||||
|
|
@ -210,7 +216,8 @@ if ( $op eq 'insert' || $op eq 'modify' || $op eq 'save' || $op eq 'duplicate' )
|
|||
push(@errors,"ERROR_$_");
|
||||
}
|
||||
}
|
||||
# check permission to modify login info.
|
||||
|
||||
# check permission to modify login info.
|
||||
if (ref($borrower_data) && ($borrower_data->{'category_type'} eq 'S') && ! (C4::Auth::haspermission($userenv->{'id'},{'staffaccess'=>1})) ) {
|
||||
$NoUpdateLogin = 1;
|
||||
}
|
||||
|
|
@ -832,6 +839,7 @@ $template->param(
|
|||
modify => $modify,
|
||||
nok => $nok,#flag to know if an error
|
||||
NoUpdateLogin => $NoUpdateLogin,
|
||||
NoUpdateEmail => $NoUpdateEmail,
|
||||
);
|
||||
|
||||
# Generate CSRF token
|
||||
|
|
|
|||
Loading…
Reference in New Issue