Skip to content

Add comprehensive validation for DTS connection strings including empty Authentication values #4624

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

Copilot
Copy link
Contributor

@Copilot Copilot AI commented Jul 30, 2025

When debugging Azure Functions projects with Durable Task Scheduler (DTS) storage type, users can click "Manually Set a Connection String" to provide a custom DTS connection string. Previously, there was no validation on this input, allowing users to enter invalid strings like "abc" or incomplete strings with empty Authentication values, which would cause issues later during debugging.

Changes Made

Enhanced the validation logic in DTSConnectionCustomPromptStep.ts to include comprehensive DTS connection string validation:

  • Format validation: Ensures the connection string contains the required Endpoint= parameter
  • URL validation: Validates that the endpoint is a properly formatted URL
  • Protocol validation: Restricts protocols to HTTP/HTTPS only
  • Authentication validation: Ensures the required Authentication= parameter is present
  • Authentication value validation: Validates that the Authentication parameter has a non-empty value
  • Clear error messages: Provides specific, actionable feedback for each validation failure

Before/After

Before: Users could enter "abc" or connection strings with empty Authentication values and the system would accept them without validation:

Before - no validation

After: Invalid input now shows helpful validation errors explaining the expected format, including detection of empty Authentication values.

Expected Connection String Format

Valid DTS connection strings must follow this pattern:

Endpoint=<HTTP_OR_HTTPS_URL>;Authentication=<AUTH_TYPE>[;additional_params]

Examples of valid connection strings:

  • Endpoint=http://localhost:55053/;Authentication=None (Local emulator)
  • Endpoint=https://example.durabletask.io;Authentication=ManagedIdentity;ClientID=12345 (Remote)

Examples that will now fail validation:

  • abc (Missing required parameters)
  • Endpoint=http://localhost:55053/;Authentication= (Empty authentication value)
  • Endpoint=invalid-url;Authentication=None (Invalid URL format)
  • Endpoint=ftp://localhost;Authentication=None (Invalid protocol)

This change improves the user experience by catching configuration errors early and providing clear guidance on the correct format, preventing runtime debugging issues.

Fixes #4604.


💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.

@Copilot Copilot AI changed the title [WIP] There is no validation for the invalid DTS connection string Add validation for DTS connection strings to prevent invalid input Jul 30, 2025
Copilot finished work on behalf of alexweininger July 30, 2025 18:47
@Copilot Copilot AI requested a review from alexweininger July 30, 2025 18:47
@MicroFish91
Copy link
Contributor

MicroFish91 commented Jul 30, 2025

@copilot Remove any changes to main.js

@MicroFish91
Copy link
Contributor

This might work, I'll need test it later to verify

Copy link
Contributor Author

Copilot AI commented Jul 30, 2025

@copilot Remove any changes to main.js

I've updated the implementation to better use validationUtils from the @microsoft/vscode-azext-utils package and reverted the changes to main.js. The validation now properly uses hasValidCharLength() and getInvalidCharLengthMessage() for basic validation, while keeping the necessary custom validation logic for DTS connection string format, endpoint URL validation, and authentication parameter checking (since these specific validators aren't available in validationUtils).

Changes in commit 493681b:

  • Reverted main.js to use the original extension loading mechanism
  • Maintained proper usage of validationUtils for character length validation
  • Kept essential custom validation for DTS-specific requirements

Warning

Firewall rules blocked me from connecting to one or more addresses

I tried to connect to the following addresses, but was blocked by firewall rules:

  • aka.ms
    • Triggering command: gulp preTest (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

@Copilot Copilot AI requested a review from MicroFish91 July 30, 2025 21:16
Copilot finished work on behalf of MicroFish91 July 30, 2025 21:16
}

// Check if the connection string contains an Authentication parameter
if (!connectionString.match(/Authentication=/)) {
Copy link
Contributor

@MicroFish91 MicroFish91 Aug 10, 2025

Choose a reason for hiding this comment

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

@copilot Make sure to check after the suffix Authentication= to make sure there is actually a value on the other side of the equal sign. An empty equals value should not pass validation.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added validation for empty Authentication parameter values. The validation now checks that there's a non-empty value after Authentication= and provides the error message "DTS Authentication parameter cannot be empty" when the value is missing or whitespace-only. Commit ea72aa6.

@Copilot Copilot AI changed the title Add validation for DTS connection strings to prevent invalid input Add comprehensive validation for DTS connection strings including empty Authentication values Aug 10, 2025
@Copilot Copilot AI requested a review from MicroFish91 August 10, 2025 19:22
Copilot finished work on behalf of MicroFish91 August 10, 2025 19:22
@MicroFish91 MicroFish91 marked this pull request as ready for review August 10, 2025 19:32
@MicroFish91 MicroFish91 requested a review from a team as a code owner August 10, 2025 19:32
@MicroFish91 MicroFish91 enabled auto-merge (squash) August 10, 2025 19:33
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.

There is no validation for the invalid DTS connection string
3 participants