Skip to content

fix: validate domain for every auth mode - #1429

Open
amitsingh05667 wants to merge 4 commits into
masterfrom
SDK-11213
Open

amitsingh05667 wants to merge 4 commits into
masterfrom
SDK-11213

Conversation

@amitsingh05667

@amitsingh05667 amitsingh05667 commented Oct 19, 2026 •

Copy link
Copy Markdown
Member

Changes

  • Add validateDomain() in src/management/wrapper/domain.ts, called from buildManagementBaseUrl() and TokenProvider. ManagementClient, createManagementAuth, and TokenProvider now check the domain at construction in every auth mode.
  • domain must be a bare hostname; a port is allowed. Missing or empty values, whitespace, and / \ ? # @ throw.
  • Update the domain section of v7_MIGRATION_GUIDE.md, and format its removed-exports table with prettier.

Behavior change: a static-token domain with a path (such as a proxy prefix) or a trailing newline now throws at construction.

Testing

  • Add src/management/tests/unit/domain-validation.test.ts, covering every auth mode for ManagementClient and createManagementAuth, plus TokenProvider.
  • yarn build and yarn test pass.

@amitsingh05667
amitsingh05667 requested a review from a team as a code owner October 19, 2026 05:54
@codecov

codecov Bot commented Oct 19, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 89.47%. Comparing base (185ac06) to head (4e64810).

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1429      +/-   ##
==========================================
+ Coverage   89.41%   89.47%   +0.05%     
==========================================
  Files         448      449       +1     
  Lines       22777    22784       +7     
  Branches    10822    10823       +1     
==========================================
+ Hits        20367    20386      +19     
+ Misses       2410     2398      -12     
Flag Coverage Δ
alltests 89.47% <100.00%> (+0.05%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
src/management/wrapper/ManagementClient.ts 100.00% <100.00%> (ø)
src/management/wrapper/auth-helpers.ts 100.00% <100.00%> (ø)
src/management/wrapper/domain.ts 100.00% <100.00%> (ø)
src/management/wrapper/management-auth.ts 93.75% <ø> (+68.75%) ⬆️
src/management/wrapper/token-provider.ts 18.84% <100.00%> (+1.44%) ⬆️
🚀 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.

@amitsingh05667 amitsingh05667 changed the title feat: enhance domain validation for ManagementClient and related components fix: validate domain for every auth mode Oct 23, 2026

@tusharpandey13 tusharpandey13 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

lgtm

This branch has not been deployed

No deployments
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