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(webhook): make sure webhook urls are valid #133

Merged
merged 6 commits into from Aug 16, 2021

Conversation

laurentlp
Copy link
Contributor

@laurentlp laurentlp commented Aug 15, 2021

This PR adds a check to make sure that the synced webhook URLs are valid URIs and are reachable using an option request.

Closes MES-125

@laurentlp laurentlp marked this pull request as ready for review August 16, 2021 15:45
@linear
Copy link

linear bot commented Aug 16, 2021

MES-125 Add validation for webhook urls

We should send 400 errors if urls for webhooks aren't valid https urls.

@samuelmasse
Copy link
Contributor

It looks like there is a problem with Jest and importing other packages from yarn workspaces.

src/channels/base/channel.ts:1:22 - error TS2307: Cannot find module '@botpress/messaging-base' or its corresponding type declarations.

    1 import { uuid } from '@botpress/messaging-base'
                           ~~~~~~~~~~~~~~~~~~~~~~~~~~

@samuelmasse
Copy link
Contributor

Building the repo first seems to solve the problem. I think rewiring might also solve it. You can see how the rewiring works when working with ts-node in the rewire.ts. Ideally we would need to require that file before every test.

Copy link
Contributor

@samuelmasse samuelmasse left a comment

Choose a reason for hiding this comment

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

We need to send a 400 with a message back to the user otherwise great work!

packages/server/src/sync/service.ts Outdated Show resolved Hide resolved
@laurentlp
Copy link
Contributor Author

Building the repo first seems to solve the problem. I think rewiring might also solve it. You can see how the rewiring works when working with ts-node in the rewire.ts. Ideally we would need to require that file before every test.

kulshekhar/ts-jest#1648

Copy link
Contributor

@samuelmasse samuelmasse left a comment

Choose a reason for hiding this comment

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

👍

@laurentlp laurentlp changed the title feat(webhook): make sure webhook urls are valid and reachable uri feat(webhook): make sure webhook urls are valid Aug 16, 2021
@laurentlp laurentlp merged commit 169c062 into master Aug 16, 2021
@laurentlp laurentlp deleted the llp_webhook_url_validation branch August 16, 2021 21:49
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.

None yet

2 participants