Archive for December 21, 2023

Thursday, December 21, 2023

State Restoration With NSSecureCoding on Sonoma

Milen Dzhumerov:

AppKit state restoration behaviour changed on macOS 14 Sonoma in a subtle way that can lead to apps not restoring their state correctly. The change can lead to silent breakages which can be hard to debug.

[…]

Violations can now arise in any -restoreStateWithCoder: implementations, so they need to be audited.

  • Check for any usages of -[NSCoder decodeObjectForKey:].
    • Replace with the appropriate secure variants.
  • At the end of -restoreStateWithCoder:, check the value of NSCoder.error property.
    • If it’s non-nil, an error must have occurred earlier.

This is necessary because AppKit uses NSDecodingFailurePolicySetErrorAndReturn, rather than raising an exception that couldn’t be caught with Swift.

I was already opting into using secure coding but have sometimes seen this error logged even though I was implementing that method:

WARNING: Secure coding is not enabled for restorable state! Enable secure coding by implementing NSApplicationDelegate.applicationSupportsSecureRestorableState: and returning YES.

See also: Jordan Morgan.

Previously:

How to Change a New iPhone Passcode If You Forget It

Tim Hardwick:

In iOS 17 and iPadOS 17, it is now possible to reset an iPhone or iPad’s new passcode with the previous passcode you used for up to three days after the change is made. In other words, Apple lets you use your old passcode within 72 hours of setting a new one, which is handy if you’re someone who is likely to forget a newly created passcode.

When you enter an incorrect passcode on a device running iOS 17 after making a change, simply tap on the Forgot Passcode? option at the bottom of the display to use the Try Passcode Reset option. Tapping it allows you to use your old passcode to create yet another new passcode.

For protection in case someone has learned your passcode, there is also an “Expire Previous Passcode Now” setting that you can make use of.

Previously:

Manual AutoFill in Safari

Dan Moren:

In a very clever move, Apple has introduced essentially a manual mode for AutoFill. You’re no longer dependent on Safari recognizing that, yes, these are fields where you can put your address in. Instead, anywhere that you can enter text—and not just in Safari, but anywhere, in any app—bring up the contextual menu by right/two-finger/control clicking on the Mac or tapping and holding on iOS/iPadOS, and then go to the new AutoFill submenu. From there choose Contact or Passwords, depending on what info you want to bring up, and you can have it drop that info right into the form.

Previously:

Update (2023-12-22): Ricky Mondello:

Not just Safari! Across the whole OS (macOS, iOS, iPadOS)! For any Mac app not using a standard contextual menu, you can look in the Edit menu for AutoFill, too!

Don:

Sadly only for iCloud Keychain passwords and not 3rd party password-managers.