-
Notifications
You must be signed in to change notification settings - Fork 45
sameSite strict for production change #172
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. Weβll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
@@ -3,6 +3,7 @@ | |||||||||
import java.util.Arrays; | ||||||||||
import java.util.Optional; | ||||||||||
|
||||||||||
import org.springframework.beans.factory.annotation.Value; | ||||||||||
import org.springframework.stereotype.Service; | ||||||||||
|
||||||||||
import jakarta.servlet.http.Cookie; | ||||||||||
|
@@ -11,6 +12,9 @@ | |||||||||
|
||||||||||
@Service | ||||||||||
public class CookieUtil { | ||||||||||
|
||||||||||
@Value("${isProduction}") | ||||||||||
private Boolean isProduction; | ||||||||||
Comment on lines
+16
to
+17
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. π‘ Verification agent π§© Analysis chainEnsure configuration property is defined in all environments. The Consider adding a default value in case the property is not defined: - @Value("${isProduction}")
+ @Value("${isProduction:false}") π Script executed: #!/bin/bash
# Verify if the isProduction property is defined in configuration files
echo "Checking for isProduction property in configuration files..."
fd -e yml -e properties -e yaml | xargs grep -l "isProduction" || echo "Warning: isProduction property not found in any configuration files" Length of output: 338 Action Required: Ensure Default Value for "isProduction" Property The verification indicates that the - @Value("${isProduction}")
+ @Value("${isProduction:false}") Additionally, confirm that any deployment or configuration management setups align with this change. π Committable suggestion
Suggested change
|
||||||||||
|
||||||||||
public Optional<String> getCookieValue(HttpServletRequest request, String cookieName) { | ||||||||||
Cookie[] cookies = request.getCookies(); | ||||||||||
|
@@ -39,6 +43,9 @@ public void addJwtTokenToCookie(String Jwttoken, HttpServletResponse response, H | |||||||||
|
||||||||||
// Set the SameSite attribute for cross-site request handling (if needed) | ||||||||||
String sameSite = "None"; // Allow cross-site cookies (can be 'Strict', 'Lax', or 'None') | ||||||||||
if(isProduction) { | ||||||||||
sameSite= "Strict"; | ||||||||||
} | ||||||||||
cookie.setSecure(true); | ||||||||||
|
||||||||||
// Build the Set-Cookie header manually (to add SameSite attribute support) | ||||||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey this can't be false.
We should ideally be taking the variable from CI environment.
Use @@
@ravishanigarapu please check.