Jump to content

Every page here is a learning from Kapso, experimenting on public repositories in each of their environments and use cases. Give your coding agent these learnings: connect the Leeroopedia MCP to Claude Code, Cursor or Codex ($20 free credit). Powered by Leeroo · founders@leeroo.com

Principle:1jehuang Jcode OAuth Account Tracking

From Leeroopedia
Knowledge Sources
Domains Telemetry, Privacy
Last Updated 2026-10-18 00:00 GMT

Overview

A privacy-preserving pattern for tracking model-provider OAuth account membership by storing only SHA-256 email hashes and installation-scoped UUIDs, never raw emails in queryable fields, with membership queries gated by installation knowledge.

Description

OAuth account tracking is a telemetry pattern for correlating which provider accounts (Anthropic, OpenAI, Gemini, Copilot, Antigravity) a jcode installation uses, without exposing the user's email address. The system stores the raw email only in the insert path (for deduplication), computes a SHA-256 hash, and uses the hash for all subsequent membership queries. The email is never exposed in queryable fields, and database errors never echo payloads or hashes.

The problem solved is privacy in telemetry: a telemetry system needs to know which provider accounts are associated with which installations (for support, feature gating, or account linking), but storing raw emails creates a privacy risk. By hashing emails and gating membership queries on installation knowledge (the UUID must be known before an email hash query is accepted), the system minimizes exposure.

The design includes no CORS access (browser requests are forbidden), body size limits (1 KiB), and strict input validation (UUID format, email format, provider set membership).

Usage

Use this principle when a telemetry system needs to track OAuth account membership without exposing raw credentials. The trigger is: "the system needs to know if a provider account is already tracked for a given installation." It is appropriate for: account linking, feature gating, and installation-scoped support lookup.

Theoretical Basis

The tracking protocol has two operations:

  1. Insert: POST /v1/oauth-account with {id, provider, email}. The email is validated, lowercased, and SHA-256 hashed. The record is inserted with ON CONFLICT DO NOTHING deduplication. The response is always {ok: true} — insertion/dedup status is never exposed as an account-membership oracle.
  2. Check: POST /v1/oauth-account/check with {id, provider, email_hash}. The system first checks if the installation UUID is known (exists in events, daily_active_users, or oauth_accounts). Only if known, it checks if the email hash is tracked for that provider. The response is {installation_known: bool, email_tracked: bool}.

Pseudo-code logic:

# Abstract algorithm (NOT real implementation)
def insert_account(body):
    uuid = validate_uuid(body.id)
    provider = validate_provider(body.provider)
    email = validate_email(body.email)
    email_hash = sha256(email.lower())

    db.execute(
        "INSERT INTO oauth_accounts VALUES (?, ?, ?, ?) "
        "ON CONFLICT DO NOTHING",
        uuid, provider, email, email_hash
    )
    return {"ok": True}  # Never reveal dedup status

def check_account(body):
    uuid = validate_uuid(body.id)
    provider = validate_provider(body.provider)
    email_hash = validate_hash(body.email_hash)

    known = db.query(
        "SELECT EXISTS(... WHERE telemetry_id = ?)", uuid
    )
    if not known:
        return {"installation_known": False, "email_tracked": False}

    tracked = db.query(
        "SELECT EXISTS(... WHERE telemetry_id = ? "
        "AND provider = ? AND email_hash = ?)",
        uuid, provider, email_hash
    )
    return {"installation_known": True, "email_tracked": tracked}

Related Pages

Implemented By

Uses Heuristics

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment