# Dependencies

Every package you add runs with the same access as your own code, and its maintainers can ship a new version at any time.

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

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.** Marketplace apps install 1,827 distinct packages, and 1,416 of them are used by only one app. 128 apps use a run-time library version with a known vulnerability. The [Marketplace report](https://ha-barkley.github.io/marketplace/2026/malware-and-ways-in/) has more on this.

## Controls

### DEP-1: Use what Home Assistant already ships first

*Level 1 · Applies to integrations*

**Why:** Each package you add is code from more people you have to trust, and one more account that can be taken over. Home Assistant already ships and updates the common ones, so using them doesn't add anyone new for your users to trust.

aiohttp, voluptuous and many device libraries are already installed. Don't list those in `requirements`. Home Assistant's own version wins, and a different pin can stop your integration from installing.

### DEP-2: Check a package before you add it

*Level 1*

**Why:** Some packages are published under a name one letter away from a popular one, so that a typo installs them. Others change hands without anyone noticing. In 2018, someone posing as a maintainer took over event-stream and added code aimed at one bitcoin wallet app ([how it happened](https://ha-barkley.github.io/security/attacks/#event-stream)).

Look for a release in the last year, more than one maintainer, a linked source repository, and the exact spelling of the name.

### DEP-3: Pin exact versions

*Level 1*

**Why:** With a range such as `>=2.0`, every new install takes whatever was published last, including a version published from a stolen account an hour ago. With an exact pin, a new version only reaches your users after you merge a pull request for it ([phished logins](https://ha-barkley.github.io/security/attacks/#phishing), [Shai-Hulud](https://ha-barkley.github.io/security/attacks/#shai-hulud)).

Use `==` in `manifest.json`, and commit the lockfile for a card. Dependabot proposes updates for a card's lockfile. For `manifest.json`, Renovate can do it with a custom manager, or pip-audit in CI tells you when a pinned version has a known vulnerability.

### DEP-4: Wait at least 7 days before taking a new release

*Level 1*

**Why:** Malicious versions are usually found and removed fast. npm removed the September 2025 phishing versions the same day, and TanStack's within about four and a half hours. With a 7-day cooldown, Dependabot only offers a release once it has been public for a week, so versions like these have been removed before it offers them ([how it happened](https://ha-barkley.github.io/security/attacks/#phishing)).

Set `cooldown: default-days: 7` in `dependabot.yml` (Dependabot waits 3 days if you set nothing), or `"minimumReleaseAge": "7 days"` in Renovate. Security updates aren't delayed.

### DEP-5: Check for known vulnerabilities in CI

*Level 1*

**Why:** Most vulnerable code in an app is an old version of a library that already has a fix. A check in CI tells you when a package you use gets an advisory, before a user reports it.

Use pip-audit or npm audit (see [Checks in CI](https://ha-barkley.github.io/security/controls/ci/)).

### DEP-6: Replace dead packages

*Level 2*

**Why:** A package nobody maintains gets no security fixes, and nobody is watching when it changes hands.

If a library hasn't had a release in years and has open security reports, switch to a maintained one or take over a fork in the open.

### Check it worked

pip-audit or npm audit passes on main, and you merge Dependabot's pull requests as they come in.

Barkley checks each library version against known vulnerabilities, notes libraries with newer releases, and flags lookalike package names.
