-
Notifications
You must be signed in to change notification settings - Fork 29
The _encodeDateHeader method in SigV4Signer+PayloadSigning.swift is throwing unexpected exceptions. #189
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
Comments
Thank you for the report @Danson23. Someone from the team will need to investigate this. |
Hello,
Also, is the device date being manually set to an invalid value? |
We also have two users who experienced crashes here.
After reviewing the code, I found that the date value comes either from the AWS backend or is created using the current date. |
Thanks for the details @RentonLin, do you happen to have the request IDs for those crashes so that we can send to the service team to investigate? |
No,in that method's context, what we can get is only key and date. |
Hello, your suggestion of adding a log is correct. |
@Danson23 Hmm so that's interesting. Have you tried other locales to see what happens? I tried to repro in an Xcode playgroun with Swift and was unable to reproduce the issue. extension Locale {
static var current : Locale { return Locale.init(identifier: "en_TH") }
}
class MyViewController : UIViewController {
override func loadView() {
let view = UIView()
let dateFormatter = DateFormatter()
dateFormatter.dateFormat = "EEE, d MMM yyyy HH:mm:ss z"
guard let date = dateFormatter.date(from: "Fri, 02 Feb 2025 02:15:15 GMT") else {
return
}
let locale = Locale.current
print("Date: ", date)
print("Date Time Interval Since 1970: ", date.timeIntervalSince1970)
print("Locale: ", locale)
var headerValue = UInt64(date.timeIntervalSince1970 * 1_000).bigEndian
print("Header Value: ", headerValue)
self.view = view
}
} Logs:
Tested in Xcode 16.2 |
The issue may be related to the iOS version. I was able to pinpoint Thailand by analyzing the common traits among users experiencing crashes. It might be worthwhile to consider implementing some proactive safeguards. |
@Danson23 From your metrics, which iOS version(s) were these users using? |
I have pushed a fix in aws-amplify/amplify-swift#3965. I will update here once we release it. |
Fix has been released: https://github.com/aws-amplify/amplify-ui-swift-liveness/releases/tag/1.3.5 Please update to the newer version. |
|
Describe the bug
Specifically, the _encodeDateHeader method in SigV4Signer+PayloadSigning.swift, which is responsible for encoding the date header, is encountering unexpected crashes.
Steps To Reproduce
Expected behavior
I expect to address this issue by releasing a new version with the necessary fixes.
Swift Liveness Version
1.3.3
Xcode version
Xcode 15.4(15F31d)
Relevant log output
Is this a regression?
Yes
Regression additional context
No response
OS Version
IOS 18.1.1/ IOS16.7.10
Device
iPhone 13/ iPhone 8
Specific to simulators
No response
Additional context
No response
The text was updated successfully, but these errors were encountered: