Skip to content

Rename Synthetic ID to Edge Cookie (EC) and simplify generation#479

Draft
ChristianPavilonis wants to merge 5 commits intomainfrom
feature/ssc-update
Draft

Rename Synthetic ID to Edge Cookie (EC) and simplify generation#479
ChristianPavilonis wants to merge 5 commits intomainfrom
feature/ssc-update

Conversation

@ChristianPavilonis
Copy link
Collaborator

@ChristianPavilonis ChristianPavilonis commented Mar 12, 2026

Summary

  • Rename "Synthetic ID" to "Edge Cookie (EC)" across all external-facing identifiers, config, internal Rust code, and documentation
  • Simplify EC hash generation to use only client IP (IPv4 or /64-masked IPv6) with HMAC-SHA256, removing User-Agent, Accept-Language, Accept-Encoding, random_uuid inputs and Handlebars template rendering
  • Downgrade EC ID generation logs from info to debug level since client IP is sensitive data

Changes

File Change
crates/common/src/edge_cookie.rs (new) Renamed from synthetic.rs; simplified hash to IP-only HMAC-SHA256; removed template rendering
crates/common/src/synthetic.rs (deleted) Replaced by edge_cookie.rs
crates/common/src/constants.rs Renamed constants: SYNTHETIC_ID_HEADERHEADER_X_TS_EC, cookie/query names updated
crates/common/src/cookies.rs Updated cookie name synthetic_idts-ec, function names to EC
crates/common/src/error.rs Renamed SyntheticIdEc error variant; removed Template variant
crates/common/src/settings.rs Config section [synthetic][ec]; removed template field
crates/common/src/settings_data.rs Updated settings data references to EC
crates/common/src/lib.rs Module rename syntheticedge_cookie
crates/common/src/http_util.rs Updated header references to EC naming
crates/common/src/openrtb.rs Wire field synthetic_freshec_fresh (breaking wire-protocol change)
crates/common/src/proxy.rs Updated query param synthetic_idts-ec
crates/common/src/publisher.rs Updated EC references
crates/common/src/consent/mod.rs Renamed allows_ssc_creationallows_ec_creation with updated docs and tests
crates/common/src/consent/kv.rs Updated doc comments to EC naming
crates/common/src/auction/formats.rs Response headers: X-Synthetic-IDX-TS-EC, X-Synthetic-FreshX-TS-EC-Fresh, X-Synthetic-Trusted-ServerX-TS-EC-Trusted-Server
crates/common/src/integrations/*.rs Updated EC references across all integrations
crates/common/src/test_support.rs Updated test helpers for EC naming
crates/common/Cargo.toml Removed handlebars dependency
crates/js/lib/src/integrations/gpt/index.ts Updated header name reference
Cargo.lock Removed handlebars-related entries
crates/integration-tests/Cargo.lock Synced shared dependency versions (derive_more 2.1.1)
trusted-server.toml Config section [synthetic][ec]; removed template field
CLAUDE.md Updated file paths and terminology
docs/guide/edge-cookies.md (new) Replaces synthetic-ids.md
docs/guide/synthetic-ids.md (deleted) Replaced by edge-cookies.md
docs/**/*.md (30+ files) Renamed SyntheticID → Edge Cookie throughout documentation

Breaking changes

  • Wire protocol: user.ext.synthetic_freshuser.ext.ec_fresh in OpenRTB bid requests
  • HTTP headers: X-Synthetic-IDX-TS-EC, X-Synthetic-FreshX-TS-EC-Fresh
  • Cookie name: synthetic_idts-ec
  • Query parameter: synthetic_idts-ec
  • Config section: [synthetic][ec] (no backward-compat alias)

Closes

Closes #462

Test plan

  • cargo test --workspace — all tests passing
  • cargo clippy --all-targets --all-features -- -D warnings — zero warnings
  • cargo fmt --all -- --check — clean
  • JS tests: cd crates/js/lib && npx vitest run — all tests passing
  • Prettier: cd docs && npx prettier --check . — clean
  • Integration dependency versions synced

Checklist

  • Changes follow CLAUDE.md conventions
  • No unwrap() in production code — use expect("should ...")
  • Uses tracing macros (not println!)
  • New code has tests
  • No secrets or credentials committed

Copy link
Collaborator

@aram356 aram356 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Summary

Comprehensive rename of Synthetic ID → Server Side Cookie (SSC) with simplified HMAC generation (client IP only, dropping Handlebars templates). Cookie, header, query parameter, config section, and error variants are all renamed. The handlebars dependency is removed.

Blocking

