mirror of
https://gitlab.archlinux.org/archlinux/aurweb.git
synced 2025-02-03 10:43:03 +01:00
Use secure and httponly session cookies
As discussed on the mailing list, enable "secure" and "httponly" for session cookies to prevent them from being transferred over insecure connections. Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
This commit is contained in:
parent
1c9db1d1f1
commit
00e4e0294f
3 changed files with 4 additions and 4 deletions
|
@ -15,7 +15,7 @@ if (isset($_COOKIE["AURSID"])) {
|
||||||
$q.= mysql_real_escape_string($_COOKIE["AURSID"]) . "'";
|
$q.= mysql_real_escape_string($_COOKIE["AURSID"]) . "'";
|
||||||
db_query($q, $dbh);
|
db_query($q, $dbh);
|
||||||
# setting expiration to 1 means '1 second after midnight January 1, 1970'
|
# setting expiration to 1 means '1 second after midnight January 1, 1970'
|
||||||
setcookie("AURSID", "", 1, "/");
|
setcookie("AURSID", "", 1, "/", null, !empty($_SERVER['HTTPS']), true);
|
||||||
unset($_COOKIE['AURSID']);
|
unset($_COOKIE['AURSID']);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -658,7 +658,7 @@ function try_login() {
|
||||||
else
|
else
|
||||||
$cookie_time = 0;
|
$cookie_time = 0;
|
||||||
|
|
||||||
setcookie("AURSID", $new_sid, $cookie_time, "/");
|
setcookie("AURSID", $new_sid, $cookie_time, "/", null, !empty($_SERVER['HTTPS']), true);
|
||||||
header("Location: " . $_SERVER['PHP_SELF'].'?'.$_SERVER['QUERY_STRING']);
|
header("Location: " . $_SERVER['PHP_SELF'].'?'.$_SERVER['QUERY_STRING']);
|
||||||
$login_error = "";
|
$login_error = "";
|
||||||
|
|
||||||
|
|
|
@ -47,7 +47,7 @@ function check_sid($dbh=NULL) {
|
||||||
# clear out the hacker's cookie, and send them to a naughty page
|
# clear out the hacker's cookie, and send them to a naughty page
|
||||||
# why do you have to be so harsh on these people!?
|
# why do you have to be so harsh on these people!?
|
||||||
#
|
#
|
||||||
setcookie("AURSID", "", 1, "/");
|
setcookie("AURSID", "", 1, "/", null, !empty($_SERVER['HTTPS']), true);
|
||||||
unset($_COOKIE['AURSID']);
|
unset($_COOKIE['AURSID']);
|
||||||
} elseif ($failed == 2) {
|
} elseif ($failed == 2) {
|
||||||
# session id timeout was reached and they must login again.
|
# session id timeout was reached and they must login again.
|
||||||
|
@ -56,7 +56,7 @@ function check_sid($dbh=NULL) {
|
||||||
$q.= mysql_real_escape_string($_COOKIE["AURSID"]) . "'";
|
$q.= mysql_real_escape_string($_COOKIE["AURSID"]) . "'";
|
||||||
db_query($q, $dbh);
|
db_query($q, $dbh);
|
||||||
|
|
||||||
setcookie("AURSID", "", 1, "/");
|
setcookie("AURSID", "", 1, "/", null, !empty($_SERVER['HTTPS']), true);
|
||||||
unset($_COOKIE['AURSID']);
|
unset($_COOKIE['AURSID']);
|
||||||
} else {
|
} else {
|
||||||
# still logged in and haven't reached the timeout, go ahead
|
# still logged in and haven't reached the timeout, go ahead
|
||||||
|
|
Loading…
Add table
Reference in a new issue