Parcourir la source

filter "home-assistant-config-entries": also shorten the things network application ids

This is for privacy, not security: the application id is not a credential (that is the API key in the password, which is already removed). If the repository gets leaked, the id should not reveal which TTN application it belongs to.

This is probably overly pedantic, but it also has historic reasons: previous repositories kept TTN application ids fully encrypted instead of committing them in plain text.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Fabian Peter Hammerle il y a 1 semaine
Parent
commit
ae714f0346
1 fichiers modifiés avec 1 ajouts et 1 suppressions
  1. 1 1
      gitconfig

+ 1 - 1
gitconfig

@@ -58,7 +58,7 @@
 	required = true
 
 [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))' | 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)' | 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
 	required = true