Bug 9102 : Followup Set HttpOnly on the CGISESSID cookie

Signed-off-by: Galen Charlton <gmc@esilibrary.com>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Jared Camins-Esakov <jcamins@cpbibliography.com>
This commit is contained in:
Jonathan Druart 2012-12-03 11:17:27 +01:00 committed by Jared Camins-Esakov
parent a51a78b71c
commit bc5f5f4f01
4 changed files with 33 additions and 12 deletions

View File

@ -264,12 +264,13 @@ sub get_template_and_user {
$_->{'time'},
) foreach @recentSearches;
# And then, delete the cookie's content
my $newsearchcookie = $in->{'query'}->cookie(
-name => 'KohaOpacRecentSearches',
-value => freeze([]),
-expires => ''
);
# And then, delete the cookie's content
my $newsearchcookie = $in->{'query'}->cookie(
-name => 'KohaOpacRecentSearches',
-value => freeze([]),
-HttpOnly => 1,
-expires => ''
);
$cookie = [$cookie, $newsearchcookie];
}
}
@ -632,8 +633,8 @@ sub checkauth {
# when using authentication against multiple CAS servers, as configured in Auth_cas_servers.yaml
my $casparam = $query->param('cas');
if ( $userid = $ENV{'REMOTE_USER'} ) {
# Using Basic Authentication, no cookies required
if ( $userid = $ENV{'REMOTE_USER'} ) {
# Using Basic Authentication, no cookies required
$cookie = $query->cookie(
-name => 'CGISESSID',
-value => '',
@ -1135,7 +1136,11 @@ sub check_api_auth {
$sessionID = undef;
return ("expired", undef, undef);
} else {
my $cookie = $query->cookie( CGISESSID => $session->id );
my $cookie = $query->cookie(
-name => 'CGISESSID',
-value => $session->id,
-HttpOnly => 1,
);
$session->param('lasttime',time());
my $flags = haspermission($userid, $flagsrequired);
if ($flags) {
@ -1179,7 +1184,11 @@ sub check_api_auth {
my $sessionID = $session->id;
C4::Context->_new_userenv($sessionID);
my $cookie = $query->cookie(CGISESSID => $sessionID);
my $cookie = $query->cookie(
-name => 'CGISESSID',
-value => $sessionID,
-HttpOnly => 1,
);
if ( $return == 1 ) {
my (
$borrowernumber, $firstname, $surname,

View File

@ -305,6 +305,7 @@ sub setlanguagecookie {
my $cookie = $query->cookie(
-name => 'KohaOpacLanguage',
-value => $language,
-HttpOnly => 1,
-expires => '+3y'
);
print $query->redirect(

View File

@ -418,6 +418,7 @@ if ($op eq "additem") {
-name => 'LastCreatedItem',
# We uri_escape the whole freezed structure so we're sure we won't have any encoding problems
-value => uri_escape_utf8( freeze( $record ) ),
-HttpOnly => 1,
-expires => ''
);

View File

@ -262,7 +262,11 @@ sub checkauth {
$session->param('emailaddress'),
$session->param('branchprinter')
);
$cookie = $query->cookie( CGISESSID => $session->id );
$cookie = $query->cookie(
-name => 'CGISESSID',
-value => $session->id,
-HttpOnly => 1,
);
$loggedin = 1;
$userid = $session->param('cardnumber');
}
@ -298,7 +302,11 @@ sub checkauth {
# printf L "%20s from %16s logged in at %30s.\n", $userid,
# $ENV{'REMOTE_ADDR'}, $time;
# close L;
$cookie = $query->cookie( CGISESSID => $sessionID );
$cookie = $query->cookie(
-name => 'CGISESSID',
-value => $sessionID,
-HttpOnly => 1,
);
if ( $return == 2 ) {
#Only superlibrarian should have access to this page.
@ -342,6 +350,7 @@ sub checkauth {
$cookie = $query->cookie(
-name => 'CGISESSID',
-value => '',
-HttpOnly => 1,
-expires => ''
);
}
@ -382,6 +391,7 @@ sub checkauth {
$cookie = $query->cookie(
-name => 'CGISESSID',
-value => $sessionID,
-HttpOnly => 1,
-expires => ''
);
print $query->header(