Skip to content

Conversation

@wizardzhang
Copy link
Contributor

Fixes #4564.

Motivation

validating the input url to avoid SSRF attacks

Modifications

org.apache.eventmesh.runtime.util.WebhookUtil#obtainDeliveryAgreement
in this method i added targetUrl validation, to do so i added commons-validator:commons-validator lib
and use org.apache.commons.validator.routines.UrlValidator#isValid method,
and add new test case org.apache.eventmesh.runtime.util.WebhookUtilTest#testObtainDeliveryAgreementWithInvalidTargetUrl
and update the test case
org.apache.eventmesh.runtime.util.WebhookUtilTest#testObtainDeliveryAgreement

Documentation

  • Does this pull request introduce a new feature? (yes / no) no
  • If yes, how is the feature documented? (not applicable / docs / JavaDocs / not documented)
  • If a feature is not applicable for documentation, explain why?
  • If a feature is not documented yet in this PR, please create a followup issue for adding the documentation

add url validation to avoid SSRF
Copy link
Contributor

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

Welcome to the Apache EventMesh community!!
This is your first PR in our project. We're very excited to have you onboard contributing. Your contributions are greatly appreciated!

Please make sure that the changes are covered by tests.
We will be here shortly.
Let us know if you need any help!

Want to get closer to the community?

WeChat Assistant WeChat Public Account Slack
Join Slack Chat

Mailing Lists:

Name Description Subscribe Unsubscribe Archive
Users User support and questions mailing list Subscribe Unsubscribe Mail Archives
Development Development related discussions Subscribe Unsubscribe Mail Archives
Commits All commits to repositories Subscribe Unsubscribe Mail Archives
Issues Issues or PRs comments and reviews Subscribe Unsubscribe Mail Archives

@codecov
Copy link

codecov bot commented Nov 23, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (4c9f0e1) 16.94% compared to head (b7f1119) 16.96%.

Additional details and impacted files
@@             Coverage Diff              @@
##             master    #4572      +/-   ##
============================================
+ Coverage     16.94%   16.96%   +0.01%     
- Complexity     1676     1679       +3     
============================================
  Files           781      781              
  Lines         29161    29167       +6     
  Branches       2510     2511       +1     
============================================
+ Hits           4941     4947       +6     
  Misses        23760    23760              
  Partials        460      460              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

LogUtils.info(log, "obtain webhook delivery agreement for url: {}", targetUrl);

if (isInvalidUrl(targetUrl)) {
LogUtils.info(log, "Target url is invalid url: {}", targetUrl);
Copy link
Member

Choose a reason for hiding this comment

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

LogUtils.error() may be better.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

LogUtils.error() may be better.

should i create a new PR or update this PR to correct log level? @pandaapo

Copy link
Member

@pandaapo pandaapo Nov 23, 2023

Choose a reason for hiding this comment

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

You only need to make modifications on this branch and then push again.

Copy link
Member

@mxsm mxsm left a comment

Choose a reason for hiding this comment

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

@wizardzhang Welcome to EventMesh community. thanks for your contribution!

@wizardzhang wizardzhang requested a review from mxsm November 23, 2023 03:07
Copy link
Member

@mxsm mxsm left a comment

Choose a reason for hiding this comment

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

LGTM

@mxsm mxsm merged commit df288ab into apache:master Nov 23, 2023
@wizardzhang wizardzhang deleted the fix_patch_issue4564 branch November 27, 2023 11:18
xuhongjia pushed a commit to Deckers-Ohana/eventmesh that referenced this pull request Mar 13, 2025
* [ISSUE apache#4564]
add url validation to avoid SSRF

* [ISSUE apache#4564] correct log level
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.

[Vulnerability] Fix code scanning alert - a potential security issue

3 participants