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(gui-ubuntupro): Verify certificate files #949

Merged
merged 7 commits into from
Nov 19, 2024
Merged

Conversation

ashuntu
Copy link
Collaborator

@ashuntu ashuntu commented Nov 13, 2024

Adds verification for certificate files by first checking their file extension, and, if possible, their content. If a certificate path isn't a valid certificate, an error is shown in the UI and continuing is blocked.

Example invalid certificate file

image

Fixes #880


UDENG-5109

This validates files based on file extension, then, if possible, if the file contains the correct certificate delimiters.
Sometimes (notably, when going from an error state to a non-error state), the previous error will be retained on the screen. This makes sure every change of the path is validated and updated.
Existing apply config tests were missing the ssl key portion, this commits add that.
Copy link

codecov bot commented Nov 13, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 89.08%. Comparing base (e02b29f) to head (74d9afb).
Report is 44 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #949      +/-   ##
==========================================
+ Coverage   89.03%   89.08%   +0.04%     
==========================================
  Files         110      110              
  Lines        7445     7506      +61     
==========================================
+ Hits         6629     6687      +58     
- Misses        638      639       +1     
- Partials      178      180       +2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.


🚨 Try these New Features:

Note that the dummy binary_cert.der file is a file of random bytes, not necessarily a real certificate.
@ashuntu ashuntu marked this pull request as ready for review November 14, 2024 21:46
@ashuntu ashuntu requested a review from a team as a code owner November 14, 2024 21:46
Copy link
Contributor

@CarlosNihelton CarlosNihelton left a comment

Choose a reason for hiding this comment

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

I think this benefits from using a third-party library instead of parsing by hand.

Copy link
Contributor

@CarlosNihelton CarlosNihelton left a comment

Choose a reason for hiding this comment

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

This code is more reliable for sure. Just a little more stylish touches and we'll be good to go.

Copy link
Contributor

@CarlosNihelton CarlosNihelton left a comment

Choose a reason for hiding this comment

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

Good job!

@ashuntu ashuntu merged commit d82e55f into main Nov 19, 2024
35 checks passed
@ashuntu ashuntu deleted the verify-certificates branch November 19, 2024 16:54
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.

Verify that the certificate is really a certificate
2 participants