influxdb/kit/transport/http
Jamie Strandboge c40ad64604
feat(security): set SameSite=strict on session cookie (#23723)
* feat(security): set SameSite=strict on session cookie

Use SameSite=Strict as a hardening measure against cross-origin attacks.
While browsers have been moving to default to SameSite=Lax, explicitly
setting SameSite ensures that all browsers enforce it consistently.
While 'lax' is a reasonable hardening choice, the cookie is only
required for requests to '/api/...' and we don't expect 3rd party links
into '/api/...', so this stricter setting should be safe in terms of
usability. Furthermore, while our GET APIs are not state-changing, using
'strict' future-proofs us in case we add a state-changing GET API ('lax'
allows cross-origin 'GET' requests for increased usability for read-only
requests).

Also add a comment to SetCORS() lack of Access-Control-Allow-Credentials
as a reminder that its omission is intentional for defense in depth on
when to attach the cookie to a request.

* chore: mention that Lax sends the cookie with other safe HTTP methods
2022-09-15 15:30:19 -05:00
..
api.go fix: more expressive errors (#22448) 2021-09-13 15:12:35 -04:00
api_test.go fix: more expressive errors (#22448) 2021-09-13 15:12:35 -04:00
error_handler.go fix: more expressive errors (#22448) 2021-09-13 15:12:35 -04:00
error_handler_test.go fix: more expressive errors (#22448) 2021-09-13 15:12:35 -04:00
feature_controller.go fix: correct various typos (#19987) 2020-11-11 13:54:21 -05:00
handler.go chore(http): pull out eror handler into kit pkg for portability 2020-02-03 12:39:47 -08:00
middleware.go feat(security): set SameSite=strict on session cookie (#23723) 2022-09-15 15:30:19 -05:00
middleware_test.go feat(telemetry): Do not record telemetry data for invalid requests; replace invalid static asset paths with a slug (#21958) 2021-07-29 10:22:11 -06:00
status_response_writer.go chore(http): fixup middleware stack and normalize metrics into same buckets for id fields 2020-01-08 15:05:34 -08:00