BarkleyGitHub
An open spec for Home Assistant integrations, cards and apps
Markdown file

disclosure.yaml

A file where an app lists what it connects to, the credentials it handles and any pages that open without a login. Anyone can read it, and any JSON Schema validator can check it.

What the file is for

Home Assistant integrations, cards and apps can reach a lot. An integration runs inside Home Assistant itself, and a card runs on the same page as the user’s login. Users and reviewers can read the code, but working out from code which servers an app talks to, and why, takes time.

disclosure.yaml is the developer’s own account of that, in a form people can read and tools can check. Nothing in it is proven, so a tool that reads it should show it as what the developer says, compare it with what it finds in the code, and point out where the two differ. A connection listed in the file isn’t safe because it’s listed.

When the code shows something different from the file, the code wins. A tool should go by what it found and show the developer’s statement beside it. A difference isn’t a sign of bad intent. Often the developer didn’t know, and that’s exactly what the comparison is for. Where a tool can’t see something at all, such as how long a token lasts, it can show the developer’s answer as theirs, but it shouldn’t treat that answer as checked.

Where it goes

At the root of the repository, named disclosure.yaml, and changed in the same commit as the code it describes. When the repository holds more than one integration, card or app, one file covers them all, and entries can say which one they’re about with component.

Every section is optional, and the difference between leaving a section out and leaving it empty matters. A section that’s missing means “not stated”. An empty list ([]) means “none”, so telemetry: [] says the app sends no telemetry. The same goes for sends: sends: [] says the requests carry nothing beyond the request itself.

Every entry can carry a note and a component. Any key that starts with x- is allowed anywhere, for details a developer or a tool wants to try out. Every other key is checked.

YAML reads some bare words as something else: on, off, yes and no can turn into true and false. Put quotes around a value like that when you mean the word.

The fields

The file starts with version: 1, which is required. Then any of these sections, each a list of entries.

connections

Servers outside Home Assistant that the app contacts.

FieldRequiredWhat it says
sourceyesWhere the connection starts: home_assistant (Home Assistant itself) or browser (the browser showing the dashboard)
destinationdestination or destination_set_byThe server it goes to: a host name, *. plus a domain for any of its subdomains, or an IP address. A list of them is fine when everything else in the entry is the same
destination_set_bydestination or destination_set_byWho supplies the address when it isn’t written in the code: setup (the user enters it while setting the app up), setting (a setting the user can change later) or server_reply (a server’s answer says where to go next)
portnoOnly when it isn’t the usual port for the protocol
purposeyesWhy, in a sentence
run_bynoWho runs the server: developer (the app’s developer), vendor (the company or public body whose device or service the app is for), third_party (anyone else, such as a map tile service) or user (the user’s own device or server)
run_by_namenoTheir name, such as a company or a town
networknoWhere the server is: home (the user’s home network), internet, or either, depending on the user’s setup
encryptednoalways, never, or setting when a setting decides
encryption_settingwhen encrypted is settingThe setting that turns encryption on
whenyesalways, setting (only when a setting turns it on) or user_action (only when a person does something, such as opening a popup)
settingwhen when or destination_set_by is settingThe setting’s name, as users see it or write it
conditionnoThe exact condition in words, when it’s more than one setting
on_by_defaultnotrue when the setting that turns it on is on out of the box
sendsnoWhat the requests carry, from the list below

sends can list:

ValueMeans
ip_addressThe user’s IP address. Every request carries it, so list it when it matters to the service, such as a map or weather service that also gets map_area or physical_location
physical_locationCoordinates or a street address: the home’s, a person’s or a device’s
map_areaThe part of a map being viewed
entity_statesStates or attributes of Home Assistant entities
credentialsA password, token or key the user gave
device_idsSerial numbers, MAC addresses or account ids of devices
ha_addressThe address of the user’s Home Assistant, for example in a Referer header
mediaCamera images, audio or video
personal_detailsA name, email address or phone number
versionsThe app’s or Home Assistant’s version

Sites the app only links to. They open when a person selects the link. Each entry has a host or a url, and can have a purpose.

pages

Pages and endpoints the app adds that answer without a Home Assistant login.

