Page MenuHomePhabricator

D7979.id18051.diff
No OneTemporary

D7979.id18051.diff

Index: src/aphront/AphrontRequest.php
===================================================================
--- src/aphront/AphrontRequest.php
+++ src/aphront/AphrontRequest.php
@@ -274,12 +274,16 @@
}
final public function getCookie($name, $default = null) {
- return idx($_COOKIE, $name, $default);
+ $cookie_prefix = PhabricatorEnv::getEnvConfig('phabricator.cookie-prefix');
+ $cookie_name = $cookie_prefix . $name;
+ return idx($_COOKIE, $cookie_name, $default);
}
final public function clearCookie($name) {
- $this->setCookie($name, '', time() - (60 * 60 * 24 * 30));
- unset($_COOKIE[$name]);
+ $cookie_prefix = PhabricatorEnv::getEnvConfig('phabricator.cookie-prefix');
+ $cookie_name = $cookie_prefix . $name;
+ $this->setCookie($cookie_name, '', time() - (60 * 60 * 24 * 30));
+ unset($_COOKIE[$cookie_name]);
}
final public function setCookie($name, $value, $expire = null) {
@@ -342,6 +346,9 @@
$expire = time() + (60 * 60 * 24 * 365 * 5);
}
+ $cookie_prefix = PhabricatorEnv::getEnvConfig('phabricator.cookie-prefix');
+ $cookie_name = $cookie_prefix . $name;
+
if (php_sapi_name() == 'cli') {
// Do nothing, to avoid triggering "Cannot modify header information"
@@ -351,7 +358,7 @@
// test or not. Move this actual call to HTTPSink?
} else {
setcookie(
- $name,
+ $cookie_name,
$value,
$expire,
$path = '/',
@@ -360,7 +367,7 @@
$http_only = true);
}
- $_COOKIE[$name] = $value;
+ $_COOKIE[$cookie_name] = $value;
return $this;
}
Index: src/applications/config/option/PhabricatorCoreConfigOptions.php
===================================================================
--- src/applications/config/option/PhabricatorCoreConfigOptions.php
+++ src/applications/config/option/PhabricatorCoreConfigOptions.php
@@ -76,6 +76,16 @@
->addExample('America/Chicago', pht('US Central (CDT)'))
->addExample('America/Boise', pht('US Mountain (MDT)'))
->addExample('America/Los_Angeles', pht('US West (PDT)')),
+ $this->newOption('phabricator.cookie-prefix', 'string', null)
+ ->setSummary(
+ pht("Set a cookie-prefix string Phabricator should use to prefix ".
+ "cookie names"))
+ ->setDescription(
+ pht(
+ "Cookies set for x.com are also sent for y.x.com. Assuming ".
+ "Phabricator instances are running on both domains, this will ".
+ "create a collision preventing you from logging in."))
+ ->addExample('dev', pht('Prefix cookie with "dev"')),
$this->newOption('phabricator.show-beta-applications', 'bool', false)
->setBoolOptions(
array(

File Metadata

Mime Type
text/plain
Expires
Fri, Nov 1, 3:17 PM (1 w, 4 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
6724585
Default Alt Text
D7979.id18051.diff (2 KB)

Event Timeline