Skip to content
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

fix: enable HttpOnly and Secure using TLS #24524

Merged
merged 4 commits into from
Dec 20, 2023

Conversation

davidby-influx
Copy link
Contributor

When TLS is enabled, set the HttpOnly and
Secure flags when a cookie is created.

closes: #24522

When TLS is enabled, set the HttpOnly and
Secure flags when a cookie is created.

closes: #24522
@@ -208,6 +208,8 @@ func encodeCookieSession(w http.ResponseWriter, s *influxdb.Session) {
Path: "/api/", // since UI doesn't need it, limit cookie usage to API requests
Expires: s.ExpiresAt,
SameSite: http.SameSiteStrictMode,
HttpOnly: tlsEnabled,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the patch! HttpOnly should be set regardless of tlsEnabled (we can still help guard against XSS when not using TLS after all).

@davidby-influx davidby-influx merged commit 8e8700f into main-2.x Dec 20, 2023
26 checks passed
@davidby-influx davidby-influx deleted the DSB_secure_cookie_main-2.x branch December 20, 2023 19:49
davidby-influx added a commit that referenced this pull request Dec 20, 2023
Set the HttpOnly and, when TLS is enabled,
Secure flags on cookies

closes: #24522

(cherry picked from commit 8e8700f)

closes #24523
davidby-influx added a commit that referenced this pull request Dec 20, 2023
Set the HttpOnly and, when TLS is enabled,
Secure flags on cookies

closes: #24522

(cherry picked from commit 8e8700f)

closes #24523
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants