Skip to content

Commit

Permalink
Merge pull request #6 from vjacynycz/gcp-cookie-stratio
Browse files Browse the repository at this point in the history
Clear extra cookies with same domain as session cookie
  • Loading branch information
majimenez-stratio authored Feb 14, 2023
2 parents b8fe6f2 + 04510aa commit 2dbac06
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 17 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ c.out
_obj
_test
.idea/
.vscode/

# Architecture specific extensions/prefixes
*.[568vq]
Expand Down
11 changes: 7 additions & 4 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
# Changelog

## 7.1.2-0.1.0 (upcoming)
## 7.4.0-0.2.0 (upcoming)

* Use new versioning schema
* Adapt repo to new CICD
## 7.1.2-0.1.1 (2023-02-01)

* [EOS-10808] Clear extra cookies with same domain as session cookie

## 7.1.2 (September 10, 2021)
## 7.1.2-0.1.0 (2022-07-21)

* Use new versioning schema
* Adapt repo to new CICD
* Bump alpine version to fix vulnerabilities
* [EOS-5416] Make sis path configurable
* [EOS-5112] Clear extra cookies whenever session cookie is removed
Expand Down
14 changes: 1 addition & 13 deletions oauthproxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -460,18 +460,6 @@ func (p *OAuthProxy) makeCookie(req *http.Request, name string, value string, ex
}
}

func (p *OAuthProxy) makeExtraCookie(req *http.Request, name string, value string, expiration time.Duration, now time.Time) *http.Cookie {
return &http.Cookie{
Name: name,
Value: value,
Path: p.CookiePath,
HttpOnly: p.CookieHTTPOnly,
Secure: p.CookieSecure,
Expires: now.Add(expiration),
SameSite: cookies.ParseSameSite(p.CookieSameSite),
}
}

// ClearCSRFCookie creates a cookie to unset the CSRF cookie stored in the user's
// session
func (p *OAuthProxy) ClearCSRFCookie(rw http.ResponseWriter, req *http.Request) {
Expand Down Expand Up @@ -503,7 +491,7 @@ func (p *OAuthProxy) ClearExtraCookies(rw http.ResponseWriter, req *http.Request
continue
}
logger.Printf("Extra cookie %s found in request: %#v", name, c)
http.SetCookie(rw, p.makeExtraCookie(req, c.Name, "", time.Hour*-1, time.Now()))
http.SetCookie(rw, p.makeCookie(req, c.Name, "", time.Hour*-1, time.Now()))
}
}

Expand Down

0 comments on commit 2dbac06

Please sign in to comment.