Fixes #38076 - Sanitize content_view repository_ids param #11253
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What are the changes introduced in this pull request?
For the content_view APIs, the repository_ids param is now cast to a list of integers even if it is supplied as a list of strings before being passed to the backend. This ensures the backend always gets consistent data and can perform list comparisons with data taken from the DB.
Considerations taken when implementing this change?
We could of course implement the needed handling within the affected actions instead of the API controller, however, this seems like a less robust design approach, since such special handling can be easily forgotten for the next action that needs it.
What are the testing steps for this pull request?
This PR is most easily tested in combination with these PRs:
Simply create a rolling CV, add a repo to it using Hammer, and then add another repo to it using Hammer. => Everything works.
Now revert this commit and repeat these steps. => Chaos and errors ensue. (Because Hammer sends a list of strings to the API, taking the list difference with the repository_ids already in the rolling CV, will cause Katello to attempt adding the same repo to the rolling CV multiple times in a single task).