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

@@ -110,6 +110,7 @@ type (
UserAgent *string
ConsentData json.RawMessage
Action coredata.CookieConsentAction
SdkVersion string
}
RecordConsentRequest struct {
@@ -119,6 +120,7 @@ type (
UserAgent *string
ConsentData json.RawMessage
Action coredata.CookieConsentAction
SdkVersion string
}
DetectedCookie struct {
@@ -1675,6 +1677,7 @@ func (s *Service) CreateCookieConsentRecord(
UserAgent: req.UserAgent,
ConsentData: req.ConsentData,
Action: req.Action,
SdkVersion: req.SdkVersion,
CreatedAt: time.Now(),
}
@@ -2060,6 +2063,7 @@ func (s *Service) RecordConsent(
UserAgent: req.UserAgent,
ConsentData: req.ConsentData,
Action: req.Action,
SdkVersion: req.SdkVersion,
CreatedAt: time.Now(),
}