Skip to content

fix(webhook): reject unsupported endpoint URL schemes#938

Open
rambhardwajj wants to merge 1 commit into
goharbor:mainfrom
rambhardwajj:fix/webhook-url-scheme-validation
Open

fix(webhook): reject unsupported endpoint URL schemes#938
rambhardwajj wants to merge 1 commit into
goharbor:mainfrom
rambhardwajj:fix/webhook-url-scheme-validation

Conversation

@rambhardwajj
Copy link
Copy Markdown

Description

This pull request fixes webhook endpoint URL validation by rejecting unsupported URL schemes such as ftp:// and file://.

Previously, the CLI only validated URL parsing and host validity through utils.ValidateURL, but it did not restrict the URL scheme. As a result, unsupported schemes could pass client-side validation and proceed toward the Harbor API request.

This change ensures webhook endpoint URLs only allow http and https schemes during CLI-side validation.

Type of Change

Please select the relevant type.

  • Bug fix
  • New feature
  • Refactor
  • Documentation update
  • Chore / maintenance

Changes

  • Added utils.ValidateHTTPURL to validate URLs and restrict schemes to http and https
  • Updated webhook create/edit command validation to use HTTP(S)-only URL validation
  • Updated webhook create/edit interactive views to use the same validation
  • Added tests covering unsupported schemes such as ftp:// and file://
  • Regenerated CLI documentation with dagger call run-doc export --path=./doc; no documentation changes were produced

Signed-off-by: Ram Bhardwaj <rambhardwaj101000@gmail.com>
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.

[bug]: Webhook endpoint URL validation accepts unsupported schemes like ftp://

1 participant