Your ticks and choices are saved in this browser only.
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.
Controls
DEP-1Level 1Use what Home Assistant already ships first.
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-2Level 1Check a package before you add it.
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).
Look for a release in the last year, more than one maintainer, a linked source repository, and the exact spelling of the name.
DEP-3Level 1Pin exact versions.
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, Shai-Hulud).Use
==inmanifest.json, and commit the lockfile for a card. Dependabot proposes updates for a card's lockfile. Formanifest.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-4Level 1Wait at least 7 days before taking a new release.
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).
Set
cooldown: default-days: 7independabot.yml(Dependabot waits 3 days if you set nothing), or"minimumReleaseAge": "7 days"in Renovate. Security updates aren't delayed.DEP-5Level 1Check for known vulnerabilities in CI.
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).
DEP-6Level 2Replace dead packages.
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.
Attacks on npm, PyPI and GitHub Actions
How six attacks on npm, PyPI and GitHub Actions worked, and which controls would have stopped them.
None of these attacks happened in the Home Assistant Marketplace, and the 2026 sweep found no malware there. The projects here were the victims, and several of them published detailed reports afterwards. Every fact on this page comes from those reports, the registry, GitHub or CISA, linked under each attack.
Phished logins on PyPI and npm, 2025
In July 2025, PyPI found a phishing campaign that sent package maintainers to pypj.org, a lookalike of pypi.org. Four accounts were phished. With one of them, the attacker created API tokens and uploaded two releases of num2words, 0.5.15 and 0.5.16, with malware in them. PyPI removed the releases and revoked the tokens. PyPI's report says the fake site worked as a proxy, so it could capture authenticator-app codes and session cookies as well as passwords. It recommends WebAuthn, meaning a passkey or a security key.
On September 8, 2025, the maintainer of debug, chalk and 16 other npm packages got a 2FA reset email from npmjs.help, which the maintainer later called "shockingly authentic". The npm account was taken over, and new versions such as debug 4.4.2 and chalk 5.6.1 were published with code that redirected cryptocurrency transactions in the browser to the attacker's addresses. npm removed them over the course of the day.
A lookalike site collects the password and the 2FA code.
ACC-1 A passkey or security key only signs in to the site it was made for, so it gives a lookalike nothing to pass on.
The attacker publishes new versions from the maintainer's account.
No control in the repository can stop a publish from the maintainer's own account. This step can only be prevented by ACC-1, in the step before.
Projects that use the package pick up the new version.
DEP-4 npm's versions were gone the same day, so with a 7-day cooldown Dependabot would never have offered them. DEP-3 With exact versions pinned, a new release only reaches your users through a pull request you merge.
Sources: PyPI's incident report, GitHub advisory GHSA-4x49-vf9v-38px, the maintainer's comment.
Shai-Hulud, a worm on npm, 2025
In September 2025, CISA warned of a self-replicating worm that had compromised more than 500 npm packages. Its install script collected GitHub personal access tokens and cloud keys for AWS, Google Cloud and Azure, sent them to the attacker and uploaded them to a public repository named Shai-Hulud. It then signed in to npm as the developer and published infected versions of their other packages, which spread it further. GitHub removed the packages. A second version, which GitHub described in December 2025, also registered infected machines as self-hosted runners and had what GitHub called "destructive functionality".
On December 9, 2025, npm revoked every classic token, limited write tokens to 90 days and made 2FA mandatory for publishing.
An infected version arrives through a dependency update.
DEP-4 A cooldown keeps it out while it's new. DEP-3 Exact pins mean it only arrives in a pull request.
Its install script collects every token it can find, on a laptop or in CI.
ACC-2 A fine-grained token only reaches the repositories and permissions it was given, and it expires. CI-7 A read-only workflow token can't push code or publish anything. SEC-4 With trusted publishing, CI holds no publishing token for the script to find.
It publishes as the developer and keeps whatever access it was given.
ACC-3 CISA's advice included removing the GitHub Apps and OAuth apps you don't need. It also recommended branch protection (BR-1), secret scanning (CI-3) and Dependabot security updates (CI-2).
Sources: CISA's alert, GitHub, September 2025, GitHub, December 2025, npm's token changes.
tj-actions/changed-files, a GitHub Action, March 2025
tj-actions/changed-files was used by over 23,000 repositories. In March 2025, several of its version tags were changed to point to a malicious commit. Workflows that used those tags ran code that read secrets from the runner's memory and printed them in the workflow log, where anyone could read them in a public repository. CISA says an earlier compromise of another action, reviewdog/action-setup, may have made it possible.
Someone with access moves the action's published tags to a new commit.
BR-4 REL-3 For anyone who publishes an action, a tag ruleset or immutable releases stop a published tag from moving.
Every workflow that names the action by tag runs the new code on its next run.
CI-10 A workflow pinned to a commit SHA keeps running the commit it was pinned to.
The code reads the secrets in the job.
CI-7 REL-2 If the job only has a read-only token and no publishing secrets, that's all the code can read.
Sources: GitHub advisory GHSA-mrrh-fwg8-r2c3 (CVE-2025-30066), CISA's alert.
Ultralytics, Nx and TanStack, 2024 to 2026
In December 2024, malicious releases of the Python package ultralytics (8.3.41 and 8.3.42) came out of the project's own release workflow, after an attacker got into its GitHub Actions workflows and poisoned the Actions cache used in the build. Two more (8.3.45 and 8.3.46) were uploaded with a PyPI API token that the workflow could still reach, left over from before the project moved to Trusted Publishing. PyPI's advice was to avoid pull_request_target and shared caches, use Trusted Publishing, and revoke tokens you don't use.
In August 2025, a workflow in the Nx project that checked pull request titles ran on pull_request_target and put the title straight into a shell command. A pull request with a crafted title ran commands with a read and write GitHub token. With it, the attacker pushed a branch that changed a script, started the publish workflow and took its npm token. Malicious versions were live for 4 hours on August 26. Their install script searched the machine for secrets, tried to use local AI tools such as Claude and Gemini, and uploaded what it found to a public GitHub repository.
In May 2026, a TanStack workflow that measured bundle size ran on pull_request_target and built the pull request's code. That code saved a poisoned package store into the Actions cache, under the key the release workflow restores on every push to main. When the release workflow next ran, the malware read its short-lived publishing token from the runner's memory and published 84 versions of 42 packages to npm through trusted publishing. "No npm tokens were stolen," TanStack's postmortem says. An outside researcher reported it 26 minutes after the first publish, and npm had removed all of them within about four and a half hours.
A workflow runs a stranger's pull request with the repository's own access.
CI-9 Never run a pull request's code in a
pull_request_targetworkflow. CI-8 Keep text like a pull request's title out ofrun:lines.The pull request's code reaches the release, through a token, a script or a shared cache.
CI-7 With a read-only default token, Nx's title-check workflow would have had nothing to push a branch with. REL-2 A release environment keeps publishing secrets away from other workflows.
The release goes out with the project's own credentials.
SEC-4 Trusted publishing leaves no token to steal. Ultralytics' second pair of releases used a token left over from before the move. It can't help once untrusted code runs inside the release job, which is what happened at TanStack. DEP-4 For projects that use these packages, a 7-day cooldown would have kept out Nx's and TanStack's versions, which were gone within hours.
Sources: PyPI's analysis of the Ultralytics attack, Nx's postmortem, TanStack's postmortem.
xz-utils, 2024
The release tarballs of xz-utils 5.6.0 and 5.6.1 contained a backdoor (CVE-2024-3094). The project's original maintainer wrote that they were created and signed by Jia Tan, and that the backdoor's files in the repository were harmless without the trigger code, which "was never included in the Git repository". So reading the repository wouldn't have shown the backdoor, because only the release files had all of it.
A release file is made by hand, outside CI.
REL-1 When a workflow builds the release from main and attests it, the release is the code in the repository, and anyone can check that with
gh attestation verify.Reviewers read the repository, and users install the release.
The 2026 sweep found 84 Marketplace apps whose release code differs from their repository.
Sources: CVE-2024-3094, the maintainer's page on the backdoor.
event-stream, 2018
npm's report says an attacker, "posing as a maintainer", took over maintainership of the event-stream package, and on September 9, 2018, added a new dependency, flatmap-stream, in version 3.3.6. Its code was written for one app, the Copay bitcoin wallet, and harvested account details and private keys from wallets holding more than 100 bitcoin or 1,000 bitcoin cash. Copay shipped it in versions 5.0.2 to 5.1.0. npm's security team heard about it on November 26, more than two months later.
A package changes hands.
DEP-2 Check who maintains a package before you add it. DEP-6 Replace packages nobody looks after. ACC-6 For your own project, plan who takes over if you step away.
A new dependency arrives in an update.
DEP-3 With exact pins, it only arrives in a pull request, where the new dependency is in the diff.
Source: npm's report.
# 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.