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
@@ -371,13 +371,20 @@ class LocalThingsCoordinator(DataUpdateCoordinator[dict[str, Any]]):
|
||||
warm.add(href)
|
||||
|
||||
model_num = info.get('x.com.samsung.da.modelNum', '')
|
||||
description = info.get('x.com.samsung.da.description', '')
|
||||
if reg is not None:
|
||||
self._log.debug("device type: %s (modelNum=%r)", reg.name, model_num)
|
||||
bound = discover(resources, reg.capabilities, reg.pattern_capabilities,
|
||||
log=unbound.append, tier_log=_tier_log)
|
||||
self.device_type_name = reg.name
|
||||
else:
|
||||
self._log.warning("unknown device type modelNum=%r; using common caps", model_num)
|
||||
# Both fields: detection reads each of them (board token, then
|
||||
# consumer-model code), and this line is what a user pastes into
|
||||
# an issue -- modelNum alone doesn't identify a washer or dryer.
|
||||
self._log.warning(
|
||||
"unknown device type modelNum=%r description=%r; using common caps",
|
||||
model_num, description,
|
||||
)
|
||||
bound = discover(resources, CAPABILITIES, log=unbound.append, tier_log=_tier_log)
|
||||
self.device_type_name = None
|
||||
self.bound = bound
|
||||
|
||||
@@ -20,11 +20,19 @@ _SENSITIVE_SUBSTRINGS = (
|
||||
)
|
||||
|
||||
# Matched whole, not as substrings. OCF's /oic/d and /oic/p identify the unit
|
||||
# with bare two-letter keys -- 'di' (device UUID) and 'pi' (platform UUID) --
|
||||
# which are as identifying as the serial number above but far too short to
|
||||
# match on: 'di' alone is a substring of 'condition', 'display', 'dispenser'
|
||||
# and plenty of other perfectly ordinary appliance fields.
|
||||
_SENSITIVE_EXACT = frozenset({'di', 'pi'})
|
||||
# with bare one- and two-letter keys that the rules above cannot see, being
|
||||
# far too short to match on -- 'di' alone is a substring of 'condition',
|
||||
# 'display', 'dispenser' and plenty of other ordinary appliance fields:
|
||||
#
|
||||
# 'di' -- device UUID, 'pi' -- platform UUID. As identifying as the serial
|
||||
# number above.
|
||||
# 'n' -- /oic/d's device name. Free text the owner can set from the
|
||||
# SmartThings app, so it may well 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, and the
|
||||
# device-type signal we actually want from that resource is `rt`,
|
||||
# which is not redacted.
|
||||
_SENSITIVE_EXACT = frozenset({'di', 'pi', 'n'})
|
||||
|
||||
|
||||
def _is_sensitive_key(key: str) -> bool:
|
||||
|
||||
Reference in new issue
Block a user