New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
MGMT-14634: Ensure that empty manifest may not be added. #5348
MGMT-14634: Ensure that empty manifest may not be added. #5348
Conversation
Presently, if a manifest has no content then it passes validation. This breaks bootkube when empty content is submitted. This PR validates that manifest content is not empty before accepting it.
@paul-maidment: This pull request references MGMT-14634 which is a valid jira issue. In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: carbonin, paul-maidment The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## master #5348 +/- ##
==========================================
- Coverage 67.54% 67.53% -0.01%
==========================================
Files 226 226
Lines 33278 33280 +2
==========================================
- Hits 22476 22475 -1
- Misses 8775 8778 +3
Partials 2027 2027
|
@@ -412,6 +412,11 @@ func (m *Manifests) validateAllowedToModifyManifests(ctx context.Context, cluste | |||
} | |||
|
|||
func (m *Manifests) validateUserSuppliedManifest(ctx context.Context, clusterID strfmt.UUID, manifestContent []byte, fileName string) error { | |||
// If the manifest content size is zero then some of the content validations might pass when they should not | |||
// We need to reject zero size content | |||
if len(manifestContent) == 0 { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we go one step further and validate that there's (exactly? at-least?) a single parsable YAML document within the manifest file?
@paul-maidment: all tests passed! Full PR test history. Your PR dashboard. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here. |
…dded. (openshift#5348)" This reverts commit 10a88f5. It was found that this validation is causing issues for the UI. We have some mitigations planned for the issues, however this commit needs to be rolled back for now to prevent ongoing breakage while the issues are addressed.
…dded. (openshift#5348)" (openshift#5353) This reverts commit 10a88f5. It was found that this validation is causing issues for the UI. We have some mitigations planned for the issues, however this commit needs to be rolled back for now to prevent ongoing breakage while the issues are addressed.
…dded. (openshift#5348)" (openshift#5353) This reverts commit 10a88f5. It was found that this validation is causing issues for the UI. We have some mitigations planned for the issues, however this commit needs to be rolled back for now to prevent ongoing breakage while the issues are addressed.
…dded. (openshift#5348)" (openshift#5353) This reverts commit 10a88f5. It was found that this validation is causing issues for the UI. We have some mitigations planned for the issues, however this commit needs to be rolled back for now to prevent ongoing breakage while the issues are addressed.
Presently, if a manifest has no content then it passes validation. This breaks bootkube when empty content is submitted.
This PR validates that manifest content is not empty before accepting it.
List all the issues related to this PR
What environments does this code impact?
How was this code tested?
Submitted an empty file to the API endpoint and observed that validation now fails.
Checklist
docs
, README, etc)Reviewers Checklist