Bug 703528

Summary: URLs are not checked for validity
Product: [Retired] Katello Reporter: Jeff Weiss <jweiss>
Component: WebUIAssignee: Shannon Hughes <shughes>
Status: CLOSED CURRENTRELEASE QA Contact: Katello QA List <katello-qa-list>
Severity: medium Docs Contact:
Priority: unspecified    
Version: 1.0CC: bkearney, dajohnso, mmccune, ppokorny
Target Milestone: ---Keywords: Reopened, Triaged
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
: 728295 (view as bug list) Environment:
Last Closed: 2012-07-04 11:49:27 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Bug Depends On:    
Bug Blocks: 728295    

Description Jeff Weiss 2011-05-10 15:25:45 UTC
Description of problem:


Version-Release number of selected component (if applicable):
ab632275417e2c95eb78f9ad458674be3d0597a8

How reproducible:


Steps to Reproduce:
1. Create new Provider (Red Hat)
2. For Repository URL, enter "#(*%$))@#:<>{}[)]"

  
Actual results:
Provider created

Expected results:
Error:  "Validation failed:  URL is invalid."

Additional info:

Comment 1 Mike McCune 2011-05-11 19:22:49 UTC
make sure we check on the Repo URL as well

Comment 2 Adam Price 2011-05-31 14:32:43 UTC
Service now validates the repository URL, and will not allow creation until valid URL is entered.

requires inclusion of "http://" to validate.

commit: 41db66a7ea416ecdd16945da1f367558bcd98564

Comment 3 Adam Price 2011-05-31 18:19:57 UTC
first fix broke creation of a custom provider. It would disallow creation because no repository URL was given.

fixed:
RedHat provider correctly validates URLs while not giving an error when creating a custom provider.

commit: b68d908aadb76175cf86452e54bbec8eabcb66d5

Comment 4 Jeff Weiss 2011-06-02 11:32:47 UTC
I'm going to have dev take a second look at this.  Checking for "starts with 'http://'" is not right.  It disallows valid urls (file://, https://, etc) while allowing invalid ones:  ( http://+++,  http://localhost:blah, http://localhost:10:20:30, etc).

Let's grab a ruby lib to actually validate the url, no need to reinvent the wheel.  It's probably part of the standard lib.

Comment 5 Adam Price 2011-06-02 13:18:29 UTC
Sorry, my previous comment was confusing.

It's already using Ruby's URI lib to validate repo URL.

I was stating that I noticed URI lib required inclusion of "http://" (or some other protocol) meaning "http://redhat.com" would pass, while "redhat.com" would not.

Currently Provider only validates https protocol, but others can be added very easily (file, http, etc.)

I was instructed to only allow https for right now.

Comment 6 Jeff Weiss 2011-06-21 18:07:35 UTC
Fails QA -

Steps:

Go to Providers, edit the 'red hat' provider.  Change URL to "https://".  Save.  

URL is updated, should be rejected, it is an invalid URL.

It also fails when creating providers (you will have to delete "red hat" to create a new one, only one is allowed).  It also fails validating urls on Repositories.

katello-0.1.48-1.git.19.66d6564.fc14.noarch

Comment 7 Adam Price 2011-06-23 21:08:59 UTC
hopefully now validates URLs better. added tests to check.

commit 7618118893a92d7f2d67031471589a69826b127e

Comment 8 Jeff Weiss 2011-06-28 19:02:45 UTC
Still allows URL of "https://" when creating a repository.
katello-0.1.49-1.git.49.ccf620e.fc14.noarch

Comment 9 Pavel Pokorny 2012-07-04 11:49:27 UTC
It is no longer an issue.

Fixed in katello-0.1.57-1-17-ge6cd995.