Skip to content

feat(tracking): add key rotation and worker abuse protections#295

Closed
salmonumbrella wants to merge 3 commits into
openclaw:mainfrom
salmonumbrella:issue-293-294-tracking-security
Closed

feat(tracking): add key rotation and worker abuse protections#295
salmonumbrella wants to merge 3 commits into
openclaw:mainfrom
salmonumbrella:issue-293-294-tracking-security

Conversation

@salmonumbrella

Copy link
Copy Markdown
Contributor

Summary

Test plan

  • Go build compiles cleanly
  • All Go tests pass (go test ./internal/tracking/... ./internal/cmd/...)
  • Key rotation: versioned encrypt → decrypt with multiple keys → legacy fallback
  • Bot detection: expanded UA matching, header presence checks, timing-based prefetch detection
  • /q/ endpoint requires admin Bearer token (security fix from code review)
  • Drive filter pass-through with compound queries, case sensitivity
  • Gmail MIME non-ASCII header encoding edge cases

Closes #293
Closes #294

🤖 Generated with Claude Code

salmonumbrella and others added 3 commits February 14, 2026 12:15
…aders

Drive search now detects raw API filter syntax (field comparisons,
contains, membership, has) and passes it through instead of wrapping
in fullText contains. Plain-text searches always append trashed=false
to prevent false positives.

Gmail MIME now RFC 2047-encodes display names with non-ASCII characters
in From/To/Cc/Bcc/Reply-To headers using net/mail.

Fixes openclaw#254, fixes openclaw#255

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Closes openclaw#293 and openclaw#294.

- add TRACKING_KEY_V<n> secrets and current-version tracking metadata\n- add gmail track key rotate command and config metadata\n- persist all key versions and deploy rotated key set to worker\n- add per-IP rate limit + duplicate open dedupe in worker\n- harden bot detection heuristics and tokenized decryption compatibility\n
- Fix Go syntax error in IsConfigured() multiline return
- Fix variable scoping bug in DecryptWithVersions (unmarshalErr)
- Add admin auth to /q/ endpoint to protect IP/location data
- Fix slice mutation in decryptionVersionOrder
- Fix test configs missing AdminKey and --no-deploy flag position

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@steipete

steipete commented May 4, 2026

Copy link
Copy Markdown
Collaborator

Thanks for the tracking security work. This is now superseded by main, so I’m closing the stale PR rather than trying to merge the dirty branch.\n\nLanded/current coverage:\n- #293 key rotation: fixed in e98f44d (versioned tracking blobs, gmail track key rotate, versioned Worker secrets, legacy fallback).\n- #294 abuse/rate limiting: already fixed/closed via dfc5b75 (dedupe repeated opens and cap per-IP writes).\n- retention/admin query hardening also exists on main via 9ce77ef and related tracking commits.\n- the unrelated Drive/Gmail fixes from the first PR commit are already on main via #266 / 4272c68, and issues #254/#255 are closed.\n\nVerified now:\n- go test ./internal/tracking ./internal/cmd -run 'TestEncryptWithVersion|TestDecryptWithKeys|TestGmailTrackKeyRotate|TestGeneratePixelURL|TestGmailTrackSetupAndStatus'\n- go test ./internal/cmd -run 'TestBuildDriveSearchQuery|TestLooksLikeDriveFilterQuery|TestDriveSearchCmd_PassesThroughDriveFilterQueries|TestBuildRFC822UTF8FromDisplayName|TestFormatAddressHeaders|TestBuildRFC822PlainFromAddressStaysUnwrapped'\n- pnpm -C internal/tracking/worker test\n\nClosing as superseded by landed main. Thanks again.

@steipete steipete closed this May 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Security: Add rate limiting to email tracking Cloudflare Worker Security: Add key rotation mechanism for email tracking encryption

2 participants