Skip to content

Commit d428363

Browse files
authored
Add IP address, label and location states to obfuscation (#2098)
## Summary Extend the obfuscation utility to redact the values of additional sensitive device states: - `core:IPAddressState` (`CORE_IP_ADDRESS`) - `core:LabelState` (`CORE_LABEL`) - `core:LocationLatitudeState` (`CORE_LOCATION_LATITUDE`) - `core:LocationLongitudeState` (`CORE_LOCATION_LONGITUDE`) These states can expose a user's IP address, device label and geographic location, so their values should be masked alongside the other sensitive states already handled by `obfuscate_sensitive_data`. ## Test plan - Added the four new state names to the `test_obfuscate_sensitive_states` parametrization. - `pytest tests/test_obfuscate.py` → 30 passed. - Full suite (`test_obfuscate.py`, `test_models.py`, `test_client.py`) → 325 passed. - `ruff` and `mypy` (source) clean.
1 parent f285891 commit d428363

2 files changed

Lines changed: 8 additions & 0 deletions

File tree

pyoverkiz/obfuscate.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,10 @@ def _obfuscate_value(key: str, value: Any, mask_next_value: bool) -> tuple[Any,
5555
"core:MacAddress",
5656
"core:SerialNumber",
5757
"core:DeviceSerialNumberState",
58+
"core:IPAddressState",
59+
"core:LabelState",
60+
"core:LocationLatitudeState",
61+
"core:LocationLongitudeState",
5862
):
5963
mask_next_value = True
6064

tests/test_obfuscate.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,10 @@ def test_obfuscate_infra_config_state(self):
123123
"core:MacAddress",
124124
"core:SerialNumber",
125125
"core:DeviceSerialNumberState",
126+
"core:IPAddressState",
127+
"core:LabelState",
128+
"core:LocationLatitudeState",
129+
"core:LocationLongitudeState",
126130
],
127131
)
128132
def test_obfuscate_sensitive_states(self, state_name: str):

0 commit comments

Comments
 (0)