okta / okta-devices-swift

okta-devices-swift
https://github.com/okta/okta-devices-swift
Apache License 2.0
8 stars 1 forks source link

OKTA-648357 - Conform DeviceSignalsModel to CustomStringConvertible #156

Closed moisesolmedo-okta closed 1 year ago

moisesolmedo-okta commented 1 year ago

Problem Analysis (Technical)

Need to log certain 1st party properties and hide others.

Solution (Technical)

Conform DeviceSignalsModel to CustomStringConvertible so we can customize it's description.

Output after printing object:

2023-09-18 19:00:35.912621-0400 Okta Verify[1859:843208] {✅ "AsyncSignals": {"message": "First party signals collected: , platform: Optional(OktaDeviceSDK.PlatformValue.iOS), osVersion: Optional("16.6.1"), displayName: <REDACTED>, id: <REDACTED>, manufacturer: Optional("APPLE"), model: Optional("iPhone10,3"), serialNumber: <REDACTED>, udid: <REDACTED>, meid: <REDACTED>, imei: <REDACTED>, sid: <REDACTED>, secureHardwarePresent: Optional(true), screenLockType: Optional(OktaDeviceSDK.ScreenLockValue.biometric), diskEncryptionType: Optional(OktaDeviceSDK.DiskEncryptionValue.full), deviceAttestation: <REDACTED>, clientInstanceId: Optional("FD0C8204-5479-44E6-98B5-EB4187CB1E77"), clientInstanceKey: <REDACTED>, clientInstanceBundleId: Optional("com.okta.mobile.internalrelease"), clientInstanceVersion: Optional("9.3.0"), clientInstanceDeviceSdkVersion: Optional("DeviceAuthenticator 1.1.0"), authenticatorAppKey: <REDACTED>", "defaultProperties": "", "location": "FirstPartySignalsProvider.swift:logSignals(_:):77"}}

Affected Components

Steps to reproduce:

Actual result:

Expected result:

Tests

moisesolmedo-okta commented 1 year ago

Overall looks good. Not completely sold on using reflection

Why I see REDACTED for those signals?

meid: <REDACTED>, imei: <REDACTED>, sid: <REDACTED>

It could be misleading since values should not be there at all or should contain nil value

Updated, had to check if the property had some value.