FieldRequiredWhat it says
pathyesThe path, starting with /
protectionyesWhat stands in for the login: none (nothing, so anyone who can reach Home Assistant gets an answer), own_token (the app checks a token of its own), signed_link (a link Home Assistant signed) or webhook (a Home Assistant webhook id)
local_onlynotrue when it only answers on the local network
purposeyesWhy it opens without a login
checksnoWhat the app checks itself before it answers

credentials

Passwords, tokens and keys the app asks the user for.

FieldRequiredWhat it says
whatyesWhat it is, such as “the Petal Garden account password”
asked_inyesconfig_flow, options_flow, yaml, card_config or environment
stored_innoconfig_entry, secrets_yaml, card_config or own_storage
sent_toyesThe hosts it goes to. setup_address means the address the user entered at setup

login_tokens

Home Assistant login tokens the app creates, reads or hands on. Tokens the user pastes in for another service go under credentials.

FieldRequiredWhat it says
kindyeslong_lived, refresh (it can make new access tokens), access (short-lived) or dashboard_session (the token of the person using the dashboard, which a card can read in the browser)
admin_usernotrue when the token belongs to an administrator
lifetimenoHow long it lasts, such as 30 minutes or 365 days
given_tonoWhere it goes outside Home Assistant: hosts, or setup_address. An empty list says it stays in Home Assistant, or in the browser for a dashboard_session
purposeyesWhy the app needs it

home_assistant_access

Parts of Home Assistant the app uses beyond its own entities and settings. Each entry has uses and a purpose.

usesMeans
secrets_fileReads secrets.yaml
other_apps_settingsReads other integrations’ options
other_apps_credentialsReads other integrations’ stored passwords, tokens or keys
user_listReads the list of users
change_usersAdds, changes or removes users
login_storeReads Home Assistant’s login store
storage_filesReads or writes files in .storage directly
supervisor_apiCalls the Supervisor API
location_historyReads location history for many entities at once
patches_home_assistantReplaces or wraps Home Assistant’s own code while it runs
actionsRuns actions on entities that aren’t its own, or actions that change Home Assistant itself. List them in actions, such as [lock.unlock, homeassistant.restart]

embedded_keys

Keys, tokens and certificates written into the code the app ships.

FieldRequiredWhat it says
fileyesThe file it’s in
kindyesvendor_client_key, vendor_certificate, public_key, test_value or service_key (a key for a service the developer runs)
same_for_every_useryestrue or false

telemetry

Usage statistics, analytics and crash reports.

FieldRequiredWhat it says
destinationyesWhere it goes, one host or a list
typeyesusage_stats, analytics or crash_reports
contentsyesWhat’s in a report, and how often it’s sent
on_by_defaultyestrue when it’s on out of the box
settingnoThe setting that turns it on or off
run_by, run_by_namenoWho runs the server, as in connections
sendsnoFrom the same list as connections

encoded_content

Large base64, hex or compressed content in the code. Each entry has the file and a kind: image, font, key, lookup_table, data or code.

compiled_code

Compiled files the app ships, such as native modules or Python bytecode.

FieldRequiredWhat it says
fileyesThe compiled file
built_byyesci (a public build workflow made it) or developer (built on the developer’s own machine)
built_fromnoA link to its source code

runtime_downloads

Code the app downloads and runs while it runs.

FieldRequiredWhat it says
whatyesWhat it is
kindyespython_package, javascript, script, lua or binary
destination or destination_set_byone of themWhere it comes from: a host or URL, or who supplies the address, as in connections
settingwhen destination_set_by is settingThe setting’s name
pinnedyestrue when the app asks for one exact version or checks a checksum

generated_files

Files the app writes outside its own storage, such as a card it copies into www/. Each entry has the path.

An example file

A made-up integration that also ships a map card. Its hosts use the reserved .example domain.

sample.yamlDownload
# disclosure.yaml for Petal Garden, a made-up integration with a map card.
# Spec: https://ha-barkley.github.io/disclosure/
# Checked against a copy of the schema in .github/disclosure.schema.json
version: 1

