Skip to content
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

feat: support wildcard domains with regex [MONET-2345] #2155

Merged
merged 4 commits into from
Oct 2, 2024

Conversation

cemreyuksel
Copy link
Contributor

Ticket

We already support wildcard in allow networks Cloudflare. This PR allows users using this feature while creating an app with functions that has allowNetworks attribute.

We update the regex that we use to validate networks.

@cemreyuksel cemreyuksel requested a review from a team as a code owner October 1, 2024 14:05
@cemreyuksel cemreyuksel self-assigned this Oct 1, 2024
'^(?:' +
'(?:' +
'(?:\\*\\.)?(?:[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?\\.)+[a-zA-Z]{2,6}' +
'|\\*\\.[a-zA-Z]{2,6}' + // Matches wildcard domains like *.com
Copy link
Contributor

Choose a reason for hiding this comment

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

It should allow wildcards like *.example.com but not allow *.com, * or *.too.example.com

@cemreyuksel
Copy link
Contributor Author

@BasKiers updated 🫡

Copy link
Contributor

@BasKiers BasKiers left a comment

Choose a reason for hiding this comment

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

Long live ChatGPT for understanding Regex syntax better than any human could

Copy link

@Vinz93 Vinz93 left a comment

Choose a reason for hiding this comment

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

LGTM 🙂

@cemreyuksel cemreyuksel enabled auto-merge (squash) October 2, 2024 12:57
@cemreyuksel cemreyuksel disabled auto-merge October 2, 2024 12:57
@cemreyuksel cemreyuksel removed the request for review from RichardM99 October 2, 2024 12:58
@cemreyuksel cemreyuksel enabled auto-merge (squash) October 2, 2024 12:58
@cemreyuksel cemreyuksel merged commit 80f5e87 into main Oct 2, 2024
10 checks passed
@cemreyuksel cemreyuksel deleted the MONET-2345-regex branch October 2, 2024 14:00
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.

4 participants