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

PM-15110: Ensure all network requests always use the current environment data #4344

Merged
merged 1 commit into from
Nov 20, 2024

Conversation

david-livefront
Copy link
Collaborator

@david-livefront david-livefront commented Nov 20, 2024

🎟️ Tracking

PM-15110

📔 Objective

This PR addresses a bug where a user not using the US environment (default) could make a request to refresh the token before before the coroutine flow would update the environment data. To fix this, the BaseUrlInterceptors now use the environment retrieved synchronously from the EnvironmentDiskSource.

⏰ Reminders before review

  • Contributor guidelines followed
  • All formatters and local linters executed and passed
  • Written new unit and / or integration tests where applicable
  • Used internationalization (i18n) for all UI strings
  • CI builds passed
  • Communicated to DevOps any deployment requirements
  • Updated any necessary documentation or informed the documentation team

🦮 Reviewer guidelines

  • 👍 (:+1:) or similar for great changes
  • 📝 (:memo:) or ℹ️ (:information_source:) for notes or general info
  • ❓ (:question:) for questions
  • 🤔 (:thinking:) or 💭 (:thought_balloon:) for more open inquiry that's not quite a confirmed
    issue and could potentially benefit from discussion
  • 🎨 (:art:) for suggestions / improvements
  • ❌ (:x:) or ⚠️ (:warning:) for more significant problems or concerns needing attention
  • 🌱 (:seedling:) or ♻️ (:recycle:) for future improvements or indications of technical debt
  • ⛏ (:pick:) for minor or nitpick changes

Copy link
Contributor

github-actions bot commented Nov 20, 2024

Logo
Checkmarx One – Scan Summary & Details7a36e6b8-4c43-4f5e-9267-7044e2288acb

New Issues

Severity Issue Source File / Package Checkmarx Insight
MEDIUM Privacy_Violation /app/src/main/java/com/x8bit/bitwarden/ui/vault/feature/item/VaultItemViewModel.kt: 875 Attack Vector

Fixed Issues

Severity Issue Source File / Package
MEDIUM Unpinned Actions Full Length Commit SHA /crowdin-pull.yml: 26

@david-livefront david-livefront force-pushed the PM-15110-frequent-logouts branch from 29660b6 to ba4a316 Compare November 20, 2024 19:15
*/
class BaseUrlInterceptor : Interceptor {
class BaseUrlInterceptor(
private val baseUrlProvider: () -> String?,
Copy link
Collaborator

Choose a reason for hiding this comment

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

gr8 idea ⚡

import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.onSubscription

class FakeEnvironmentDiskSource : EnvironmentDiskSource {
Copy link
Collaborator

Choose a reason for hiding this comment

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

👍

Copy link
Collaborator

@dseverns-livefront dseverns-livefront left a comment

Choose a reason for hiding this comment

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

Big fan of the lambda as the provider to get the updated values when needed!

@david-livefront
Copy link
Collaborator Author

Thanks @dseverns-livefront

@david-livefront david-livefront added this pull request to the merge queue Nov 20, 2024
Copy link

codecov bot commented Nov 20, 2024

Codecov Report

Attention: Patch coverage is 83.33333% with 1 line in your changes missing coverage. Please review.

Project coverage is 88.98%. Comparing base (5ea1770) to head (ba4a316).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
...tasource/network/interceptor/BaseUrlInterceptor.kt 83.33% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4344      +/-   ##
==========================================
- Coverage   88.99%   88.98%   -0.01%     
==========================================
  Files         453      452       -1     
  Lines       39109    39088      -21     
  Branches     5513     5513              
==========================================
- Hits        34805    34784      -21     
  Misses       2377     2377              
  Partials     1927     1927              

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


🚨 Try these New Features:

Merged via the queue into main with commit 3092ba1 Nov 20, 2024
9 checks passed
@david-livefront david-livefront deleted the PM-15110-frequent-logouts branch November 20, 2024 20:00
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