Skip to content

Update URL validation regex to support Basic Auth #733

@samadalishah

Description

@samadalishah

Description

The current destination type webhook's URL validation regex is slightly too strict. While it works great for standard domains, it currently fails to validate URLs that include embedded Basic Auth credentials (e.g., username:password@)

Since these are standard URL formats (especially for webhooks and API endpoints), the validation should ideally be relaxed to allow them.

Current Regex

Code snippet

^https?:\\/\\/[\\w\\-]+(?:\\.[\\w\\-]+)*(?::\\d{1,5})?(?:\\/[\\w\\-\\/\\.~:%?#\\[\\]@!$&'\\(\\)*+,;=]*)?$

Failing Examples (Valid URLs that are currently blocked)
Basic Auth: https://username:password@api.example.com

Proposed Solution

I suggest relaxing the regex to explicitly allow the optional auth segment before the domain

Handles auth and safely captures any complex token in the query/path:

Code snippet

^https?:\\/\\/(?:[^@\\/\\s]+@)?[\\w\\-]+(?:\\.[\\w\\-]+)*(?::\\d{1,5})?(?:\\/\\S*)?\$

Question for the Maintainers

Is there a specific reason for the strict regex? I wanted to make sure loosening the query/auth parameters doesn't introduce any unintended side effects for the Outpost. Also, from the documentation, it seems like adding DESTINATIONS_METADATA_PATH should override the destination definition but I tried it locally and it doesn't change it. My intention was to make it simple for my use case and create custom image.
Let me know what you think!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions