Skip to content

feat: URL path mapping for cross-environment replay (#10) - #17

Merged
tsemachh merged 3 commits into
mainfrom
feature/url-path-mapping
May 3, 2026
Merged

feat: URL path mapping for cross-environment replay (#10)#17
tsemachh merged 3 commits into
mainfrom
feature/url-path-mapping

Conversation

@tsemachh

@tsemachh tsemachh commented May 3, 2026

Copy link
Copy Markdown
Member

Summary

Closes #10

Adds URL path prefix mapping to the replay flow, enabling the primary use case: record on a central/staging environment, replay locally when the API paths differ.

Example:

  • Recorded: /microservice1/api/users
  • Replay locally: /api/users
  • Mapping: /microservice1/api -> /api

Changes

src/shared/recording.ts

  • Added UrlMapping interface { from: string; to: string }
  • Added urlMappings?: UrlMapping[] to ReplayOptions

src/background/replayer.ts

  • Added applyUrlMappings(pathname, mappings) — applies the first matching prefix rewrite before path matching
  • Reads urlMappings from replayOptions in session storage before each match
  • Fallback matching also uses the rewritten pathname

src/popup/services/storage.ts

  • updateReplayOptions now accepts and persists urlMappings

src/popup.html

  • Added URL Mappings textarea (one mapping per line: /from -> /to)

src/popup/main.ts

  • Parses textarea on replay start → passes to updateReplayOptions
  • loadReplayOptionsIntoUI() restores saved mappings when a recording is selected

README.md

  • Expanded workflow A with step-by-step URL mapping instructions and multi-mapping notes

Behaviour notes

  • Mapping is replay-only — recordings are stored as-is
  • First matching prefix wins
  • Leading slashes are normalised automatically
  • Mappings are persisted with the recording's replayOptions and restored on selection

Verification

  • npm run typecheck
  • npm run test ✅ (18/18 tests pass)

Closes #10

- Add UrlMapping interface to ReplayOptions in recording.ts
- Apply mappings in replayer.ts before path matching (replay-only)
- Persist mappings via updateReplayOptions in storage.ts
- Add URL Mappings textarea to popup.html
- Wire textarea in main.ts: parse on replay start, restore on recording select
- Document use case in README.md (record on staging, replay locally)

Co-authored-by: Junie <junie@jetbrains.com>
@philjoseph

philjoseph commented May 3, 2026

Copy link
Copy Markdown
Member

Logo
Checkmarx One – Scan Summary & Details9aa84c0e-2104-4369-a79c-219999c250ff


New Issues (3) Checkmarx found the following issues in this Pull Request
# Severity Issue Source File / Package Checkmarx Insight
1 HIGH Reflected_XSS src/popup/components/ResponseEditor.ts: 25 Attack Vector
2 HIGH Reflected_XSS src/popup/components/ApiPreview.ts: 30 Attack Vector
3 HIGH Reflected_XSS src/popup/components/ResponseEditor.ts: 22 Attack Vector

Communicate with Checkmarx by submitting a PR comment with @Checkmarx followed by one of the supported commands. Learn about the supported commands here.

tsemachh and others added 2 commits May 3, 2026 15:19
Co-authored-by: Junie <junie@jetbrains.com>
Co-authored-by: Junie <junie@jetbrains.com>
@tsemachh
tsemachh merged commit e812483 into main May 3, 2026
2 of 3 checks passed
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.

Support mapping micro service route to /

2 participants