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(neon_http_client): Make authorization throttling less agressive #2582

Conversation

provokateurin
Copy link
Member

The detection flagged some responses that were fine (even though I believe nothing should really use the 401 status code except the authentication middleware), which resulted in the app becoming unusable due to the blocking.

I limited it to OCS responses for now as most requests use that format and we can correctly detect invalid credentials 100% of the time through the custom status code 997.
For non-OCS APIs and WebDAV it might be possible as well, but I think they are not so important and we can add them if ever needed.

I know there are those really ugly nested if blocks, but the alternative would be to chain null-aware casts and I don't think that is much better than this.

@provokateurin provokateurin force-pushed the fix/neon_http_client/less-aggressive-authorization-throttling branch from 5432a51 to d403cee Compare October 23, 2024 12:23
Copy link

codecov bot commented Oct 23, 2024

Codecov Report

Attention: Patch coverage is 78.26087% with 5 lines in your changes missing coverage. Please review.

Project coverage is 28.86%. Comparing base (f4e33f6) to head (e2ca39a).
Report is 11 commits behind head on main.

Files with missing lines Patch % Lines
...rceptors/authorization_throttling_interceptor.dart 78.26% 5 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main    #2582   +/-   ##
=======================================
  Coverage   28.85%   28.86%           
=======================================
  Files         370      370           
  Lines      136528   136549   +21     
=======================================
+ Hits        39396    39411   +15     
- Misses      97132    97138    +6     
Flag Coverage Δ *Carryforward flag
account_repository 98.47% <ø> (ø)
cookie_store 99.48% <ø> (ø) Carriedforward from 46a0e52
dashboard_app 96.05% <ø> (ø)
dynamite 31.05% <ø> (ø) Carriedforward from 46a0e52
dynamite_end_to_end_test 61.69% <ø> (ø) Carriedforward from 46a0e52
dynamite_runtime 85.40% <ø> (ø) Carriedforward from 46a0e52
interceptor_http_client 97.18% <ø> (ø) Carriedforward from 46a0e52
neon_dashboard 96.05% <ø> (ø) Carriedforward from 46a0e52
neon_framework 61.17% <ø> (ø)
neon_http_client 93.61% <78.26%> (-3.89%) ⬇️
neon_notifications 100.00% <ø> (ø) Carriedforward from 46a0e52
neon_storage 94.66% <ø> (ø) Carriedforward from 46a0e52
neon_talk 99.45% <ø> (ø) Carriedforward from 46a0e52
nextcloud 24.33% <ø> (ø) Carriedforward from 46a0e52
notifications_app 97.40% <ø> (ø)
notifications_push_repository 98.11% <ø> (ø)
sort_box 90.90% <ø> (ø) Carriedforward from 46a0e52
talk_app 98.94% <ø> (ø)

*This pull request uses carry forward flags. Click here to find out more.

Files with missing lines Coverage Δ
...rceptors/authorization_throttling_interceptor.dart 89.28% <78.26%> (-10.72%) ⬇️

Copy link
Member

@Leptopoda Leptopoda left a comment

Choose a reason for hiding this comment

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

Now we also need tests validating that:

  • non json responses are not intercepted
  • json responses not matching the pattern are not intercepted

@provokateurin provokateurin force-pushed the fix/neon_http_client/less-aggressive-authorization-throttling branch from d403cee to e2ca39a Compare October 29, 2024 19:29
@provokateurin provokateurin merged commit bc7b1ea into main Oct 31, 2024
10 checks passed
@provokateurin provokateurin deleted the fix/neon_http_client/less-aggressive-authorization-throttling branch October 31, 2024 11:15
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