Skip to content

Commit

Permalink
Merge branch 'v2' into develop
Browse files Browse the repository at this point in the history
# Conflicts:
#	CHANGELOG.md
  • Loading branch information
angrybrad committed Sep 18, 2023
2 parents bab74a8 + 02c039e commit 65da4c8
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Release Notes for Webhooks for Craft CMS

## Unreleased

### Fixed

- Fixed a potential SSRF vulnerability.

## 3.0.4 - 2022-06-01

### Fixed
Expand Down
9 changes: 9 additions & 0 deletions src/Webhook.php
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,15 @@ protected function defineRules(): array
[['groupId'], 'number'],
[['enabled'], 'boolean'],
[['method'], 'in', 'range' => ['get', 'post', 'put']],
[
['url'],
function(string $attribute, array $params = null, Validator $validator) {
// Don't allow connecting to well-known cloud instance metadata endpoints
if (str_contains($this->url, '169.254.169.254') || str_contains($this->url, 'metadata.google.internal')) {
$validator->addError($this, $attribute, Craft::t('webhooks', 'Invalid URL.'));
}
},
],
[
['class'],
function(string $attribute, array $params = null, Validator $validator) {
Expand Down

0 comments on commit 65da4c8

Please sign in to comment.