Skip to content

Tech detection: Clerk publishable-key pattern matches a Stripe publishableKey (pk_live_) #1478

Closed

Description

@nc9

Clerk's bundle detector matches a Stripe publishable key. Its pattern accepts any publishableKey: "pk_live_…" or "pk_test_…" with a 20 to 200 character body (fingerprints/other.ts, from #1256). Stripe publishable keys have the same prefix and are passed under the same property name, for example stripe:{publishableKey:"pk_live_…"} in an app config object.

Found in the v0.0.152 corpus re-detect: v0.0.152 reports Clerk on a site whose stored bundles contain no Clerk code at all (no @clerk, ClerkProvider, __clerk or clerk.accounts.dev, and no clerk anywhere). The only match is stripe:{publishableKey:"pk_live_…"} (and a pk_test_ twin) in one 35 KB bundle. The pattern is not new. #1445 now sends that bundle region to detection, so it shows up from v0.0.152 on. Any site that configures Stripe this way and whose sampler window covers the key will show Clerk.

A Clerk publishable key's body is the base64 of its Frontend API host followed by $: for example clerk.example.com$, or <name>.clerk.accounts.dev$ for development keys. Stripe's is an opaque alphanumeric string. Requiring that the body decodes to a host ending in $ and containing clerk. separates the two without dropping real Clerk keys.

Acceptance Criteria

  • A bundle containing stripe:{publishableKey:"pk_live_<Stripe-shaped body>"} and no other Clerk marker does not detect clerk (unit test).
  • A bundle passing a real-shaped Clerk key (base64 of clerk.example.com$, and of foo-bar-12.clerk.accounts.dev$ for pk_test_) as publishableKey still detects clerk (unit test).
  • On the PH corpus re-detect, Clerk on the 33,317 common sites matches v0.0.151 (479) plus only verified installs, with no site whose only match is a Stripe key.

nik

Activity

  1. added
    bug
    size: XS
    on Nov 1, 2026
  2. added theissue type on Nov 1, 2026
  3. WilliamK112 commented on Nov 1, 2026

    @WilliamK112
    Contributor

    I would like to take this. I will make the publishable-key detector require a Clerk-shaped decoded host ending in $, add the Stripe negative plus production and development Clerk key fixtures, and run the focused and full tech-detect checks.

  4. nc9 commented on Nov 1, 2026

    @nc9
    ContributorAuthor

    Corpus evidence for the Clerk key validation (adopted from #1481, in draft #1482), recorded here: on the same 19,141-site run, Clerk detections drop by 3 against v0.0.152, all three of them sites whose only match was a Stripe publishable key (the false positive this issue reports), and no real Clerk site is lost.

    nik

  5. nc9 commented on Nov 1, 2026

    @nc9
    ContributorAuthor

    Corpus figures for criterion 3. Full baseline, 33,317 sites every engine covered: Clerk 479 on v0.0.151, 481 on v0.0.152. 10-shard v0.0.155 sample (5,877 sites): Clerk 96 on v0.0.154 to 93 on the v0.0.155 tree (which includes the fix); the 3 lost are exactly the 3 Stripe publishable-key false positives, 0 gained, 0 other losses. On the 33-shard set where Clarity was lost earlier (19,141 sites): Clerk 264 identical on v0.0.152, v0.0.154 and the #1490 head (none include the Clerk fix); the earlier Clerk candidate on those shards gave 264 to 261, the same 3 sites. Scope: the final fix was measured on the 10-shard sample only, which contains all 3 sites' shards, not on all 33,317 sites, so criterion 3 as written (the 33,317 common sites) is not literally met. Leaving this open until a full-corpus run of the release head is recorded, or the criterion is amended.

    nik

  6. nc9 commented on Nov 1, 2026

    @nc9
    ContributorAuthor

    Corpus check of the fix (#1482, shipped in v0.0.155): on the same 33-shard corpus, Clerk detections dropped by 3. All three were sites whose only match was a Stripe publishable key written under publishableKey; no real Clerk site was lost.

    nik

  7. nc9 commented on Nov 1, 2026

    @nc9
    ContributorAuthor

    Checked against v0.0.155. Ticked: criteria 1 (a Stripe publishableKey is not Clerk, live and test, in three written forms) and 2 (real-shaped Clerk keys still detect, including clerk.example.com$ and foo-bar-12.clerk.accounts.dev$). Open: criterion 3, the corpus check. The comment above reports Clerk down by 3, all Stripe-only, no real Clerk site lost, but it does not state the 33,317-site denominator, the 479 baseline or the v0.0.151 comparison the criterion names. Leaving this open until those figures are posted.

    nik

  8. nc9 commented on Nov 1, 2026

    @nc9
    ContributorAuthor

    Full-corpus figures for criterion 3, v0.0.156 tag against v0.0.154 and v0.0.152, on the 34,968 single-launch sites covered by every engine (61 shards; this is the current corpus, slightly larger than the earlier 33,317 common set). Clerk: 501 (v0.0.152), 501 (v0.0.154), 496 (v0.0.156): -5, 0 gained. All 5 losses were checked: 3 are the known Stripe publishable-key false positives. The other 2 were probed: each has a pk_live_ key with a 99-character body that does not decode to a Clerk frontend host, the word stripe within 300 characters, and none of the Clerk markers (package name, clerk-js, __clerk_ prefix, a Clerk host); one also calls Stripe( or loadStripe(. So 5 of 5 are Stripe keys and no real Clerk site was lost. Criteria 1 and 2 were ticked earlier and criterion 3 now holds on the full corpus, so every criterion is met. Closing as completed.

    nik

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugsize: XS

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions