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

Webhook validator urlRegex doesnot contain '_' #5543

Closed
c7h12 opened this issue Mar 19, 2020 · 2 comments · Fixed by #7079
Closed

Webhook validator urlRegex doesnot contain '_' #5543

c7h12 opened this issue Mar 19, 2020 · 2 comments · Fixed by #7079
Labels
good first issue Good for newcomers issue: bug Issue reporting a bug severity: low If the issue only affects a very niche base of users and an easily implemented workaround can solve source: core:strapi Source is core/strapi package status: confirmed Confirmed by a Strapi Team member or multiple community members

Comments

@c7h12
Copy link

c7h12 commented Mar 19, 2020

Describe the bug
The urlRegex in webhookvalidator can not match '_';

https://github.com/strapi/strapi/blob/master/packages/strapi-admin/controllers/Webhooks.js#L14

Steps to reproduce the behavior

  1. settings/webhooks/add new webhook
    2.type 'http://ab_cd.test.com" as url
  2. fill other fields
  3. submit
  4. "An error occurred"

Expected behavior
"_" is a legal charactor in host.

Screenshots
If applicable, add screenshots to help explain your problem.

Code snippets
If applicable, add code samples to help explain your problem.

https://github.com/strapi/strapi/blob/master/packages/strapi-admin/controllers/Webhooks.js#L14

const urlRegex = /^(?:([a-z0-9+.-]+):\/\/)(?:\S+(?::\S*)?@)?(?:(?:[1-9]\d?|1\d\d|2[01]\d|22[0-3])(?:\.(?:1?\d{1,2}|2[0-4]\d|25[0-5])){2}(?:\.(?:[1-9]\d?|1\d\d|2[0-4]\d|25[0-4]))|(?:(?:[a-z\u00a1-\uffff0-9]-*)*[a-z\u00a1-\uffff0-9]+)(?:\.(?:[a-z\u00a1-\uffff0-9]-*)*[a-z\u00a1-\uffff0-9]+)*\.?)(?::\d{2,5})?(?:[/?#]\S*)?$/;

System

  • Node.js version: v12.16.1
  • NPM version: 6.13.4
  • Strapi version: 3.0.0-beta.19.3
  • Database: mysql 5.7
  • Operating system: macos
@c7h12 c7h12 changed the title strapi-admin webhook validator urlRegex doesnot contains '_' strapi-admin webhook validator urlRegex doesnot contain '_' Mar 19, 2020
@lauriejim lauriejim added good first issue Good for newcomers severity: low If the issue only affects a very niche base of users and an easily implemented workaround can solve source: core:strapi Source is core/strapi package status: confirmed Confirmed by a Strapi Team member or multiple community members issue: bug Issue reporting a bug labels Mar 23, 2020
@lauriejim
Copy link
Contributor

Hello @c7h12 !
Thank you for reporting this issue.
Can you please submit a PR, thank you.

@lauriejim lauriejim changed the title strapi-admin webhook validator urlRegex doesnot contain '_' Webhook validator urlRegex doesnot contain '_' Jun 10, 2020
@msimmer
Copy link
Contributor

msimmer commented Jul 19, 2020

I'd like to take this on if it's still open

msimmer added a commit to msimmer/strapi that referenced this issue Jul 20, 2020
Signed-off-by: Maxwell Simmer <maxwell.simmer@gmail.com>
alexandrebodin pushed a commit that referenced this issue Jul 22, 2020
Signed-off-by: Maxwell Simmer <maxwell.simmer@gmail.com>
gilfernandes pushed a commit to onepointconsulting/strapi that referenced this issue Aug 13, 2020
…i#7079)

Signed-off-by: Maxwell Simmer <maxwell.simmer@gmail.com>
Signed-off-by: Gil Fernandes <gil.fernandes@onepointltd.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers issue: bug Issue reporting a bug severity: low If the issue only affects a very niche base of users and an easily implemented workaround can solve source: core:strapi Source is core/strapi package status: confirmed Confirmed by a Strapi Team member or multiple community members
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants