Skip to content

feat(go): allowlist the webext nudge src - #93

Open
TimeToBuildBob wants to merge 1 commit into
ActivityWatch:masterfrom
TimeToBuildBob:feat/go-webext-src
Open

TimeToBuildBob wants to merge 1 commit into
ActivityWatch:masterfrom
TimeToBuildBob:feat/go-webext-src

Conversation

@TimeToBuildBob

Copy link
Copy Markdown
Contributor

Problem

ActivityWatch/aw-watcher-web#247 ships a popup nudge that links to https://activitywatch.net/go/?src=webext. webext is not in SRC_DEFAULT, and KNOWN_SRC is derived from it, so the sanitizer classifies the tag as other:

  • the GA4 nudge_click event records src=other, losing the surface dimension for the ~40k weekly-active browser-extension users;
  • hop 2 forwards from=other to /subscribe, so the Stripe Checkout Session gets client_reference_id=other and the paid attribution is indistinguishable from unknown traffic.

The redirect's design already does the right thing for every other registered surface; the extension nudge was simply never added to the taxonomy.

Change

One entry: "webext": "subscribe" in SRC_DEFAULT, with a comment naming the caller. No routing, allowlist, or vendor change — the open-redirect guard and the other fallback are untouched.

Verification

  • webext is present exactly once in SRC_DEFAULT; 31 entries, no duplicate keys.
  • KNOWN_SRC = Object.keys(SRC_DEFAULT), so the tag now survives sanitization (rawSrc already permits [a-z0-9-], which webext satisfies).
  • Resulting hops: /go/?src=webext → /subscribe?from=webext → Stripe client_reference_id=webext, and the GA4 event carries src=webext.

Merge order does not matter: the entry is inert until a link uses it.

aw-watcher-web#247 ships a popup nudge linking to /go/?src=webext. That tag
was not in SRC_DEFAULT, so KNOWN_SRC classified it as 'other': the GA4
nudge_click event lost the surface dimension, and the Stripe
client_reference_id carried 'other' through the subscribe hop, making the
paid attribution indistinguishable from unknown traffic.

Registering 'webext' fixes both hops with one entry.

Git-Session-Id: e859b72c-b2c5-4d17-858a-93c853302800
@TimeToBuildBob

Copy link
Copy Markdown
Contributor Author

Executed the page's actual redirect script in a Node vm with a stubbed browser (window.location, gtag, document) to check the resolution rather than reading it:

query GA4 nudge_click redirect target
?src=webext {src: webext, dest: subscribe} https://activitywatch.net/subscribe?from=webext
?src=webext&to=stripe-personal-monthly {src: webext, dest: stripe-personal-monthly} https://buy.stripe.com/…?client_reference_id=webext
?src=notregistered {src: other, dest: subscribe} …/subscribe?from=other
?src=webext&to=https://evil.example {src: webext, dest: subscribe} …/subscribe?from=webext (raw URL ignored)

So after this merges, ActivityWatch/aw-watcher-web#247's link produces a distinct webext dimension on both hops, the unregistered-tag fallback to other still works, and the open-redirect guard is unaffected.

This branch has not been deployed

No deployments
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.

1 participant