fix(diagnostics): redact the OCF device name; log description on unknown type
Two things a review of this branch turned up. /oic/d's `n` is free text the owner sets from the SmartThings app, so it may carry a person's name. Nothing in the /device/0 dump has ever exposed it -- it only became reachable when diagnostics started reporting /oic/d earlier in this branch, which would have started carrying it into public issue reports. Redact it. `rt`, the device-type signal the block exists for, is untouched, and no /device/0 resource uses a bare 'n' key, so nothing else changes. The unknown-device-type warning logged only modelNum. That line is what a user pastes into an issue, and modelNum alone can't identify a washer from a dryer -- both report the shared DA_WM_ laundry board, and detection reads the consumer-model code out of `description` for exactly that reason. Log both fields.
This commit is contained in:
4 files changed
+41
-16
No files matched your search
@@ -58,7 +58,8 @@ async def test_diagnostics_include_ocf_identity(
|
||||
device_types=('oic.wk.d', 'oic.d.refrigerator'),
|
||||
raw={
|
||||
'/oic/p': {'mnmn': 'Samsung Electronics', 'pi': '12-34-56'},
|
||||
'/oic/d': {'n': 'Family Hub', 'di': 'ab-cd-ef'},
|
||||
'/oic/d': {'n': 'Family Hub', 'di': 'ab-cd-ef',
|
||||
'rt': ['oic.wk.d', 'oic.d.refrigerator']},
|
||||
},
|
||||
)
|
||||
|
||||
@@ -67,11 +68,16 @@ async def test_diagnostics_include_ocf_identity(
|
||||
identity = diag['identity']
|
||||
assert identity['model'] == 'RF9000B'
|
||||
assert identity['device_types'] == ['oic.wk.d', 'oic.d.refrigerator']
|
||||
# The raw payloads ride along redacted -- we don't yet know which of
|
||||
# their fields identify a device type, so none are dropped up front.
|
||||
# The raw payloads ride along whole -- we don't yet know which of their
|
||||
# fields identify a device type, so nothing is dropped up front beyond
|
||||
# what redaction takes out.
|
||||
assert identity['resources']['/oic/p']['mnmn'] == 'Samsung Electronics'
|
||||
assert identity['resources']['/oic/d']['di'] == REDACTED
|
||||
assert identity['resources']['/oic/p']['pi'] == REDACTED
|
||||
# The owner-settable device name is redacted; `rt` -- the reason this
|
||||
# block exists -- is not.
|
||||
assert identity['resources']['/oic/d']['n'] == REDACTED
|
||||
assert identity['resources']['/oic/d']['rt'] == ['oic.wk.d', 'oic.d.refrigerator']
|
||||
|
||||
|
||||
async def test_diagnostics_identity_none_when_unavailable(
|
||||
|
||||
Reference in new issue
Block a user