pulp / pulp/pulpcore

Add validation for remote URL

Open
#1,977 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Issue
Dominant language
Python
Stars
598
Forks
168
Avg merge
1d 4h
Merged PRs (30d)
86

Description

Author: @ipanova (ipanova@redhat.com)

Redmine Issue: 8340, https://pulp.plan.io/issues/8340


It would be good to add any sort of validation for the url. Right now we are not checking even the validity of the url schema.

(pulp) [vagrant@pulp2-nightly-pulp3-source-centos7 ~]$ http POST :24817/pulp/api/v3/remotes/rpm/rpm/  name=lala url=lala
HTTP/1.1 201 Created
Access-Control-Expose-Headers: Correlation-ID
Allow: GET, POST, HEAD, OPTIONS
Connection: close
Content-Length: 529
Content-Type: application/json
Correlation-ID: 22466def5b17436386ce6286f58b0307
Date: Thu, 04 Mar 2021 12:07:36 GMT
Location: /pulp/api/v3/remotes/rpm/rpm/2d554142-faa0-4fe6-bea5-83082806ac03/
Server: gunicorn/20.0.4
Vary: Accept, Cookie
X-Frame-Options: SAMEORIGIN

{
    "ca_cert": null,
    "client_cert": null,
    "client_key": null,
    "connect_timeout": null,
    "download_concurrency": 10,
    "name": "lala",
    "password": null,
    "policy": "immediate",
    "proxy_url": null,
    "pulp_created": "2021-03-04T12:07:36.223237Z",
    "pulp_href": "/pulp/api/v3/remotes/rpm/rpm/2d554142-faa0-4fe6-bea5-83082806ac03/",
    "pulp_labels": {},
    "pulp_last_updated": "2021-03-04T12:07:36.223260Z",
    "rate_limit": null,
    "sles_auth_token": null,
    "sock_connect_timeout": null,
    "sock_read_timeout": null,
    "tls_validation": true,
    "total_timeout": null,
    "url": "lala",
    "username": null
}

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the remote creation API shown in the issue and trace how the remote URL is accepted. Reproduce the POST with url=lala, then add validation so an invalid URL schema is rejected and verify that valid remote URLs continue to work.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
api, backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.