🔧 wrench

  • Missing new SSC headers in INTERNAL_HEADERS: x-ts-ssc-fresh and x-ts-ssc-trusted-server are defined but not added to the INTERNAL_HEADERS blocklist, allowing potential leak of user-identity headers to third-party origins via copy_custom_headers (crates/common/src/constants.rs:49)

Non-blocking

🤔 thinking

  • Cookie name break: synthetic_idts-ssc silently invalidates existing user cookies (crates/common/src/constants.rs:3)
  • Query parameter break: synthetic_idts-ssc in proxy forwarding may break downstream consumers (crates/common/src/proxy.rs:438)
  • Entropy reduction: HMAC now uses only client IP; users behind same NAT share the HMAC prefix (crates/common/src/ssc.rs:63)

📝 note

  • Silent template field removal: Old configs with template = "..." are silently ignored (no deny_unknown_fields). Operators won't know the field is unused.

CI Status

  • cargo fmt: PASS
  • cargo clippy: PASS
  • cargo test: PASS
  • vitest: PASS
  • format-docs: PASS
  • format-typescript: PASS
  • CodeQL: PASS

prk-Jr
prk-Jr previously requested changes Mar 16, 2026
Copy link
Collaborator

@prk-Jr prk-Jr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Summary

This PR completes the Synthetic ID → Server Side Cookie rename and simplifies ID generation, but I found a couple of migration/privacy regressions plus a docs/behavior mismatch that should be fixed before merge.

Blocking

🔧 wrench

  • Docs and implementation diverge on consent + proxy behavior: the new SSC docs state that ID generation/forwarding are consent-gated and that /first-party/proxy generates a new SSC ID when missing, but the current implementation still generates IDs unconditionally in crates/common/src/publisher.rs:239, crates/common/src/integrations/registry.rs:659, and crates/common/src/auction/formats.rs:81, while proxy forwarding only reuses an existing ID in crates/common/src/proxy.rs:427. Either implement the documented rules or update the docs so they match the code.

CI Status

  • fmt: PASS
  • clippy: PASS
  • rust tests: PASS
  • js tests: PASS

@ChristianPavilonis ChristianPavilonis dismissed stale reviews from aram356 and prk-Jr March 16, 2026 16:21

Addressed: added x-ts-ssc-fresh to INTERNAL_HEADERS, removed x-ts-ssc-trusted-server. Non-blocking items are intentional design choices.

@aram356 aram356 marked this pull request as draft March 17, 2026 16:03
- Rename all external identifiers: x-synthetic-id → x-ts-ec, synthetic_id
  cookie → ts-ec, synthetic_fresh → ec_fresh
- Simplify hash generation to use only client IP with HMAC-SHA256, removing
  User-Agent, Accept-Language, Accept-Encoding, and template rendering
- Rename config section [synthetic] → [ec] with backward-compat alias
- Rename ec.rs to edge_cookie.rs for clarity
- Remove handlebars dependency (and transitive deps)
- Add x-ts-ec-fresh to internal headers blocklist
- Update all docs with new Edge Cookie (EC) terminology
- Fix review findings: remove redundant serde rename, stale optimization
  entry, leftover 'synthetic' references in agent configs and docs

Closes #462
- Rename allows_ssc_creation → allows_ec_creation and update all doc
  comments, test names, and assertion messages to use Edge Cookie (EC)
- Fix intra-doc link [`ec`] → [`edge_cookie`] in lib.rs
- Downgrade test log from info to debug in edge_cookie.rs for consistency
- Add fallback comment and wire-protocol breaking-change doc in openrtb.rs
- Run prettier --write on 3 doc files to fix format-docs CI
- Update integration-tests Cargo.lock to sync derive_more 2.1.1
@ChristianPavilonis ChristianPavilonis changed the title Rename Synthetic ID to Server Side Cookie (SSC) and simplify generation Rename Synthetic ID to Edge Cookie (EC) and simplify generation Mar 18, 2026
…ences

- Rename TRUSTED_SERVER__SYNTHETIC__SECRET_KEY to TRUSTED_SERVER__EC__SECRET_KEY
  in CI action and local integration test scripts (root cause of CI failure:
  Viceroy could not start without the EC secret key)
- Update stale doc reference synthetic.secret_key → ec.secret_key
- Update stale comments in consent_config.rs and consent/types.rs
- Rename struct Ec → EdgeCookie, field settings.ec → settings.edge_cookie
- Add serde alias "ec" for backward compatibility with existing configs
- Update all TOML configs, env vars, CI actions, scripts, and docs
- TRUSTED_SERVER__EC__* env vars → TRUSTED_SERVER__EDGE_COOKIE__*
- Validation messages now reference edge_cookie.secret_key
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.

Edge Cookie (formerly SSC (formerly synthetic ID)) updates

3 participants