mirror of
				https://github.com/zadam/trilium.git
				synced 2025-11-04 05:28:59 +01:00 
			
		
		
		
	fix(csrf): set more secure cookieOptions settings
- `sameSite` - previous setting inherited from csurf was to simply not set it at all, which makes all browser nag in their dev console output. They will default to "Lax" for these type of cookies in the future. We can even use "strict" here though for our use case: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Set-Cookie#samesitesamesite-value - `httpOnly`: should be enabled for the csrf cookie as well for the session cookie it already is enabled. https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Set-Cookie#httponly
This commit is contained in:
		
							parent
							
								
									ec19ccd7a7
								
							
						
					
					
						commit
						5f605b3a91
					
				@ -6,8 +6,8 @@ const doubleCsrfUtilities = doubleCsrf({
 | 
			
		||||
    cookieOptions: {
 | 
			
		||||
        path: "", // empty, so cookie is valid only for the current path
 | 
			
		||||
        secure: false,
 | 
			
		||||
        sameSite: false,
 | 
			
		||||
        httpOnly: false
 | 
			
		||||
        sameSite: "strict",
 | 
			
		||||
        httpOnly: true
 | 
			
		||||
    },
 | 
			
		||||
    cookieName: "_csrf"
 | 
			
		||||
});
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user