connections:
  - destination: api.petalgarden.example
    source: home_assistant
    purpose: Reads soil moisture and sets watering schedules.
    run_by: vendor
    run_by_name: Petal Garden
    network: internet
    encrypted: always
    when: always
    sends: [credentials, device_ids, entity_states]
  - destination_set_by: setup
    source: home_assistant
    purpose: The Petal Garden hub on the local network.
    run_by: user
    network: home
    encrypted: never
    when: always
    sends: [credentials]
    note: The hub only speaks plain HTTP. The password is the hub's own, not the account's.
  - destination: "*.tile.openmaps.example"
    source: browser
    purpose: Map tiles for the garden map card.
    run_by: third_party
    run_by_name: OpenMaps
    network: internet
    encrypted: always
    when: setting
    setting: map_style
    condition: "map_style: Streets or Terrain"
    on_by_default: true
    sends: [ip_address, map_area, ha_address]
  - destination_set_by: setting
    setting: custom_tile_url
    source: browser
    purpose: Your own map tiles.
    run_by: user
    network: either
    when: setting
    condition: "map_style: Custom"
    sends: [ip_address, map_area, ha_address]
  - destination:
      - weather.petalgarden.example
      - weather-eu.petalgarden.example
    source: home_assistant
    purpose: Rain forecast, so watering can be skipped before rain.
    run_by: vendor
    run_by_name: Petal Garden
    network: internet
    encrypted: always
    when: setting
    setting: Skip watering when rain is due
    on_by_default: false
    sends: [physical_location]

links:
  - url: https://petalgarden.example/support
    purpose: Help link in the setup dialog.
  - host: openmaps.example
    purpose: Map credits.

pages:
  - path: /api/petal_garden/zones
    protection: own_token
    local_only: true
    purpose: Lets the Petal phone app list and water zones.
    checks: The hub's token in the X-Petal-Token header.
  - path: /api/webhook/
    protection: webhook
    purpose: The cloud reports a finished watering run.

credentials:
  - what: Petal Garden account password
    asked_in: config_flow
    stored_in: config_entry
    sent_to: [api.petalgarden.example]
  - what: Hub password
    asked_in: config_flow
    stored_in: config_entry
    sent_to: [setup_address]

login_tokens:
  - kind: dashboard_session
    given_to: []
    purpose: The map card reads zone states over Home Assistant's own websocket.

home_assistant_access: []

embedded_keys:
  - file: custom_components/petal_garden/const.py
    kind: vendor_client_key
    same_for_every_user: true
    note: The Petal Garden phone app's own client id.

telemetry:
  - destination: stats.petalgarden.example
    type: usage_stats
    contents: Its version and the number of zones, once a day.
    on_by_default: false
    setting: Share anonymous usage
    run_by: developer
    sends: [ip_address, versions]

encoded_content:
  - file: custom_components/petal_garden/icons.py
    kind: image
    note: Base64 PNG icons for the zone types.

compiled_code: []

runtime_downloads: []

generated_files:
  - path: www/community/petal-garden/garden-map.js
    note: The map card, copied here at setup for the dashboard.

Checking a file

Copy the schema into your repository, for example as .github/disclosure.schema.json, and check the file against that copy. That way your build doesn’t depend on this site. Any validator that supports JSON Schema draft 2020-12 works, for example:

check-jsonschema --schemafile .github/disclosure.schema.json disclosure.yaml

Editors that use the YAML language server, such as Visual Studio Code with its YAML extension, check the file as you type when its first line points at your copy:

# yaml-language-server: $schema=.github/disclosure.schema.json

You can point at the published schema directly instead. Its address and its contents never change, but your build then depends on this site being up.

The SHA-256 of version 1’s schema is 51c035784a6592333a1b2b911aa76aca6f6bf0c6b4cf91e44a7d33944b294cc3 . A copy with the same hash is the published version.

Changes between versions

Version 1 is fixed. Once it’s published, neither its schema nor the rules on this page change, so a file that’s valid today stays valid. New sections, fields or values go into version 2, with its own schema at /disclosure/v2/schema.json and version: 2 in the file.

This spec, its schema and the example file are dedicated to the public domain under CC0 1.0. Anyone can copy, change and use them for any purpose, without asking and without credit.