Skip to content
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

Fix long lines not working over stdin #220

Merged
merged 1 commit into from
Apr 29, 2020

Conversation

carlpett
Copy link
Contributor

Currently, piping a manifest with very long lines subtly breaks kubeval. The bufio.Scanner used is not checked for errors after use, and for lines longer than 64k (https://github.com/golang/go/blob/go1.14/src/bufio/scan.go#L79) this means missing an ErrTooLong. Since the error is never checked, kubeval assumes the full input has been read, and validates whatever it managed to read.

We ran into this because of a ConfigMap with a binaryData segment of a couple hundred kilobytes.

This PR removes the Scanner and just uses io.Copy instead.

ping @garethr

Copy link
Collaborator

@garethr garethr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, appreciate the fix.

@garethr
Copy link
Collaborator

garethr commented Apr 29, 2020

If you could rebase against the latest master that would be appreciated. Otherwise looks good.

@carlpett
Copy link
Contributor Author

@garethr Done! Thanks for the review

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants