[PR #1175] [MERGED] Use monotonic clock for vault timeout #2781

Closed
opened 2025-11-26 23:24:01 -06:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/bitwarden/android/pull/1175
Author: @mpbw2
Created: 12/12/2020
Status: Merged
Merged: 12/14/2020
Merged by: @mpbw2

Base: masterHead: vault-timeout


📝 Commits (3)

  • 0b0b9ca Use monotonic clock for vault timeout
  • d760e5c free memory
  • b6f6b47 removed vault timeout timers and added crash logging to iOS clock hack

📊 Changes

11 files changed (+98 additions, -96 deletions)

View changed files

📝 src/Android/MainActivity.cs (+1 -18)
📝 src/Android/Services/DeviceActionService.cs (+9 -0)
📝 src/App/Abstractions/IDeviceActionService.cs (+1 -0)
📝 src/App/App.xaml.cs (+3 -7)
📝 src/App/Pages/BaseContentPage.cs (+9 -3)
📝 src/App/Services/MobilePlatformUtilsService.cs (+5 -0)
📝 src/Core/Abstractions/IPlatformUtilsService.cs (+2 -1)
📝 src/Core/Services/VaultTimeoutService.cs (+3 -3)
📝 src/iOS.Core/Services/DeviceActionService.cs (+7 -0)
📝 src/iOS.Core/Utilities/iOSHelpers.cs (+56 -2)
📝 src/iOS/AppDelegate.cs (+2 -62)

📄 Description

Protects the vault-timeout from clock changes by using a monotonic clock, validated on app resume. *

Android made this super easy. iOS required a hack is required to get trustworthy values - instead of a timestamp in seconds we get a difference in seconds between now and the boot time, resulting in a duration that includes sleep time. As both of those values are susceptible to clock changes in the same manner, the difference between them will be fixed, resulting in an anchored and forward-moving value that can be used as a monotonic clock.

  • Unless I'm missing something @kspearrin this can replace the timers on both platforms. I can remove them outright if you agree.

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/bitwarden/android/pull/1175 **Author:** [@mpbw2](https://github.com/mpbw2) **Created:** 12/12/2020 **Status:** ✅ Merged **Merged:** 12/14/2020 **Merged by:** [@mpbw2](https://github.com/mpbw2) **Base:** `master` ← **Head:** `vault-timeout` --- ### 📝 Commits (3) - [`0b0b9ca`](https://github.com/bitwarden/android/commit/0b0b9ca094627bfdc443d730639297d2b285a07a) Use monotonic clock for vault timeout - [`d760e5c`](https://github.com/bitwarden/android/commit/d760e5c5e07862c20f4e164f34ca590a1aa7340a) free memory - [`b6f6b47`](https://github.com/bitwarden/android/commit/b6f6b47fb58be44660333fbef31bce8393b1b77b) removed vault timeout timers and added crash logging to iOS clock hack ### 📊 Changes **11 files changed** (+98 additions, -96 deletions) <details> <summary>View changed files</summary> 📝 `src/Android/MainActivity.cs` (+1 -18) 📝 `src/Android/Services/DeviceActionService.cs` (+9 -0) 📝 `src/App/Abstractions/IDeviceActionService.cs` (+1 -0) 📝 `src/App/App.xaml.cs` (+3 -7) 📝 `src/App/Pages/BaseContentPage.cs` (+9 -3) 📝 `src/App/Services/MobilePlatformUtilsService.cs` (+5 -0) 📝 `src/Core/Abstractions/IPlatformUtilsService.cs` (+2 -1) 📝 `src/Core/Services/VaultTimeoutService.cs` (+3 -3) 📝 `src/iOS.Core/Services/DeviceActionService.cs` (+7 -0) 📝 `src/iOS.Core/Utilities/iOSHelpers.cs` (+56 -2) 📝 `src/iOS/AppDelegate.cs` (+2 -62) </details> ### 📄 Description Protects the vault-timeout from clock changes by using a monotonic clock, validated on app resume. * Android made this super easy. iOS required a hack is required to get trustworthy values - instead of a timestamp in seconds we get a difference in seconds between now and the boot time, resulting in a duration that includes sleep time. As both of those values are susceptible to clock changes in the same manner, the difference between them will be fixed, resulting in an anchored and forward-moving value that can be used as a monotonic clock. * Unless I'm missing something @kspearrin this can replace the timers on both platforms. I can remove them outright if you agree. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2025-11-26 23:24:01 -06:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/android#2781