Add banner ID to probo_consent cookie

Include a `bid` field in the consent cookie so it explicitly
identifies which cookie banner it belongs to, making validation
direct instead of relying on the visitor ID as an implicit
discriminator. Existing cookies without `bid` self-heal on the
next load by falling through to the API fetch.

Signed-off-by: Émile Ré <emile@getprobo.com>
This commit is contained in:
Émile Ré
2026-04-24 18:36:45 +04:00
parent d9db93911b
commit d7eec08cd2
8 changed files with 54 additions and 1 deletions

View File

@@ -122,6 +122,7 @@ type (
Version int `json:"version"`
Action coredata.CookieConsentAction `json:"action"`
ConsentData json.RawMessage `json:"consent_data"`
SdkVersion string `json:"sdk_version"`
}
postConsentResponse struct {
@@ -155,6 +156,7 @@ func (h *Handler) handlePostConsent(w http.ResponseWriter, r *http.Request) {
UserAgent: &ua,
ConsentData: body.ConsentData,
Action: body.Action,
SdkVersion: body.SdkVersion,
}
record, err := h.cookieBannerSvc.RecordConsent(r.Context(), bannerID, req)