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

MTV-1377 | Fix the auth to return 401 instead of 403 #1013

Merged
merged 2 commits into from
Sep 4, 2024

Conversation

mnecas
Copy link
Member

@mnecas mnecas commented Sep 3, 2024

First issue

Issue: When we request the inventory web endpoint the auth functions
allows the user to get the endpoint even with the incorrect token.

Fix: Change the permit function logic so we do not set the auth=true.

Second issue

Issue: Right now the request with an invalid token returns 403 instead of
the expected 401.

Fix: Change the permit function to return the status code instead of
Boolean.

Issue: When we request the inventory web endpoint the auth functions
allows the user to get the endpoint even with incorrect token.

Fix: Change the permit function logic so we do not set the auth=true.

Signed-off-by: Martin Necas <[email protected]>
@mnecas mnecas requested a review from yaacov as a code owner September 3, 2024 07:49
@mnecas mnecas changed the title MTV 1337 | Fix the auth to return 401 instead of 403 MTV-1377 | Fix the auth to return 401 instead of 403 Sep 3, 2024
Copy link

codecov bot commented Sep 3, 2024

Codecov Report

Attention: Patch coverage is 38.88889% with 11 lines in your changes missing coverage. Please review.

Project coverage is 16.43%. Comparing base (b1a1cca) to head (50e3653).
Report is 7 commits behind head on main.

Files with missing lines Patch % Lines
pkg/controller/provider/web/base/auth.go 38.88% 9 Missing and 2 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1013      +/-   ##
==========================================
- Coverage   16.44%   16.43%   -0.01%     
==========================================
  Files         107      107              
  Lines       19648    19642       -6     
==========================================
- Hits         3231     3229       -2     
+ Misses      16130    16126       -4     
  Partials      287      287              
Flag Coverage Δ
unittests 16.43% <38.88%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

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

Issue: Right now the reuqest with invalid token return 403 instead of
the expected 401.

Fix: Change the `permit` function to return the status code instead of
boolean.

Signed-off-by: Martin Necas <[email protected]>
Copy link

sonarqubecloud bot commented Sep 3, 2024

Copy link
Member

@yaacov yaacov left a comment

Choose a reason for hiding this comment

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

LGTM

@mnecas mnecas merged commit 26406f2 into kubev2v:main Sep 4, 2024
12 of 13 checks passed
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