Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F14011000
D7979.id.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
2 KB
Referenced Files
None
Subscribers
None
D7979.id.diff
View Options
Index: src/aphront/AphrontRequest.php
===================================================================
--- src/aphront/AphrontRequest.php
+++ src/aphront/AphrontRequest.php
@@ -273,11 +273,26 @@
return $this->validateCSRF();
}
+ final public function setCookiePrefix($prefix) {
+ $this->cookiePrefix = $prefix;
+ return $this;
+ }
+
+ final private function getPrefixedCookieName($name) {
+ if (strlen($this->cookiePrefix)) {
+ return $this->cookiePrefix.'_'.$name;
+ } else {
+ return $name;
+ }
+ }
+
final public function getCookie($name, $default = null) {
+ $name = $this->getPrefixedCookieName($name);
return idx($_COOKIE, $name, $default);
}
final public function clearCookie($name) {
+ $name = $this->getPrefixedCookieName($name);
$this->setCookie($name, '', time() - (60 * 60 * 24 * 30));
unset($_COOKIE[$name]);
}
@@ -342,6 +357,7 @@
$expire = time() + (60 * 60 * 24 * 365 * 5);
}
+ $name = $this->getPrefixedCookieName($name);
if (php_sapi_name() == 'cli') {
// Do nothing, to avoid triggering "Cannot modify header information"
Index: src/aphront/configuration/AphrontDefaultApplicationConfiguration.php
===================================================================
--- src/aphront/configuration/AphrontDefaultApplicationConfiguration.php
+++ src/aphront/configuration/AphrontDefaultApplicationConfiguration.php
@@ -107,9 +107,12 @@
$data += $parser->parseQueryString(idx($_SERVER, 'QUERY_STRING', ''));
+ $cookie_prefix = PhabricatorEnv::getEnvConfig('phabricator.cookie-prefix');
+
$request = new AphrontRequest($this->getHost(), $this->getPath());
$request->setRequestData($data);
$request->setApplicationConfiguration($this);
+ $request->setCookiePrefix($cookie_prefix);
return $request;
}
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 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
Details
Attached
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
6730248
Default Alt Text
D7979.id.diff (2 KB)
Attached To
Mode
D7979: Aprhont - Adding cookie-prefix, as config option, and into cookie methods
Attached
Detach File
Event Timeline
Log In to Comment