The script hooks into text input controls at runtime and monitors when they lose focus. For each interaction, it captures the entered text, the input field class, accessibility identifier when available, placeholder text when available, and the isSecureTextEntry attribute. Based on this value, it reports whether the input is masked or exposed.
The test case fails because the output shows the password field with isSecureTextEntry set to false, meaning it is exposed — and this field contains sensitive data.
The password input (password_field) has isSecureTextEntry=false and contains sensitive data.
The username input (username_field) has isSecureTextEntry=false but is not considered sensitive.
The OTP 1 input (otp_1_field) has isSecureTextEntry=true, masking the sensitive data.
The OTP 2 input (OTP 2) is a SwiftUI SecureField which always masks input. Notice that its aid is null because SwiftUI's SecureField does not propagate the accessibilityIdentifier to the underlying UITextField. However, placeholder correctly shows OTP 2 and isSecureTextEntry=true confirms masking of the data.
Note
Exposed fields display typed characters in plain text, while masked fields show bullet characters, so the test can also be verified visually by observing the on-screen behavior.
Note
Besides masking, secure fields (isSecureTextEntry=true or SwiftUI SecureField) also keep input on the system keyboard: iOS does not offer installed third-party (custom) keyboards for them (see Custom Keyboards). The unmasked password_field therefore also allows a third-party keyboard to receive the typed password.