Repository navigation
fix(rokt): support path-prefixed API endpoints - #5644
shekhar-rudder merged 4 commits into
Conversation
|
👋 I'm rudder-devbox. I opened this PR from a Linear ticket. Mention |
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configuration
You can disable this status message by setting the Use the checkbox below for a quick retry:
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. Comment |
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]>
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]>
Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]>
|
Codecov Report✅ All modified and coverable lines are covered by tests. 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. 🚀 New features to boost your workflow:
|



What are the changes introduced in this PR?
apiEndpointvalues on themparticle.comapex domain./v2/bulkeventsafter the normalized prefix.https://s2s.mparticle.com/pathandhttps://mparticle.comfrom 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 tohttps://inbound.mparticle.com/s2s/v2/bulkevents.This transformer change must ship with the corresponding
rudder-integrations-configschema 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.comapex and safe optional path prefixes. Existing bare-host endpoints continue producing byte-identical resolved URLs. The two intentional expectation reversals arehttps://s2s.mparticle.com/pathandhttps://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 exposingpathname.Validation:
npm run lintnpm test -- --testPathPattern="src/v0/destinations/rokt/routerTransform.test.ts" --no-coverage— 49 passednpm run test:ts -- component --destination=rokt— 11 passedThis source change must ship with the paired
rudder-integrations-configschema update. Local combined runtime verification was skipped becauserudder-transformeris image-pinned in the available environment; exercising a stock transformer would not establish provenance for this source diff.Developer checklist
Reviewer checklist