Skip to content

fix: trim additional tenant IDs from connection strings#311

Open
YunchuWang wants to merge 1 commit into
microsoft:mainfrom
YunchuWang:copilot-finds/bug/fix-tenant-whitespace-trimming
Open

fix: trim additional tenant IDs from connection strings#311
YunchuWang wants to merge 1 commit into
microsoft:mainfrom
YunchuWang:copilot-finds/bug/fix-tenant-whitespace-trimming

Conversation

@YunchuWang

Copy link
Copy Markdown
Member

Summary

  • Trim whitespace around comma-separated additional tenant IDs.
  • Ignore empty tenant entries caused by trailing or repeated commas.
  • Add connection string parsing coverage.

Fixes #211

Testing

  • npm test -w @microsoft/durabletask-js-azuremanaged -- --runTestsByPath test/unit/connection-string.spec.ts
  • npm run build:azuremanaged

getAdditionallyAllowedTenants() splits comma-separated tenant IDs but
does not trim whitespace from individual entries. This causes
authentication failures when connection strings contain spaces around
tenant IDs (e.g., 'tenant1, tenant2'), since the untrimmed values
(e.g., ' tenant2') are passed directly to WorkloadIdentityCredential.

Also filters out empty entries from trailing commas.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings July 17, 2026 16:40

Copilot AI 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.

Pull request overview

This pull request fixes connection-string parsing for Azure Managed Durable Task authentication by normalizing the AdditionallyAllowedTenants value so tenant IDs are usable by Azure Identity credentials. It aligns the SDK’s behavior with common connection-string formatting (spaces and trailing commas) and adds unit coverage to prevent regressions.

Changes:

  • Trim whitespace around each comma-separated tenant ID in AdditionallyAllowedTenants.
  • Filter out empty tenant entries created by trailing (or repeated) commas.
  • Add unit tests covering whitespace trimming, trailing commas, and wildcard (*) handling.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
packages/durabletask-js-azuremanaged/src/connection-string.ts Normalizes AdditionallyAllowedTenants by trimming entries and removing empty values.
packages/durabletask-js-azuremanaged/test/unit/connection-string.spec.ts Adds parsing tests for whitespace, trailing commas, and wildcard tenant values.

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.

[copilot-finds] Bug: getAdditionallyAllowedTenants() does not trim whitespace from comma-separated tenant IDs

3 participants