Project

Profile

Help

Issue #445

closed

Before doing import content into a repo the posted data should be checked for presence and content of required keys

Added by ipanova@redhat.com about 9 years ago. Updated almost 4 years ago.

Status:
CLOSED - WONTFIX
Priority:
Normal
Assignee:
-
Category:
-
Sprint/Milestone:
-
Start date:
Due date:
Estimated time:
Severity:
1. Low
Version:
Platform Release:
OS:
Triaged:
Yes
Groomed:
No
Sprint Candidate:
No
Tags:
Pulp 2
Sprint:
Quarter:

Description

Description of problem:
Before doing import content into a repo the posted data should be checked for presence of required keys instead of creating an async task.

For example here I completely skipped all unit_key data:

$ curl H "Accept: application/json" -X POST -k -u admin:admin -d '{"unit_type_id": "iso", "upload_id": "d281d911-5231-4e2b-a865-cb669e6ce694", "unit_key":{}}' 'https://example.com/pulp/api/v2/repositories/isorepo/actions/import_upload/'|python -m json.tool
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 263 100 172 100 91 109 58 0:00:01 0:00:01 -
:--:-- 109
{
"error": null,
"result": null,
"spawned_tasks": [
{
"_href": "/pulp/api/v2/tasks/5f8aa1f1-5d77-408b-8d6f-822afaa38cf5/",
"task_id": "5f8aa1f1-5d77-408b-8d6f-822afaa38cf5"
}
]
}

Here I try to import upload into non-existent repo:

$ curl H "Accept: application/json" -X POST -k -u admin:admin -d '{"unit_type_id": "iso", "upload_id": "d281d911-5231-4e2b-a865-cb669e6ce694", "unit_key":{}}' 'https://example.com/pulp/api/v2/repositories/non-existent-repo/actions/import_upload/'|python -m json.tool
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 263 100 172 100 91 110 58 0:00:01 0:00:01 -
:--:-- 110
{
"error": null,
"result": null,
"spawned_tasks": [
{
"_href": "/pulp/api/v2/tasks/a508ba1b-c596-41e0-b768-5ed6ed418eaa/",
"task_id": "a508ba1b-c596-41e0-b768-5ed6ed418eaa"
}
]
}

Here I try to post iso unit type into an rpm type repo:

$ curl H "Accept: application/json" -X POST -k -u admin:admin -d '{"unit_type_id": "iso", "upload_id": "d281d911-5231-4e2b-a865-cb669e6ce694", "unit_key":{}}' 'https://example.com/pulp/api/v2/repositories/rpmrepo/actions/import_upload/'|python -m json.tool
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 263 100 172 100 91 110 58 0:00:01 0:00:01 -
:--:-- 110
{
"error": null,
"result": null,
"spawned_tasks": [
{
"_href": "/pulp/api/v2/tasks/6a3b6aee-3636-4179-be96-f4a66975d669/",
"task_id": "6a3b6aee-3636-4179-be96-f4a66975d669"
}
]
}

In all these cases async tasks should NOT be created but instead have 404 or 400 code returned depending on the situation.

Version-Release number of selected component (if applicable):
2.4.0-0.19.beta

How reproducible:

Steps to Reproduce:
1.
2.
3.

Actual results:
in the posted data presence and content of the keys are not checked

Expected results:
in the posted data presence and content of the keys are checked, and 404/400 code returned

Additional info:

+ This bug was cloned from Bugzilla Bug #1104106 +

Actions #1

Updated by bmbouter about 5 years ago

  • Status changed from NEW to CLOSED - WONTFIX
Actions #2

Updated by bmbouter about 5 years ago

  • Severity set to 1. Low

Pulp 2 is approaching maintenance mode, and this Pulp 2 ticket is not being actively worked on. As such, it is being closed as WONTFIX. Pulp 2 is still accepting contributions though, so if you want to contribute a fix for this ticket, please reopen or comment on it. If you don't have permissions to reopen this ticket, or you want to discuss an issue, please reach out via the developer mailing list.

Actions #3

Updated by bmbouter about 5 years ago

  • Tags Pulp 2 added
Actions #4

Updated by bmbouter almost 4 years ago

  • Category deleted (14)

We are removing the 'API' category per open floor discussion June 16, 2020.

Also available in: Atom PDF