mirror of
				https://github.com/zulip/zulip.git
				synced 2025-11-04 05:53:43 +00:00 
			
		
		
		
	Make cookie domain configurable via zulip.conf
Adapted from a cherry-pick picked of Zev's fda2d99d9e9a07951d11fcd9fc61cf229988f471. (imported from commit 4701511d94f9ae34523202ca395e72ceb7a1adfb)
This commit is contained in:
		@@ -137,6 +137,15 @@ if DEPLOYED:
 | 
			
		||||
    SESSION_COOKIE_SECURE = True
 | 
			
		||||
    CSRF_COOKIE_SECURE    = True
 | 
			
		||||
 | 
			
		||||
try:
 | 
			
		||||
    # For get_updates hostname sharding
 | 
			
		||||
    domain = config_file.get('django', 'cookie_domain')
 | 
			
		||||
    SESSION_COOKIE_DOMAIN = '.' + domain
 | 
			
		||||
    CSRF_COOKIE_DOMAIN    = '.' + domain
 | 
			
		||||
except ConfigParser.Error:
 | 
			
		||||
    # Failing here is OK
 | 
			
		||||
    pass
 | 
			
		||||
 | 
			
		||||
# Prevent Javascript from reading the CSRF token from cookies.  Our code gets
 | 
			
		||||
# the token from the DOM, which means malicious code could too.  But hiding the
 | 
			
		||||
# cookie will slow down some attackers.
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user