Your ticks and choices are saved in this browser only.
Checks in CI
GitHub runs most of these for free on public repositories. Some are a switch in Settings; the rest are a short workflow file.
Controls
CI-1Level 1 (or a security workflow)Level markerTurn on CodeQL default setup. Settings → Advanced Security → Code scanning → CodeQL analysis → Set up → Default. It picks up Python, JavaScript and TypeScript, and runs on every pull request. Check that GitHub Actions is in its list of languages too, because that's the language that scans your workflow files, and default setup doesn't always include it. If it's missing, choose View CodeQL configuration, then Edit, select GitHub Actions under Languages, and choose Save changes.
CI-2Level 1Level markerTurn on Dependabot alerts and security updates in the same Settings page, then add version updates for your package files and your workflow actions.
.github/dependabot.ymlversion: 2 updates: - package-ecosystem: "pip" directory: "/" schedule: interval: "weekly" cooldown: default-days: 7 - package-ecosystem: "npm" # cards: package.json and its lockfile directory: "/" schedule: interval: "weekly" cooldown: default-days: 7 - package-ecosystem: "github-actions" directory: "/" schedule: interval: "weekly" cooldown: default-days: 7Dependabot doesn't read an integration's
manifest.json. The workflow below checks those requirements with pip-audit instead.cooldownmakes Dependabot wait until a release is 7 days old before proposing it. It only delays version updates; security updates still arrive straight away.CI-3Level 1Turn on secret scanning and push protection. Settings → Advanced Security. Push protection stops a push that contains a known token format before it reaches GitHub.
CI-4Level 1 (or CodeQL)Level markerAdd a security workflow that runs on pull requests and on main. This one is for an integration; for a card, swap pip-audit for
npm audit --omit=dev..github/workflows/security.yamlname: Security on: pull_request: push: branches: [main] permissions: contents: read jobs: dependency-review: if: github.event_name == 'pull_request' runs-on: ubuntu-latest steps: - uses: actions/checkout@v7 - uses: actions/dependency-review-action@v5 with: fail-on-severity: moderate pip-audit: runs-on: ubuntu-latest steps: - uses: actions/checkout@v7 - uses: actions/setup-python@v7 with: python-version: "3.13" - run: pip install pip-audit==2.10.1 - name: Check the integration's requirements run: | jq -r '.requirements // [] | .[]' custom_components/your_domain/manifest.json > requirements.txt if [ -s requirements.txt ]; then pip-audit -r requirements.txt; fi ruff-security: runs-on: ubuntu-latest steps: - uses: actions/checkout@v7 - uses: astral-sh/ruff-action@v4.1.0 with: args: check --select Sruff-action has no
v4tag, only exact versions such asv4.1.0, so it's pinned to one here.pip-audit sometimes reports a vulnerability that has no fixed version yet, so there's nothing to upgrade to and the job keeps failing. Check whether it affects how your integration uses the library. If it doesn't, skip that one finding with
--ignore-vuln IDand a comment saying why. An unpinned requirement resolves to its newest version on every run, so the result can change without a commit. Dependencies covers pinning.CI-5Level 1Validate against Home Assistant's own rules with hassfest and the Marketplace's validation action.
.github/workflows/validate.yamlname: Validate on: pull_request: push: branches: [main] permissions: contents: read jobs: hassfest: runs-on: ubuntu-latest steps: - uses: actions/checkout@v7 - uses: home-assistant/actions/hassfest@master marketplace: runs-on: ubuntu-latest steps: - uses: hacs/action@main with: category: integrationFor a card, leave out the hassfest job, which only checks integrations, and set
category: plugin, the Marketplace's name for dashboard cards.CI-6Level 1 · optionalOptional: catch problems before you commit. pre-commit hooks run on your machine, so they're a convenience and can be skipped. Keep the CI checks too.
.pre-commit-config.yamlrepos: - repo: https://github.com/astral-sh/ruff-pre-commit rev: v0.17.6 # use the newest release hooks: - id: ruff-check args: [--extend-select, S] - repo: https://github.com/gitleaks/gitleaks rev: v8.30.1 hooks: - id: gitleaks
Keep the workflows and their tokens safe
Every workflow run gets a token that can act on your repository, and every action and script in the run can use it. These steps keep that token weak and keep strangers' text from running as code.
CI-7Level 1Give workflows read-only tokens. Set
permissions: contents: readat the top of every workflow and widen it only in the job that needs more. Then make read-only the default under Settings → Actions → General → Workflow permissions, and untick Allow GitHub Actions to create and approve pull requests. Repositories created since 2023 start read-only, but older ones may still give every workflow write access.CI-8Level 1Keep untrusted text out of
run:lines. An issue title, a pull request title or a branch name is chosen by whoever opens it. Written straight into arun:line with${{ }}, it runs as a shell command with your token. Pass it throughenv:instead, so the shell treats it as text.Do pass it as a variable- name: Log the new issue env: TITLE: ${{ github.event.issue.title }} run: echo "New issue: $TITLE"Don't write it into the command- name: Log the new issue run: echo "New issue: ${{ github.event.issue.title }}"CI-9Level 1Never run a pull request's code in a
pull_request_targetworkflow. That trigger runs with your secrets and a token that can write, so checking out the pull request's code hands both to whoever opened it. Usepull_requestfor anything that builds or tests contributed code.actions/checkoutv7 refuses this by default.CI-10Level 2Pin actions to a full commit SHA. A tag like
@v7can be moved to different code by whoever controls the action, and your next run uses it with your token. The examples here use version tags and branch names so they're easier to read. Dependabot keeps pinned SHAs current when an action publishes new releases.Some Home Assistant actions are updated on a branch instead.
hacs/actionhasn't tagged a release since 2022, and hassfest only started tagging in November 2026. Pin these to a commit SHA from their default branch, not to the old release, and check them for new commits every month or so.CI-11Level 2Don't leave the token behind after checkout.
actions/checkoutsaves the token so latergitcommands work, which also hands it to every later step. Turn that off unless a later step pushes..github/workflows/security.yaml (part)- uses: actions/checkout@v7 with: persist-credentials: falseCI-12Level 2Use a GitHub App token instead of a personal access token. When the built-in token can't do something, such as triggering another workflow, create a GitHub App with only the permissions it needs and install it on the repositories that need it.
actions/create-github-app-tokenturns it into a token that expires after an hour. The app's private key is still a stored secret, but each token reaches only what you picked, and nothing is tied to your own account.CI-13Level 2Check your workflows with zizmor. It finds the problems above, such as untrusted text in
run:lines, broad tokens, unpinned actions and credentials left behind. Runuvx zizmor .github/workflows/before you push, or add it to your security workflow.
Check it worked
Open a pull request that pins an old library with a known vulnerability in manifest.json. pip-audit should fail. For a card, add it to package.json instead, and dependency review and npm audit should both fail. CodeQL's check should run on the pull request.
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.
# Checks in CI GitHub runs most of these for free on public repositories. Some are a switch in Settings; the rest are a short workflow file. Source: https://ha-barkley.github.io/security/controls/ci/ 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.** 909 of 6,753 apps (13.5%) run a security scanner, and 1,602 (23.7%) use Dependabot or Renovate to keep libraries current. 824 apps (12%) use a library version with a newer release out. The [Marketplace report](https://ha-barkley.github.io/marketplace/2026/security-basics/) has more on this. ## Controls ### CI-1: Turn on CodeQL default setup *Level 1 (or a security workflow) · Level marker* Settings → Advanced Security → Code scanning → CodeQL analysis → Set up → Default. It picks up Python, JavaScript and TypeScript, and runs on every pull request. Check that GitHub Actions is in its list of languages too, because that's the language that scans your workflow files, and default setup doesn't always include it. If it's missing, choose View CodeQL configuration, then Edit, select GitHub Actions under Languages, and choose Save changes. ### CI-2: Turn on Dependabot alerts and security updates *Level 1 · Level marker* **Turn on Dependabot alerts and security updates** in the same Settings page, then add version updates for your package files and your workflow actions. `.github/dependabot.yml` ``` version: 2 updates: - package-ecosystem: "pip" directory: "/" schedule: interval: "weekly" cooldown: default-days: 7 - package-ecosystem: "npm" # cards: package.json and its lockfile directory: "/" schedule: interval: "weekly" cooldown: default-days: 7 - package-ecosystem: "github-actions" directory: "/" schedule: interval: "weekly" cooldown: default-days: 7 ``` Dependabot doesn't read an integration's `manifest.json`. The workflow below checks those requirements with pip-audit instead. `cooldown` makes Dependabot wait until a release is 7 days old before proposing it. It only delays version updates; security updates still arrive straight away. ### CI-3: Turn on secret scanning and push protection *Level 1* Settings → Advanced Security. Push protection stops a push that contains a known token format before it reaches GitHub. ### CI-4: Add a security workflow *Level 1 (or CodeQL) · Level marker* **Add a security workflow** that runs on pull requests and on main. This one is for an integration; for a card, swap pip-audit for `npm audit --omit=dev`. `.github/workflows/security.yaml` ``` name: Security on: pull_request: push: branches: [main] permissions: contents: read jobs: dependency-review: if: github.event_name == 'pull_request' runs-on: ubuntu-latest steps: - uses: actions/checkout@v7 - uses: actions/dependency-review-action@v5 with: fail-on-severity: moderate pip-audit: runs-on: ubuntu-latest steps: - uses: actions/checkout@v7 - uses: actions/setup-python@v7 with: python-version: "3.13" - run: pip install pip-audit==2.10.1 - name: Check the integration's requirements run: | jq -r '.requirements // [] | .[]' custom_components/your_domain/manifest.json > requirements.txt if [ -s requirements.txt ]; then pip-audit -r requirements.txt; fi ruff-security: runs-on: ubuntu-latest steps: - uses: actions/checkout@v7 - uses: astral-sh/ruff-action@v4.1.0 with: args: check --select S ``` ruff-action has no `v4` tag, only exact versions such as `v4.1.0`, so it's pinned to one here. pip-audit sometimes reports a vulnerability that has no fixed version yet, so there's nothing to upgrade to and the job keeps failing. Check whether it affects how your integration uses the library. If it doesn't, skip that one finding with `--ignore-vuln ID` and a comment saying why. An unpinned requirement resolves to its newest version on every run, so the result can change without a commit. [Dependencies](https://ha-barkley.github.io/security/controls/dependencies/) covers pinning. ### CI-5: Validate against Home Assistant's own rules *Level 1 · Applies to integrations and cards* **Validate against Home Assistant's own rules** with hassfest and the Marketplace's validation action. `.github/workflows/validate.yaml` ``` name: Validate on: pull_request: push: branches: [main] permissions: contents: read jobs: hassfest: runs-on: ubuntu-latest steps: - uses: actions/checkout@v7 - uses: home-assistant/actions/hassfest@master marketplace: runs-on: ubuntu-latest steps: - uses: hacs/action@main with: category: integration ``` For a card, leave out the hassfest job, which only checks integrations, and set `category: plugin`, the Marketplace's name for dashboard cards. ### CI-6: Optional: catch problems before you commit *Level 1 · optional* pre-commit hooks run on your machine, so they're a convenience and can be skipped. Keep the CI checks too. `.pre-commit-config.yaml` ``` repos: - repo: https://github.com/astral-sh/ruff-pre-commit rev: v0.17.6 # use the newest release hooks: - id: ruff-check args: [--extend-select, S] - repo: https://github.com/gitleaks/gitleaks rev: v8.30.1 hooks: - id: gitleaks ``` ## Keep the workflows and their tokens safe Every workflow run gets a token that can act on your repository, and every action and script in the run can use it. These steps keep that token weak and keep strangers' text from running as code. ### CI-7: Give workflows read-only tokens *Level 1* Set `permissions: contents: read` at the top of every workflow and widen it only in the job that needs more. Then make read-only the default under Settings → Actions → General → Workflow permissions, and untick *Allow GitHub Actions to create and approve pull requests*. Repositories created since 2023 start read-only, but older ones may still give every workflow write access. ### CI-8: Keep untrusted text out of `run:` lines *Level 1* An issue title, a pull request title or a branch name is chosen by whoever opens it. Written straight into a `run:` line with `${{ }}`, it runs as a shell command with your token. Pass it through `env:` instead, so the shell treats it as text. `Do pass it as a variable` ``` - name: Log the new issue env: TITLE: ${{ github.event.issue.title }} run: echo "New issue: $TITLE" ``` `Don't write it into the command` ``` - name: Log the new issue run: echo "New issue: ${{ github.event.issue.title }}" ``` ### CI-9: Never run a pull request's code in a `pull_request_target` workflow *Level 1* That trigger runs with your secrets and a token that can write, so checking out the pull request's code hands both to whoever opened it. Use `pull_request` for anything that builds or tests contributed code. `actions/checkout` v7 refuses this by default. ### CI-10: Pin actions to a full commit SHA *Level 2* A tag like `@v7` can be moved to different code by whoever controls the action, and your next run uses it with your token. The examples here use version tags and branch names so they're easier to read. Dependabot keeps pinned SHAs current when an action publishes new releases. Some Home Assistant actions are updated on a branch instead. `hacs/action` hasn't tagged a release since 2022, and hassfest only started tagging in November 2026. Pin these to a commit SHA from their default branch, not to the old release, and check them for new commits every month or so. ### CI-11: Don't leave the token behind after checkout *Level 2* `actions/checkout` saves the token so later `git` commands work, which also hands it to every later step. Turn that off unless a later step pushes. `.github/workflows/security.yaml (part)` ``` - uses: actions/checkout@v7 with: persist-credentials: false ``` ### CI-12: Use a GitHub App token instead of a personal access token *Level 2* When the built-in token can't do something, such as triggering another workflow, create a GitHub App with only the permissions it needs and install it on the repositories that need it. `actions/create-github-app-token` turns it into a token that expires after an hour. The app's private key is still a stored secret, but each token reaches only what you picked, and nothing is tied to your own account. ### CI-13: Check your workflows with zizmor *Level 2* It finds the problems above, such as untrusted text in `run:` lines, broad tokens, unpinned actions and credentials left behind. Run `uvx zizmor .github/workflows/` before you push, or add it to your security workflow. ### Check it worked Open a pull request that pins an old library with a known vulnerability in `manifest.json`. pip-audit should fail. For a card, add it to `package.json` instead, and dependency review and npm audit should both fail. CodeQL's check should run on the pull request. Barkley lists the security scanners, update bots and pre-commit hooks it finds in a repository.