BarkleyGitHub
Controls · CARD
Markdown file

Dashboard cards

A card runs on the same page as the user’s Home Assistant login. Anything the card loads can read the login token and use it.

From the 2026 sweep30 cards load code from another site whose version is decided while the card runs, so whoever publishes that code decides what runs in the dashboard. 94 cards (7.8%) build with a tool that has a known vulnerability. The Marketplace report has more on this.

These steps apply only if you publish a dashboard card.

Controls

  1. CARD-1Level 1Bundle your libraries into the card at build time instead of loading them from a CDN when the card runs.

    Do bundled at build time
    import { formatDistance } from "date-fns";
    Don't loaded at run time
    const lib = await import(
      "https://cdn.example.com/lib@latest/index.js"
    );
  2. CARD-2Level 1Keep the login token where it is. Talk to Home Assistant through the card's own connection. For an outside service, put the call in an integration and have the card ask the integration.

    Do the card's own connection
    const states = await this.hass.callWS({
      type: "get_states",
    });
    Don't send the token anywhere
    fetch(url, { headers: {
      Authorization: `Bearer ${this.hass.auth.data.access_token}`,
    }});
  3. CARD-3Level 1Render with Lit templates, not innerHTML. Entity names and attributes come from devices and other apps. Lit escapes them. innerHTML turns them into live HTML, and an attribute such as onerror can run script with the user's login.

  4. CARD-4Level 2Keep build tools current, commit the lockfile, and build with npm ci. Dependabot's npm updates cover development packages too.

Check it worked

Open the dashboard with your browser's developer tools on the Network tab. The card shouldn't fetch any script from another site, and no request should carry your token outside Home Assistant.

Barkley flags cards that load code from another site, send the login token outside Home Assistant, or build with a vulnerable tool.

Open the full page