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

chore: respond with 401 for programmatic requests. #8795

Merged
merged 2 commits into from
Feb 6, 2024

Conversation

hamidzr
Copy link
Member

@hamidzr hamidzr commented Feb 2, 2024

to proxied services instead of redirecting those to login page

https://hpe-aiatscale.atlassian.net/browse/GAS-568?filter=-2

Description

Test Plan

after:
hbp ➜ lore git:(main) ✗ curl -H "Accept: application/json" -L http://localhost:8080/genai/favicas -v
*   Trying [::1]:8080...
* Connected to localhost (::1) port 8080
> GET /genai/favicas HTTP/1.1
> Host: localhost:8080
> User-Agent: curl/8.4.0
> Accept: application/json
>
< HTTP/1.1 401 Unauthorized
< Content-Type: application/json; charset=UTF-8
< Vary: Origin
< X-Content-Type-Options: nosniff
< X-Frame-Options: SAMEORIGIN
< X-Xss-Protection: 1; mode=block
< Date: Fri, 02 Feb 2024 23:48:17 GMT
< Content-Length: 27
<
{"message":"Unauthorized"}
* Connection #0 to host localhost left intact

before:
hbp ➜ lore git:(main) ✗ curl -H "Accept: application/json" -L http://localhost:8080/genai/favicas -v
*   Trying [::1]:8080...
* Connected to localhost (::1) port 8080
> GET /genai/favicas HTTP/1.1
> Host: localhost:8080
> User-Agent: curl/8.4.0
> Accept: application/json
>
< HTTP/1.1 303 See Other

Commentary (optional)

Checklist

  • Changes have been manually QA'd
  • User-facing API changes need the "User-facing API Change" label.
  • Release notes should be added as a separate file under docs/release-notes/.
    See Release Note for details.
  • Licenses should be included for new code which was copied and/or modified from any external code.

Ticket

to proxied services instead of redirecting those to login  page
@hamidzr hamidzr requested a review from a team as a code owner February 2, 2024 23:46
@cla-bot cla-bot bot added the cla-signed label Feb 2, 2024
Copy link

netlify bot commented Feb 2, 2024

Deploy Preview for determined-ui canceled.

Name Link
🔨 Latest commit bf1cf26
🔍 Latest deploy log https://app.netlify.com/sites/determined-ui/deploys/65c17732fa30460008aa8796

Copy link

codecov bot commented Feb 2, 2024

Codecov Report

Attention: 1 lines in your changes are missing coverage. Please review.

Comparison is base (17f305f) 47.72% compared to head (bf1cf26) 47.73%.
Report is 6 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #8795   +/-   ##
=======================================
  Coverage   47.72%   47.73%           
=======================================
  Files        1049     1049           
  Lines      167238   167239    +1     
  Branches     2241     2243    +2     
=======================================
+ Hits        79815    79830   +15     
+ Misses      87265    87251   -14     
  Partials      158      158           
Flag Coverage Δ
backend 43.28% <85.71%> (+0.04%) ⬆️
harness 64.32% <ø> (ø)
web 42.54% <ø> (ø)

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

Files Coverage Δ
master/internal/api_auth.go 44.79% <85.71%> (+16.37%) ⬆️

... and 1 file with indirect coverage changes

@hamidzr hamidzr requested a review from hkang1 February 2, 2024 23:49
Copy link
Contributor

@kkunapuli kkunapuli left a comment

Choose a reason for hiding this comment

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

LGTM! I left a couple small comments/questions but nothing blocking.

I also understand if you'd prefer to have someone with more context also take a look. :)

master/internal/api_auth.go Show resolved Hide resolved
master/internal/api_auth.go Show resolved Hide resolved
@hamidzr hamidzr self-assigned this Feb 5, 2024
@hamidzr
Copy link
Member Author

hamidzr commented Feb 6, 2024

Thanks for the review. I added some tests to check the behavior as well.

@hamidzr hamidzr merged commit 4e17ef7 into main Feb 6, 2024
74 of 86 checks passed
@hamidzr hamidzr deleted the hz-proxied-err-handling branch February 6, 2024 17:01
maxrussell pushed a commit that referenced this pull request Mar 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants