# 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.

Source: https://ha-barkley.github.io/security/controls/cards/

From HASC, the Home Assistant Security Controls for integrations, cards and apps. A community catalog, not an official Home Assistant or Open Home Foundation project.

Each control has an ID, cited as HASC-CI-4, and a level from 1 to 3. "Level marker" means anyone can check the control from outside the project, and levels are graded on those controls only.

> **From the 2026 sweep.** 30 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](https://ha-barkley.github.io/marketplace/2026/malware-and-ways-in/) has more on this.

These steps apply only if you publish a dashboard card.

## Controls

### CARD-1: Bundle your libraries into the card

*Level 1 · Applies to cards*

**Bundle 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"
);
```

### CARD-2: Keep the login token where it is

*Level 1 · Applies to cards*

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}`,
}});
```

### CARD-3: Render with Lit templates, not innerHTML

*Level 1 · Applies to cards*

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.

### CARD-4: Keep build tools current

*Level 2 · Applies to cards*

**Keep 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.
