Skip to content

fix(rokt): support path-prefixed API endpoints - #5644

Merged
shekhar-rudder merged 4 commits into
developfrom
harness/RUD-3256-fix-rokt-support-path-prefixed-92c447ff
Oct 9, 2026
Merged

shekhar-rudder merged 4 commits into
developfrom
harness/RUD-3256-fix-rokt-support-path-prefixed-92c447ff

Conversation

@rudder-devbox

@rudder-devbox rudder-devbox Bot commented Oct 9, 2026

Copy link
Copy Markdown
Contributor

What are the changes introduced in this PR?

  • Allow Rokt apiEndpoint values on the mparticle.com apex domain.
  • Allow constrained optional path prefixes and append /v2/bulkevents after the normalized prefix.
  • Preserve SSRF and lookalike-host protections, including rejection of credentials, ports, queries, fragments, traversal, percent encoding, empty path segments, and backslash canonicalization.
  • Move https://s2s.mparticle.com/path and https://mparticle.com from rejection to acceptance coverage and add traversal/lookalike regression cases.

What is the related Linear task?

Resolves RUD-3256

Please explain the objectives of your changes below

Rokt serves the Events API at path-prefixed endpoints such as https://inbound.mparticle.com/s2s. This change validates the original path spelling before WHATWG URL canonicalization and resolves that base URL to https://inbound.mparticle.com/s2s/v2/bulkevents.

This transformer change must ship with the corresponding rudder-integrations-config schema update so the control plane and runtime accept the same endpoint values.

Any changes to existing capabilities/behaviour, mention the reason & what are the changes ?

Rokt now accepts the mparticle.com apex and safe optional path prefixes. Existing bare-host endpoints continue producing byte-identical resolved URLs. The two intentional expectation reversals are https://s2s.mparticle.com/path and https://mparticle.com.

Any new dependencies introduced with this change?

N/A

Any new generic utility introduced or modified. Please explain the changes.

N/A — path normalization is local to Rokt endpoint resolution.

Any technical or performance related pointers to consider with the change?

This is a security-sensitive URL-validation change. The hostname check deliberately uses host === 'mparticle.com' || host.endsWith('.mparticle.com'); removing the leading dot would admit lookalike domains. Raw path validation is required because WHATWG URL parsing canonicalizes traversal spellings before exposing pathname.

Validation:

  • npm run lint
  • npm test -- --testPathPattern="src/v0/destinations/rokt/routerTransform.test.ts" --no-coverage — 49 passed
  • npm run test:ts -- component --destination=rokt — 11 passed

⚠️ Known Issues

This source change must ship with the paired rudder-integrations-config schema update. Local combined runtime verification was skipped because rudder-transformer is image-pinned in the available environment; exercising a stock transformer would not establish provenance for this source diff.


Developer checklist

  • My code follows the style guidelines of this project
  • No breaking changes are being introduced.
  • All related docs linked with the PR? — N/A
  • All changes manually tested? — Covered by automated unit and component suites
  • Any documentation changes needed with this change? — No
  • Is the PR limited to 10 file changes?
  • Is the PR limited to one linear task?
  • Are relevant unit and component test-cases added in new readability format?

Reviewer checklist

  • Is the type of change in the PR title appropriate as per the changes?
  • Verified that there are no credentials or confidential data exposed with the changes.

@rudder-devbox

rudder-devbox Bot commented Oct 9, 2026

Copy link
Copy Markdown
Contributor Author

👋 I'm rudder-devbox. I opened this PR from a Linear ticket.

Mention @devbox or @rudder-devbox and I'll act on it — on a top-level PR comment,
in a review summary, or on an inline comment on the diff. Without a mention I won't see it.

@coderabbitai

coderabbitai Bot commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration
  • Configuration used: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 73fa3107-84ff-43af-85da-089d7609c8fc

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Drop the authority re-parse and the '%'/leading-slash checks that the
backslash guard, the https-anchored regex and the segment allowlist
already cover, and reuse stripTrailingSlash.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
@shekhar-rudder
shekhar-rudder marked this pull request as ready for review October 9, 2026 16:22
@shekhar-rudder
shekhar-rudder requested review from a team as code owners October 9, 2026 16:22
shekhar-rudder and others added 2 commits October 9, 2026 21:59
Replace the URL parse plus raw-path regex with one pattern that matches
the raw (trimmed) string and builds the endpoint from its captures, so
there is no second parser to disagree with. Trimming restores develop's
acceptance of whitespace-padded endpoints.

Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
shekhar-rudder
shekhar-rudder previously approved these changes Oct 9, 2026
@sonarqubecloud

sonarqubecloud Bot commented Oct 9, 2026

Copy link
Copy Markdown

@codecov

codecov Bot commented Oct 9, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.32%. Comparing base (3796f4c) to head (fd64c18).

Additional details and impacted files
@@           Coverage Diff            @@
##           develop    #5644   +/-   ##
========================================
  Coverage    93.32%   93.32%           
========================================
  Files          703      703           
  Lines        38742    38734    -8     
  Branches      9007     8999    -8     
========================================
- Hits         36157    36150    -7     
+ Misses        2400     2399    -1     
  Partials       185      185           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@shekhar-rudder
shekhar-rudder merged commit 9aa3385 into develop Oct 9, 2026
37 checks passed
@shekhar-rudder
shekhar-rudder deleted the harness/RUD-3256-fix-rokt-support-path-prefixed-92c447ff branch October 9, 2026 16:58
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.

2 participants