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

test: added more code coverage for usecase package #342

Merged
merged 6 commits into from
Sep 16, 2024

Conversation

emeeker2002
Copy link
Contributor

added more code coverage for usecase package

Copy link

codecov bot commented Sep 5, 2024

Codecov Report

Attention: Patch coverage is 73.19588% with 26 lines in your changes missing coverage. Please review.

Project coverage is 72.41%. Comparing base (0cb4bdb) to head (cb53d65).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
internal/usecase/devices/interceptor.go 73.19% 18 Missing and 8 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #342      +/-   ##
==========================================
+ Coverage   68.61%   72.41%   +3.80%     
==========================================
  Files          64       64              
  Lines        4320     4376      +56     
==========================================
+ Hits         2964     3169     +205     
+ Misses       1111      949     -162     
- Partials      245      258      +13     

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

Copy link
Member

@rsdmike rsdmike left a comment

Choose a reason for hiding this comment

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

Looking good Ethan, my only ask is if we can add bounds checking to the overflow errors. Our security folks won't like us ignoring possible overflow integer errors.
I'm thinking we can do something like:

	lenChallengeUsername := uint8(0)
	lenAuthURL := uint8(0)
	// Check for potential overflow
	if len(challenge.Username) <= math.MaxUint8 {
		lenChallengeUsername = uint8(len(challenge.Username))
	}

	if len(authURL) <= math.MaxUint8 {
		lenChallengeUsername = uint8(len(challenge.Username))
	}

That seems to be a way to address the findings: securego/gosec#1187 . It may not get rid of the errors since that was merged so recently, but at least can get the code in place.

internal/usecase/devices/interceptor.go Outdated Show resolved Hide resolved
@emeeker2002 emeeker2002 force-pushed the code-cover-usecase branch 6 times, most recently from 8dc0507 to 09b9d62 Compare September 12, 2024 21:34
@emeeker2002 emeeker2002 force-pushed the code-cover-usecase branch 2 times, most recently from 762fbef to 5b9030a Compare September 13, 2024 00:40
@madhavilosetty-intel madhavilosetty-intel merged commit 653d99b into main Sep 16, 2024
20 checks passed
@madhavilosetty-intel madhavilosetty-intel deleted the code-cover-usecase branch September 16, 2024 17: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.

3 participants