Updating Klaviyo PK new format#5009
Conversation
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 835a034. Configure here.
| defaultClient = common.SaneHttpClient() | ||
| // Make sure that your group is surrounded in boundary characters such as below to reduce false positives. | ||
| keyPat = regexp.MustCompile(`\b(pk_[[:alnum:]]{34})\b`) | ||
| keyPat = regexp.MustCompile(`\b(pk_([0-9a-f]{34}|[A-Za-z0-9]{6}_[0-9a-f]{34}))\b`) |
There was a problem hiding this comment.
Regex restricts old key format to hex-only characters
High Severity
The old-format key matching changed from [[:alnum:]]{34} (any alphanumeric) to [0-9a-f]{34} (lowercase hex only). This means old keys containing characters g–z or any uppercase letters will no longer be detected. The existing test's validPattern (pk_1234567890abcdefghijklmnopqrstuvwx) contains non-hex characters and would fail to match this new regex, confirming the regression.
Reviewed by Cursor Bugbot for commit 835a034. Configure here.


Description:
Updating the new Klaviyo Private Key format that supports both new and old pk.
Checklist:
make test-community)?make lintthis requires golangci-lint)?Note
Low Risk
Single-regex change in the Klaviyo detector with no auth or verification logic changes; may miss old keys that used non-hex alphanumeric bodies.
Overview
Updates the Klaviyo private key detector regex so it recognizes both the legacy
pk_+ 34 lowercase hex body and the newerpk_+ 6-character prefix +_+ 34 hex body.The previous pattern accepted any 34 alphanumeric characters after
pk_; the new one is stricter on the legacy path (hex only) and adds the prefixed variant. Verification and API behavior are unchanged.Reviewed by Cursor Bugbot for commit 835a034. Bugbot is set up for automated code reviews on this repo. Configure here.