[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-116114":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":9,"htmlUrl":9,"language":10,"languages":9,"totalLinesOfCode":9,"stars":11,"forks":12,"watchers":13,"openIssues":14,"contributorsCount":12,"subscribersCount":12,"size":12,"stars1d":15,"stars7d":16,"stars30d":16,"stars90d":12,"forks30d":12,"starsTrendScore":17,"compositeScore":18,"rankGlobal":9,"rankLanguage":9,"license":19,"archived":20,"fork":20,"defaultBranch":21,"hasWiki":22,"hasPages":20,"topics":23,"createdAt":9,"pushedAt":24,"updatedAt":25,"readmeContent":26,"aiSummary":27,"trendingCount":12,"starSnapshotCount":12,"syncStatus":28,"lastSyncTime":29,"discoverSource":30},116114,"ha-barkley","SeriesOfTubez\u002Fha-barkley","SeriesOfTubez","Barkley gives Home Assistant Marketplace integrations and cards a security sniff test before they get into the house.",null,"Python",89,0,59,13,4,25,21,63,"MIT License",false,"main",true,[],"2026-11-18 21:13:12","2026-11-23 17:58:49","\u003Cp align=\"center\">\u003Cimg src=\"docs\u002Fbrand\u002Fbarkley-banner.png\" alt=\"Barkley\" width=\"500\">\u003C\u002Fp>\n\n# 🐕 Barkley\n\n[![Tests](https:\u002F\u002Fgithub.com\u002FSeriesOfTubez\u002Fha-barkley\u002Factions\u002Fworkflows\u002Fci.yaml\u002Fbadge.svg)](https:\u002F\u002Fgithub.com\u002FSeriesOfTubez\u002Fha-barkley\u002Factions\u002Fworkflows\u002Fci.yaml)\n[![Security](https:\u002F\u002Fgithub.com\u002FSeriesOfTubez\u002Fha-barkley\u002Factions\u002Fworkflows\u002Fsecurity.yaml\u002Fbadge.svg)](https:\u002F\u002Fgithub.com\u002FSeriesOfTubez\u002Fha-barkley\u002Factions\u002Fworkflows\u002Fsecurity.yaml)\n\nEvery integration gets a sniff test before it gets into the house.\n\nBarkley is the dog behind a static security scanner for Home Assistant Marketplace\n(formerly HACS) custom integrations and frontend cards. Custom integrations run\nunsandboxed inside the HA Python process; cards run in the HA frontend origin and can\nread your tokens. Nobody reviews them before you install. Barkley does a first pass, as\nan app (add-on) in your Home Assistant sidebar or from the command line.\n\n> **Status:** young, and built by one person. Barkley is a first pass, not a substitute\n> for reading the code: a clean sniff means the checks below found nothing, not that\n> the code is safe. Other tools exist for this job (HA Security Sandbox, Marketplace\n> Guard); Barkley's difference is depth: dependencies resolved the way HA installs\n> them, data-flow rules, release and publisher history, and the diff of an update.\n> This project was built with AI assistance: see\n> [AI-assisted development](#ai-assisted-development) for what that means and what is\n> checked before anything ships.\n\n## What Barkley does\n\n**Sniff before you install.** Search the whole Marketplace catalog from Barkley's panel\nand sniff an app at exactly the version the Marketplace would install, or pick one of\nits 10 newest releases, betas included. The code is downloaded and read; it is never\nrun, built or installed.\n\n**See what you already have.** Barkley asks the Marketplace what is installed and leads\nwith what needs a look: an update that brings something important, or a scan that isn't\na Good Boy. The counts at the top are filters, the list shows as cards or a table, and\nSniff again (on each app, or for all of them) runs fresh scans.\n\n**Auto-sniff, on by default.** When the Marketplace installs or updates an integration\nor card, Barkley sniffs the version that landed and sends a notification (the bell, and\nyour phone if you pick a notify service). When the Marketplace starts *offering* an\nupdate, Barkley sniffs that version right away, so the heads-up comes before you click\nUpdate. Notifications carry scores, counts and the app's name, never text taken from the\nscanned code. One thing to know: Home Assistant runs a new integration as soon as it is\ninstalled, so the protection for a brand-new install is sniffing it from search first.\n\n**\"What would updating change?\"** Barkley compares the version you run with the one you\nwould get and puts the few changes that matter first: new findings, new data flows, new\npublishers, new hosts nobody declared. The comparison never changes a score.\n\n**Advisories asked again every day.** A scan keeps the exact package list it resolved,\nand once a day Barkley asks the advisory database about it again, without fetching or\nscanning any code. A newly published vulnerability in a dependency of something you\ninstalled months ago becomes a new scan entry and a notification. Earlier entries are\nnever edited.\n\n**A page per app, in plain English.** The score and verdict, \"In short\", every finding\nexplained in plain words, a diagram of where data can\nflow, the addresses and ports the app talks to, privacy notes (telemetry, analytics,\nunencrypted connections), what the app hooks into in Home Assistant, and the scan\nhistory of that app.\n\n**The developer's security habits.** Whether the project runs security scanners in its\nown workflows, has Dependabot or Renovate and a security policy, how many dependency\nupdates are waiting, and open issues that look security-related. It is context from\npublic signs and never changes the score.\n\n**Findings by kind, and your review.** Findings are grouped into Threats (signs of\nmalicious behavior), what the app can do, known bugs in its libraries, and how it's made.\nYou can mark findings reviewed, or Accept all, with a note: the circle then shows your\nreviewed score, and Barkley's own score stays unchanged beside it. Each Threat needs its\nown tick, and known malware can never be accepted. An accepted finding stays accepted\nwhile its code stays the same; when an update changes it, it reopens, you're notified,\nand \"What changed?\" shows the code then and now. Addresses you trust work the same way.\nPer app, **Malware check only** shows and notifies only Threats and known malware.\n\n**A Settings page.** The scoring choices (Paranoid mode for the minor findings, the\nno-Threat floor at Very Sus, and more), reviews, auto-sniff, AI and the GitHub token,\neach with Barkley's default. **Report a false positive** under every finding opens a\npre-filled public issue on this repository for you to finish and submit.\n\n**AI explanations, if you want them.** Pick one of your Home Assistant AI Task entities\nand Barkley can explain an app's findings, or (in deep mode) read the code around one\nfinding and answer with statements that must cite the lines they rest on. Nothing is\nsent until you click, and only findings and code from the public project are sent, never\nanything from your Home Assistant. The AI never sets, clears or changes a score or a\nfinding: scoring is done by fixed rules. **The explanations are only as good as the\nmodel behind the entity you pick**, and they can be wrong.\n\n**Built for a small box.** Barkley checks free memory before every scan, warns under\n2 GB and refuses under 1 GB, so a scan can't push Home Assistant out of memory. A\nDiagnostics page shows each tool, the memory figure and the AppArmor profile in use.\n\nThe [wiki](https:\u002F\u002Fgithub.com\u002FSeriesOfTubez\u002Fha-barkley\u002Fwiki) walks through every feature,\npage by page. The app's own [documentation](addon\u002Fsniff_test\u002FDOCS.md) has the details:\nevery option, how auto-sniff and the AI features work, and what the app is allowed to do.\n\n## Install on Home Assistant\n\nBarkley runs as an app (add-on), so it needs Home Assistant OS or Supervised.\n\n1. Settings → Apps → the app store → ⋮ → Repositories, and add\n   `https:\u002F\u002Fgithub.com\u002FSeriesOfTubez\u002Fha-barkley`.\n2. Install **Barkley**, start it, and open it from the sidebar.\n\nThe app store downloads a prebuilt image (amd64 or aarch64, about 200 MB). Plan for\n0.5 to 1 GB of free memory while a scan runs.\n\n**Home Assistant Container or Core, or a small box?** The same image runs as a container\nnext to Home Assistant or on another machine, with a login through Home Assistant:\n[`standalone\u002Fcompose.yaml`](standalone\u002Fcompose.yaml) and the wiki page\n[Standalone (no Supervisor)](https:\u002F\u002Fgithub.com\u002FSeriesOfTubez\u002Fha-barkley\u002Fwiki\u002FStandalone).\n\n## What gets checked\n\n- **Code** (Semgrep, bundled HA-specific rules): token and data exfiltration, encoded\n  payload loaders, auth internals, other integrations' credentials, unauthenticated views.\n- **Python dependencies** (integrations): the `manifest.json` requirements are resolved\n  the way HA installs them (HA's constraints, its Python version, PyPI plus HA's wheel\n  index) for both x86_64 and aarch64 HA OS \u002F Container. Then: typosquats (offline, from\n  the name alone), VCS\u002FURL requirements, brand-new packages, known vulnerabilities and\n  known-malicious packages (osv-scanner), and heuristic malware checks (GuardDog) on every\n  package HA doesn't already ship.\n- **Addresses you trust.** A few findings are only about where an address points: a\n  hardcoded public IP, or an address in a dependency that GuardDog finds suspicious-looking\n  (`https:\u002F\u002Fapi.together.xyz\u002F`, which is Together AI). Barkley can't know every host an\n  app legitimately uses, so in the panel you can mark such an address trusted, for one app\n  or for every app. The finding stays listed and stops costing points until the address\n  changes; Barkley's own score is always shown next to yours, and the stored scan is never\n  changed. Findings about what is sent, and paste sites, tunnels and chat webhooks, can't\n  be switched off. A shipped list (`src\u002Fsniff_test\u002Fdata\u002Fknown_services.txt`) names who runs\n  well-known hosts as a hint; it is matched locally (no host is ever sent anywhere to be\n  looked up) and changes no score.\n- **npm dependencies** (cards): the repo's lockfile, checked with osv-scanner. Known\n  malware is reported for every package; CVEs only for packages bundled into the card,\n  not for build-only tools.\n\n- **Endpoints**: every host and IP literal in the shipped code, classified as declared\n  (the manifest's documentation\u002Fissue tracker, or the integration's own name), local,\n  infrastructure or undeclared. Paste sites, request catchers, tunnels, chat webhooks\n  with a baked-in token, and URLs with a hardcoded public IP are findings.\n- **Possible exfiltration**: reading secrets, auth data or other integrations'\n  credentials *and* being able to send data to an undeclared host is flagged high, even\n  when the read and the send are in different files.\n- **Code you can't read**: compiled `.pyc` files that HA's Python would run instead of\n  (or without) the `.py` next to them (unchecked-hash, checked-hash matching the source,\n  or sourceless bytecode for HA's Python version), and native `.so` extension modules\n  HA's Python would load, either in place of a same-named `.py` or with no source at all.\n- **Scanner evasion**: `\u003C!--` and `-->` hide the rest of a line from Semgrep in JS but are\n  ordinary code in the ES modules HA loads. Barkley rewrites them (with the same\n  meaning) in its copy before scanning, and flags a real `\u003C!--` in code.\n  It also rewrites two forms Semgrep misreads (`n?.5:1`, and `new as(...)` for a class\n  minified to the name `as`). A code file Semgrep still can't read at all is its own\n  finding, and the score can't pass 89 while one is there.\n- **Repo signals**: ownership transfers (proven from GitHub's redirect, or from the\n  repo's own old links resolving to the same repository), scored by whether the people\n  publishing releases changed; a first release by a new publisher; very new repos;\n  release tags whose commit isn't on the default branch; and release zips whose code\n  differs from the tagged source.\n\nThe JSON report also carries a `graph` section (what the item hooks into: HA\nservices, views and events, the user's data, hosts, packages, publishers, with an\nevidence level on every edge) and a `provenance` section (release timeline,\npublishers, former names). Neither affects the score.\n\n| Score | Verdict |\n|---|---|\n| 90–100 | 🦴 Good Boy (passed the sniff test) |\n| 70–89 | 🐕 Kinda Sus (a few things worth a look) |\n| 40–69 | 🐕‍🦺 Very Sus (the dog won't stop staring at it) |\n| 0–39 | 🚨 BORK BORK BORK (do not install) |\n\nScoring is deterministic. Any critical finding (e.g. proven token exfiltration) caps the\nscore at 39; any high caps it at 89; an incomplete scan (missing tool, timeout) also caps\nat 89, so a partial scan can never pass as a Good Boy.\n\n## Safety model\n\nThe scanned code is treated as hostile. Barkley never executes, imports, builds or\ninstalls it. Archives are extracted into a fresh temp dir outside this repo with\nzip-slip, symlink and size protections, and in-tree `.semgrepignore`\u002F`.gitignore` files\nare removed so a repo can't hide files from the scanner.\n\nDependencies are resolved with `uv pip compile --no-build` (wheels only), so no\n`setup.py` or build backend ever runs; packages that only ship source archives are\ndownloaded and extracted, never built. Manifest requirements are validated before uv sees\nthem, so a manifest can't smuggle in installer options like `-e` or `--index-url`.\nLockfiles are scanned in isolation with Barkley's own osv-scanner config, so a planted\n`osv-scanner.toml` can't hide a malicious package.\n\n## How Barkley itself is secured\n\nA security tool that reads hostile code should be held to its own standard. Three\nlayers, each of which you can check in this repository.\n\n### The app on your box\n\n- **One permission.** The app asks for the Home Assistant API and nothing else: no host\n  network, no open port, no Supervisor role, and no access to your configuration folder,\n  so `secrets.yaml` and the auth storage are out of its reach. What it uses the API for\n  is a fixed list of calls, named one by one in the\n  [documentation](addon\u002Fsniff_test\u002FDOCS.md#permissions).\n- **Its own AppArmor profile, enforcing** (`addon\u002Fsniff_test\u002Fapparmor.txt`, Home\n  Assistant security rating 8). Every process in the container can run only the tools\n  the image ships, write only under `\u002Fdata` and `\u002Ftmp`, and open only ordinary network\n  sockets (no raw sockets, no capabilities). Nothing downloaded is executable. A hole\n  in one of the parsers that read hostile code is confined to that.\n- **Each scanner tool in its own sandbox, where the kernel has Landlock**\n  (`src\u002Fsniff_test\u002Fsandbox.py`). Every run of Semgrep, GuardDog, osv-scanner or uv can\n  write only that scan's own folder, read the image and the system but not the scan\n  store, the token or other scans, run only what the image ships, and connect only to\n  port 443 (Semgrep: nowhere). It also can't signal Barkley or read its environment.\n  Barkley sets this up itself, so it applies on top of AppArmor in the app and on its own\n  when Barkley runs [standalone](https:\u002F\u002Fgithub.com\u002FSeriesOfTubez\u002Fha-barkley\u002Fwiki\u002FStandalone),\n  which won't start without it unless you say so. Home Assistant OS's kernel is built\n  without Landlock (checked on 6.18), so there the AppArmor profile alone confines the\n  tools. Diagnostics says which.\n- **The panel** answers only Home Assistant's ingress, which handles the login, and it\n  ships no JavaScript at all: its content security policy allows no scripts, only the\n  page's own styles, images and fonts.\n\n### Where the image comes from\n\n`.github\u002Fworkflows\u002Fbuild.yaml` builds the image when a release is published, on\nGitHub's runners, from `scripts\u002Fstage_addon.py`'s output (the app's files plus the\nscanner's source, never the tests or the malicious samples). The Dockerfile pins every\ntool's version: uv and osv-scanner are release binaries checked against a sha256,\nSemgrep and GuardDog are installed from wheels only (nothing is compiled), and the\nscanner's own dependencies are installed with hashes required. The base image's\nsignature is checked before the build, the workflow's actions are pinned to commits,\nand a version that is already published is never overwritten.\n\nEach image is signed with [Cosign](https:\u002F\u002Fdocs.sigstore.dev\u002F) by that workflow. Home\nAssistant doesn't check app signatures, so there is nothing you have to do; if you'd\nlike to check the signature yourself:\n\n```sh\ncosign verify ghcr.io\u002Fseriesoftubez\u002Fbarkley:0.14.0 \\\n  --certificate-oidc-issuer https:\u002F\u002Ftoken.actions.githubusercontent.com \\\n  --certificate-identity-regexp '^https:\u002F\u002Fgithub.com\u002FSeriesOfTubez\u002Fha-barkley\u002F'\n```\n\nTo build it yourself instead: `uv run python scripts\u002Fstage_addon.py`, then\n`docker buildx build dist\u002Faddon\u002Fsniff_test`, or install the staged folder as a local\napp (see the app's documentation).\n\n### Checks on every change\n\n`.github\u002Fworkflows\u002Fsecurity.yaml` runs on every push and pull request, and once a\nweek. The `main` branch only takes changes that passed it and the tests.\n\n| Kind | Tool | What it reads |\n|---|---|---|\n| Secrets | Gitleaks | every commit |\n| SAST | Semgrep's registry rules, CodeQL | the scanner's code and the workflows |\n| SCA | Trivy | the lockfile, plus an SBOM |\n| IaC | Checkov, Hadolint | the Dockerfile and the workflows |\n| Container | Trivy | the image built from the staged folder: CVEs that have a fix (high and critical), configuration, plus an SBOM |\n\nA finding fails the run. Anything accepted is written down with its reason:\n`.checkov.yaml`, `.hadolint.yaml`, `.trivyignore` (empty today). The malicious samples\nin `tests\u002F` and `demo\u002F` are left out of the code and dependency checks, since being\ncaught is their job.\n\n## AI-assisted development\n\nBarkley was built with AI pair-programming assistance (Claude, via Claude Code) under\nhuman direction and review; most of the code and docs are AI-generated. If that's a\ndealbreaker for you, that's a reasonable position, and this project isn't for you.\nHere's what's in place either way, so you can judge for yourself rather than take it on\nfaith:\n\n- **Security scanning runs on every push and pull request** (the table above, and the\n  badge at the top of this page).\n- **Those scans have already changed real decisions.** Before the first release Trivy\n  found 31 high CVEs in the image: osv-scanner moved up a version, a base-image binary\n  nothing used was removed, and the image now takes Debian's security fixes at build\n  time.\n- **The detection rules are tested**: each rule has annotated test code, the planted\n  malware in `tests\u002Ffixtures\u002F` must be caught on every run, and a new rule is tried on\n  real integrations and cards for noise before its severity is settled.\n- **All source is here to read**; nothing is obfuscated or minified. Issues and pull\n  requests are welcome, especially reports of a missed detection or a false alarm. AI\n  assistance doesn't put the code beyond scrutiny: it means you get to scrutinize it.\n\n## Command line\n\n```sh\nuv run sniff-test scan https:\u002F\u002Fgithub.com\u002Fowner\u002Frepo            # latest release, as HACS installs it\nuv run sniff-test scan owner\u002Frepo --ref v1.2.3                  # a specific tag\nuv run sniff-test scan .\u002Fpath\u002Fto\u002Frepo                           # local checkout\nuv run sniff-test scan owner\u002Frepo --exposure public             # HA reachable from the internet\nuv run sniff-test scan owner\u002Frepo --json -o report.json         # machine-readable report\nuv run sniff-test scan owner\u002Frepo --ha-version 2026.10.2        # resolve deps for a specific HA release\nuv run sniff-test scan .\u002Fpath\u002Fto\u002Frepo --offline                 # no PyPI\u002FOSV lookups (marked incomplete)\n\nuv run sniff-test diff old.json new.json                        # what an update changes (reports from scan -o)\nuv run sniff-test diff owner\u002Frepo --from v1.2.3                 # scan v1.2.3 and what HACS installs now, compare\nuv run sniff-test diff owner\u002Frepo --from v1.2.3 --to v1.3.0 -v  # two tags; -v lists every change\nuv run sniff-test diff owner\u002Frepo --from v1.2.3 --ha-version auto  # old side: the HA of its time\nuv run sniff-test releases owner\u002Frepo                           # release timeline: HACS default, publishers, handovers\n\nuv run sniff-test scan owner\u002Frepo --store scans.db              # also keep the scan in a SQLite scan store\nuv run sniff-test diff owner\u002Frepo --from v1.2.3 --store scans.db  # reuse a matching stored scan, store new ones\nuv run sniff-test diff @3 @7 --store scans.db                   # compare two stored scans\nuv run sniff-test history --store scans.db                      # list stored scans (or set SNIFF_TEST_STORE)\nuv run sniff-test serve --store scans.db --allow 127.0.0.1      # the add-on's web panel (HA ingress)\n```\n\n`diff` puts the few changes that matter first (new findings, new data flows, evidence\ngoing from possible to proven, new publishers, new undeclared hosts) and summarizes the\nrest in one line. It compares; it never changes how either scan is scored.\n\n## Requirements\n\nPython 3.13, [uv](https:\u002F\u002Fdocs.astral.sh\u002Fuv\u002F), and on `PATH`: `semgrep`, `osv-scanner`\n(v2) and `guarddog` (3.2). A missing tool marks the scan incomplete. A GitHub token\n(`GITHUB_TOKEN`, or a logged-in `gh`) avoids API rate limits. HA release data and the\nresolved package sets are cached in `~\u002F.cache\u002Fsniff-test\u002F` (override with\n`SNIFF_TEST_CACHE`).\n\n## Development\n\n```sh\nuv sync\nuv run pytest                 # unit + rule tests + planted-malware fixtures\nuv run pytest -m network      # opt-in tests that hit GitHub \u002F PyPI \u002F OSV\nuv run ruff check . && uv run ruff format --check .\nsemgrep scan --test --config rules\u002F tests\u002Frules\u002F\n```\n\nRules live in `rules\u002F` (Semgrep YAML) with annotated test targets in `tests\u002Frules\u002F`.\n`tests\u002Ffixtures\u002F` contains deliberately malicious sample repos. They are never executed\nand only send to `.invalid` hosts. To report a security problem, see\n[SECURITY.md](SECURITY.md). MIT licensed.\n","Barkley 是一个面向 Home Assistant Marketplace（原 HACS）的静态安全扫描工具，用于在安装或更新前对自定义集成和前端卡片进行安全风险初筛。它不执行代码，而是深度分析源码、依赖解析路径、数据流向、发布者历史、网络请求主机及版本差异，支持手动扫描、自动触发通知与更新对比。其设计聚焦于真实安装环境下的风险暴露面，适用于注重家庭自动化系统安全性的进阶用户与隐私敏感场景。",2,"2026-11-24 04:52:51","CREATED_QUERY"]