Browse Source

filter "home-assistant-config-entries": also shorten the things network application ids & device euis in mqtt topics

Same privacy reasoning for the application id as in commit ae714f0346cef64143fe49b92c0a01b98dcb0024; it also appears in the topics of MQTT device subentries.

The default TTN device id contains the device's DevEUI, a hardware identifier like a MAC address. Like MAC addresses, it is truncated to its first 24 bits, which identify the manufacturer.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Fabian Peter Hammerle 1 week ago
parent
commit
875efdec83
1 changed files with 1 additions and 1 deletions
  1. 1 1
      gitconfig

+ 1 - 1
gitconfig

@@ -58,7 +58,7 @@
 	required = true
 	required = true
 
 
 [filter "home-assistant-config-entries"]
 [filter "home-assistant-config-entries"]
-	clean = "jq '(.data.entries[].data |= with_entries(if (.key | IN(\"password\", \"access_token\", \"noise_psk\", \"token\", \"webhook_id\")) and .value != null then .value = \"…\" else . end)) | (.data.entries[].unique_id |= if . != null then sub(\"^(?<p>io[.]homeassistant[.]companion[.]android-[[:xdigit:]]{2})[[:xdigit:]]{14}$\"; \"\\(.p)…\") else . end) | ((.data.entries[] | select(.data.app_id == \"io.homeassistant.companion.android\") | .data.device_id) |= if . != null then sub(\"^(?<p>[[:xdigit:]]{2})[[:xdigit:]]{14}$\"; \"\\(.p)…\") else . end) | ((.data.entries[] | select(.domain == \"samsungtv\") | .unique_id) |= if . != null then sub(\"^(?<p>[[:xdigit:]]{2})[[:xdigit:]]{6}(-[[:xdigit:]]{4}){3}-[[:xdigit:]]{12}$\"; \"\\(.p)…\") else . end) | ((.data.entries[] | select(.domain == \"telegram_bot\")) |= ((if .data.api_key != null then .data.api_key |= sub(\"^(?<p>[0-9]+:).+$\"; \"\\(.p)…\") else . end) | if .unique_id != null then .unique_id |= sub(\"^(?<p>[0-9]+:).+$\"; \"\\(.p)…\") else . end)) | ((.data.entries[] | select(.domain == \"mqtt\" and ((.data.broker // \"\") | endswith(\".thethings.network\"))) | .data.username) |= if . != null then sub(\"^(?<p>[^@]{3})[^@]+(?=@)\"; \"\\(.p)…\") else . end)' | eval \"$(git config --get filter.truncate-mac-address-to-24-bits.clean)\" | eval \"$(git config --get filter.truncate-dyness-battery-serial-numbers.clean)\""
+	clean = "jq '(.data.entries[].data |= with_entries(if (.key | IN(\"password\", \"access_token\", \"noise_psk\", \"token\", \"webhook_id\")) and .value != null then .value = \"…\" else . end)) | (.data.entries[].unique_id |= if . != null then sub(\"^(?<p>io[.]homeassistant[.]companion[.]android-[[:xdigit:]]{2})[[:xdigit:]]{14}$\"; \"\\(.p)…\") else . end) | ((.data.entries[] | select(.data.app_id == \"io.homeassistant.companion.android\") | .data.device_id) |= if . != null then sub(\"^(?<p>[[:xdigit:]]{2})[[:xdigit:]]{14}$\"; \"\\(.p)…\") else . end) | ((.data.entries[] | select(.domain == \"samsungtv\") | .unique_id) |= if . != null then sub(\"^(?<p>[[:xdigit:]]{2})[[:xdigit:]]{6}(-[[:xdigit:]]{4}){3}-[[:xdigit:]]{12}$\"; \"\\(.p)…\") else . end) | ((.data.entries[] | select(.domain == \"telegram_bot\")) |= ((if .data.api_key != null then .data.api_key |= sub(\"^(?<p>[0-9]+:).+$\"; \"\\(.p)…\") else . end) | if .unique_id != null then .unique_id |= sub(\"^(?<p>[0-9]+:).+$\"; \"\\(.p)…\") else . end)) | ((.data.entries[] | select(.domain == \"mqtt\" and ((.data.broker // \"\") | endswith(\".thethings.network\"))) | .data.username) |= if . != null then sub(\"^(?<p>[^@]{3})[^@]+(?=@)\"; \"\\(.p)…\") else . end) | ((.data.entries[] | select(.domain == \"mqtt\" and ((.data.broker // \"\") | endswith(\".thethings.network\"))) | .subentries[]?.data.components[]?) |= with_entries(if (.key | endswith(\"_topic\")) and (.value | type) == \"string\" then .value |= (sub(\"^(?<p>v3/[^@/]{3})[^@/]+(?=@)\"; \"\\(.p)…\") | sub(\"(?<p>/devices/eui-[[:xdigit:]]{6})[[:xdigit:]]{10}(?=/|$)\"; \"\\(.p)…\")) else . end))' | eval \"$(git config --get filter.truncate-mac-address-to-24-bits.clean)\" | eval \"$(git config --get filter.truncate-dyness-battery-serial-numbers.clean)\""
 	smudge = cat
 	smudge = cat
 	required = true
 	required = true