Skip to content

fix: harden server event and attribution boundaries - #35

Merged
Atroci merged 2 commits into
masterfrom
codex/high-priority-security
Sep 16, 2026
Merged

Atroci merged 2 commits into
masterfrom
codex/high-priority-security

Conversation

@Atroci

@Atroci Atroci commented Sep 16, 2026

Copy link
Copy Markdown
Contributor

Acceptance criteria

Every canonical server event has a non-empty stable event ID, untrusted cookie attribution is limited to canonical non-identity fields, and browser envelope routing/consent values cannot be overridden by nested caller data.

Changes

  • Added stable server conversion IDs with explicit ID normalization.
  • Added server-readable cookie attribution filtering.
  • Enforced literal boolean consent values.
  • Made top-level event identity and canonical envelope fields authoritative.
  • Added regression coverage for IDs, cookie injection, consent coercion, and tenant payloads.

Validation

  • pnpm test
  • pnpm typecheck
  • pnpm build
  • git diff --check

All passed in the isolated worktree. This PR intentionally leaves duplicated framework server adapters and generic integration builders for a follow-up parity change.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Sep 16, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-09-16T22:01:55.099333Z 7f074a1 PR opened
🔒 Security Review ✅ Completed 2026-09-16T22:08:16.390319Z 7f074a1 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

Atroci and others added 2 commits September 16, 2026 23:00
Add review records for sourcebuster, Odoo, Matomo, PostHog, Chatwoot, and
trace-ids, following the existing oss-contributions format and index.

Each record states the observed seam, the smallest useful contribution, the
host-owned boundaries, and the evidence required before proposing. Only the
sourcebuster change is implemented; the remainder are unposted reviews.

Co-authored-by: CommandCodeBot <noreply@commandcode.ai>

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 7f074a1dfa

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +141 to +143
?? data['formId']
?? data['form_id']
?? `${input.identity.visitorId ?? ''}:${input.identity.sessionId ?? ''}`;

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Require an occurrence-specific key before deriving event IDs

When two leads are submitted from the same form during one visitor session, formId (or the visitor/session fallback) is identical for both calls, so this produces the same event_id and a deduplicating collector silently discards the later conversion. This is also the path shown in the server README, where trackLead supplies only formId; callers without a unique lead ID should receive a per-occurrence ID or be required to provide an explicit stable key rather than deriving it from session/form identity.

Useful? React with 👍 / 👎.

Comment on lines +147 to +149
input.identity.visitorId ?? '',
input.identity.sessionId ?? '',
input.now ?? '',

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Exclude mutable request context from stable event IDs

When the same purchase, booking, or lead is retried with its stable business ID but a refreshed now, visitor cookie, or session cookie, these fields change the derived event_id, so the collector cannot deduplicate the retry. Once stableInput is a transaction/booking/lead identifier, the derivation should depend only on stable occurrence data such as site, canonical event name, and that identifier—not request-time identity or timestamp context.

Useful? React with 👍 / 👎.

const payload =
typeof payloadRaw === 'string' && payloadRaw
? ((safeJsonParse(payloadRaw) as AttributionPayload | null) ?? {})
? filterServerAttributionPayload(safeJsonParse(payloadRaw))

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Normalize legacy attribution aliases before filtering

When an older ct_attribution cookie contains the documented first_*/last_* field names, this new canonical-only filter drops every aliased attribution value even though parseIdentityFromCookies explicitly retains support for LEGACY_ATTRIBUTION_KEY. The browser storage read path normalizes these aliases before allowlisting; applying the same normalization here is necessary to avoid silently losing attribution for upgraded installations.

Useful? React with 👍 / 👎.

@Atroci
Atroci force-pushed the codex/high-priority-security branch from 7f074a1 to 92f90e5 Compare September 16, 2026 22:03
@Atroci
Atroci merged commit 3e56c9b into master Sep 16, 2026
12 checks passed
@Atroci
Atroci deleted the codex/high-priority-security branch September 16, 2026 22:07
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