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

cli: correctly trim white spaces for certificates in verify #2299

Merged
merged 1 commit into from
Sep 4, 2023

Conversation

daniel-weisse
Copy link
Member

Context

The code in cli/internal/cmd/verify.go removes a trailing newline by reslicing the certificate slice unconditionally to remove the last byte.
This panics if the given certificate is nil, and causes errors if the certificate does not end with a newline.

Proposed change(s)

  • Use strings.TrimSpace to correctly remove white spaces at the front and end of a given certificate
  • Return an error if no certificates could be parsed

@daniel-weisse daniel-weisse added the bug fix Fixing a bug label Sep 1, 2023
@github-actions
Copy link
Contributor

github-actions bot commented Sep 1, 2023

Coverage report

Package Old New Trend
cli/internal/cmd 53.50% 53.60% ↗️

@daniel-weisse daniel-weisse merged commit 311da4c into main Sep 4, 2023
8 checks passed
@daniel-weisse daniel-weisse deleted the fix/cli/verify-parse-certs-check branch September 4, 2023 06:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug fix Fixing a bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants