Skip to content

Rename Synthetic ID to Server Side Cookie (SSC) and simplify generation#479

Open
ChristianPavilonis wants to merge 4 commits intomainfrom
feature/ssc-update
Open

Rename Synthetic ID to Server Side Cookie (SSC) and simplify generation#479
ChristianPavilonis wants to merge 4 commits intomainfrom
feature/ssc-update

Conversation

@ChristianPavilonis
Copy link
Collaborator

Summary

  • Rename "Synthetic ID" to "Server Side Cookie (SSC)" across all external-facing identifiers, config, internal Rust code, and documentation
  • Simplify SSC 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 SSC ID generation logs from info to debug level since client IP is sensitive data

Changes

File Change
crates/common/src/ssc.rs (new) Renamed from synthetic.rs; simplified hash to IP-only HMAC-SHA256; removed template rendering
crates/common/src/synthetic.rs (deleted) Replaced by ssc.rs
crates/common/src/constants.rs Renamed constants: SYNTHETIC_ID_HEADERSSC_HEADER, cookie/query names updated
crates/common/src/cookies.rs Updated cookie name synthetic_idts-ssc, function names to SSC
crates/common/src/error.rs Renamed SyntheticIdSsc error variant; removed Template variant
crates/common/src/settings.rs Config section [synthetic][ssc] with alias = "synthetic" for backward compat; removed template field
crates/common/src/settings_data.rs Updated settings data references to SSC
crates/common/src/lib.rs Module rename syntheticssc
crates/common/src/http_util.rs Updated header references to SSC naming
crates/common/src/openrtb.rs Wire field synthetic_freshssc_fresh
crates/common/src/proxy.rs Updated query param synthetic_idts-ssc
crates/common/src/publisher.rs Updated SSC references
crates/common/src/auction/formats.rs Response headers: X-Synthetic-IDX-TS-SSC, X-Synthetic-FreshX-TS-SSC-Fresh, X-Synthetic-Trusted-ServerX-TS-SSC-Trusted-Server
crates/common/src/integrations/*.rs Updated SSC references across all integrations
crates/common/src/test_support.rs Updated test helpers for SSC 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
trusted-server.toml Config section [synthetic][ssc]; removed template field
CLAUDE.md Updated file paths and terminology
docs/**/*.md (30+ files) Renamed SyntheticID → Server Side Cookie throughout documentation

Closes

Closes #462

Test plan

  • cargo test --workspace — 473 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 — 239 tests passing

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

- Rename all external identifiers: x-synthetic-id → x-ts-ssc, synthetic_id
  cookie → ts-ssc, synthetic_fresh → ssc_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] → [ssc] with backward-compat alias
- Update 30+ docs files with new SSC terminology
- Downgrade SSC ID generation logs from info to debug (IP is sensitive)

Closes #462
…remove redundant x-ts-ssc-trusted-server header, add doc comment explaining IP-only HMAC design
@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.

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.

SSC updates

3 participants