Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 10 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# `>_ pkgdash_`

**One dashboard for every package manager on your Mac**: inventory, CVE audits, malware checks and
updates for uv, npm, Homebrew, pip, Go, Cargo, Docker images, and the lockfiles of your own projects.
updates for uv, npm, Homebrew, pip, Go, Cargo, Ruby gems, Docker images, and the lockfiles of your own projects.

[![CI](https://github.com/adamtty/pkgdash/actions/workflows/ci.yml/badge.svg)](https://github.com/adamtty/pkgdash/actions/workflows/ci.yml)
[![CodeQL](https://github.com/adamtty/pkgdash/actions/workflows/codeql.yml/badge.svg)](https://github.com/adamtty/pkgdash/actions/workflows/codeql.yml)
Expand Down Expand Up @@ -111,11 +111,12 @@ screenshots are made.
| pip | Homebrew Pythons + `--user` installs in macOS python; flags strays | `pip-audit` | disabled by design (use uv) |
| go | `go version -m` + `go list -m @latest` | `govulncheck -mode=binary` | `go install <pkg>@latest` (rebuilds with current Go) |
| cargo | `cargo install --list` + crates.io | OSV (top-level crate only) | `cargo install --locked` |
| docker | `docker save` per image (cached by image id; nothing runs) | OSV, incl. Debian/Ubuntu/Alpine | — |
| gem | Homebrew Ruby's gems + `gem outdated`; the ones that ship with Ruby only count as outdated when OSV knows a vulnerability in them | OSV, every installed version | `gem install <gem> --version <scanned> --conservative` |
| docker | `docker save` per image (cached by image id; nothing runs): OS packages, Python, npm and Ruby gems | OSV, incl. Debian/Ubuntu/Alpine | — |
| other | ~/.local/bin, /usr/local/bin, extra managers | — | — |

Single packages: each outdated package has its own `> update` button (`brew upgrade --formula/--cask <name>`,
`uv tool upgrade <name>`, `npm i -g <name>@latest`, `go install …@latest`, `cargo install --locked <name>`),
`uv tool upgrade <name>`, `npm i -g <name>@latest`, `go install …@latest`, `cargo install --locked <name>`, `gem install <name> --version …`),
followed by a re-scan. The server only accepts names its last scan found.

### Supply-chain guards
Expand All @@ -124,9 +125,9 @@ followed by a re-scan. The server only accepts names its last scan found.
<summary><b>Cooldown</b> (<code>cooldown_days</code>, default 5)</summary>

Updates wait until a release is that old, since hijacked releases are usually caught and pulled within days.
uv uses `--exclude-newer` and npm `--before`, which also cover their dependencies; brew/go/cargo skip packages
still cooling (cargo is pinned to the scanned version). Release dates come from PyPI, the npm registry, the
Go proxy and crates.io; Homebrew has none, so formulae use the build time of the version's first bottle on
uv uses `--exclude-newer` and npm `--before`, which also cover their dependencies; brew/go/cargo/gem skip packages
still cooling (cargo and gem are pinned to the scanned version). Release dates come from PyPI, the npm registry, the
Go proxy, crates.io and rubygems.org; Homebrew has none, so formulae use the build time of the version's first bottle on
ghcr.io, and casks (no bottles) start the clock when a scan first sees the version. pip packages show no
cooldown, since pkgdash doesn't update them.
</details>
Expand Down Expand Up @@ -157,7 +158,7 @@ free plan's quota is small (500, 100 per lookup); the settings page shows what's
### Projects

The **projects** page checks the lockfiles of every project in the folder chosen on the setup page
(`package-lock.json`, `yarn.lock`, `uv.lock`, `poetry.lock`, `Cargo.lock`, pinned `requirements.txt`). It
(`package-lock.json`, `yarn.lock`, `uv.lock`, `poetry.lock`, `Cargo.lock`, `Gemfile.lock`, pinned `requirements.txt`). It
must be inside your home folder. launchd agents can't read protected folders like `~/Documents`, so the
menu bar app (which macOS asks you to allow) finds the lockfiles, skipping `node_modules`/`.git`/venvs/
`target`, and sends new or changed ones to the service hourly or when a scan asks; copies live in
Expand All @@ -168,7 +169,8 @@ menu bar app (which macOS asks you to allow) finds the lockfiles, skipping `node
- **fix lockfile** (npm, uv, cargo): the menu bar app shows what it's about to run and asks first, then runs
`npm audit fix --package-lock-only --ignore-scripts`, `uv lock --no-build --upgrade-package …` or
`cargo update …`. These rewrite the lockfile only: nothing is installed and no package code runs. Review
the result with `git diff` in the repo.
the result with `git diff` in the repo. `Gemfile.lock` isn't fixed: Bundler would run the project's
`Gemfile`, which is Ruby code, so run `bundle update <gem>` there yourself.
- **ignore:** for deliberate targets and other people's code. Their CVEs and malware stop counting.

Project counts stay out of the dashboard's headline totals. `install.sh` only rebuilds the menu bar app when
Expand Down
6 changes: 5 additions & 1 deletion demo.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ def row(name, ver, latest=None, age=30, new=False):
row("urllib3", "1.26.15"), row("jinja2", "3.1.2"), row("certifi", "2024.8.30"), row("six", "1.16.0")], "python3.12"),
"go": pkgs("go", [row("gopls", "v0.16.2"), row("golangci-lint", "v1.61.0"), row("staticcheck", "2024.1.1"), row("dlv", "v1.23.1")], "bin"),
"cargo": pkgs("cargo", [row("cargo-edit", "0.13.0"), row("cargo-watch", "8.5.3"), row("tokei", "12.1.2"), row("bottom", "0.10.2")], "crate"),
"gem": pkgs("gem", [row("rubocop", "1.66.1", "1.67.0", 4), row("bundler", "2.5.21"), row("cocoapods", "1.15.2"),
row("rake", "13.2.1"), row("json", "2.7.2")], "gem"),
"other": pkgs("other", [row("bun", "1.1.30"), row("deno", "2.0.2"), row("ollama", "0.3.14")], "bin"),
}

Expand All @@ -71,7 +73,8 @@ def row(name, ver, latest=None, age=30, new=False):
PROJECTS = [("npm", "web/storefront", 642, "package-lock.json"), ("npm", "web/admin-panel", 588, "package-lock.json"),
("uv", "api/orders-service", 74, "uv.lock"), ("uv", "tools/report-builder", 31, "uv.lock"),
("cargo", "cli/logtail", 112, "Cargo.lock"), ("npm", "experiments/chat-widget", 391, "yarn.lock"),
("uv", "scripts/backup", 9, "requirements.txt"), ("cargo", "games/tetris-rs", 48, "Cargo.lock")]
("uv", "scripts/backup", 9, "requirements.txt"), ("cargo", "games/tetris-rs", 48, "Cargo.lock"),
("bundler", "web/marketing-site", 87, "Gemfile.lock")]
proj = []
for kind, rel, deps, lock in PROJECTS:
p = S.pkg(rel, "%d deps" % deps, None, "yarn" if lock == "yarn.lock" else kind, lock)
Expand All @@ -92,6 +95,7 @@ def row(name, ver, latest=None, age=30, new=False):
F("jinja2", "3.1.2", "CVE-2024-22195", "medium", "HTML attribute injection when passing user input as keys to xmlattr", "3.1.3", "python3.12")],
"go": [F("golang.org/x/net", "v0.15.0", "CVE-2023-44487", "high", "HTTP/2 rapid reset can cause excessive work", "v0.17.0", "dlv")],
"cargo": [],
"gem": [F("rexml", "3.3.8", "CVE-2024-49761", "high", "ReDoS when parsing a hex numeric character reference", "3.3.9", "rexml")],
"other": [],
"projects": [F("lodash", "4.17.15", "CVE-2020-8203", "high", "Prototype pollution in zipObjectDeep", "4.17.19", "web/admin-panel"),
F("minimist", "1.2.5", "CVE-2021-44906", "critical", "Prototype pollution", "1.2.6", "web/admin-panel"),
Expand Down
9 changes: 6 additions & 3 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,7 @@
beer: '<path d="M17 11h1a3 3 0 0 1 0 6h-1"/><path d="M5 8h12v11a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2z"/><path d="M6 8a3 3 0 0 1 3-4 3 3 0 0 1 5 0 3 3 0 0 1 3 4"/>',
go: '<path d="M4 12h6"/><path d="M2 9h6"/><path d="M5 15h5"/><circle cx="16" cy="12" r="5"/>',
rs: '<circle cx="12" cy="12" r="8"/><path d="M9 16V8h3.5a2 2 0 0 1 0 4H9"/><path d="M12 12l3 4"/>',
rb: '<path d="M6 3h12l4 6-10 12L2 9z"/><path d="M2 9h20"/><path d="m12 21-4-12 4-6 4 6z"/>',
bin: '<polyline points="4 17 10 11 4 5"/><line x1="12" y1="19" x2="20" y2="19"/>',
alert: '<path d="m21.73 18-8-14a2 2 0 0 0-3.46 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3Z"/><path d="M12 9v4"/><path d="M12 17h.01"/>',
up: '<path d="M12 19V5"/><path d="m5 12 7-7 7 7"/>',
Expand Down Expand Up @@ -374,7 +375,7 @@
// seconds until a package's new version is past its cooldown period (matches cooldown_left in server.py)
const coolLeft = p => {
const days = Number(S.settings.cooldown_days) || 0;
return days > 0 && canUpdate(p) && p.outdated && p.latest && p.released ? Math.max(0, p.released + days * 86400 - S.now) : 0;
return days > 0 && canUpdate(p) && (p.outdated || p.newer) && p.latest && p.released ? Math.max(0, p.released + days * 86400 - S.now) : 0;
};
const leftText = s => s >= 86400 ? `${Math.ceil(s / 86400)} day${Math.ceil(s / 86400) === 1 ? "" : "s"}` : `${Math.max(1, Math.ceil(s / 3600))} hour${Math.ceil(s / 3600) <= 1 ? "" : "s"}`;
// matches flag_text in server.py
Expand Down Expand Up @@ -715,8 +716,10 @@
}
function latestCell(p) {
if (separate(p.mid)) return projCell(p);
if (!p.outdated) return '<span class="dim">—</span>';
if (!p.outdated && !(p.newer && p.latest)) return '<span class="dim">—</span>';
if (p.blocked) return `<span style="color:var(--red)">↑ ${esc(p.latest)}</span> <span class="tag red" title="OSV or Socket.dev flags this version, so pkgdash won't install it">blocked: ${esc(flagText(p.blocked))}</span>`;
// gems that ship with Ruby (no known vulnerability): a newer release, not counted as outdated
if (!p.outdated) return `<span class="dim" title="Ships with Ruby, so brew upgrade ruby updates it too. No known vulnerability in the installed version, so it isn't counted as outdated">↑ ${esc(p.latest)}</span>${updBtn(p)}`;
const left = coolLeft(p);
const since = p.released_src === "seen" ? "counting from when pkgdash first saw it" : "counting from its release";
return `<span style="color:var(--amber)">↑ ${esc(p.latest || "rebuild")}</span>${updBtn(p)}${left ? `<span class="cool" title="${since}">in cooldown period, ${leftText(left)} remaining</span>` : ""}${socketNote(p)}`;
Expand Down Expand Up @@ -841,7 +844,7 @@

function setupProjects() {
return `<div class="form">
<label class="row"><div><div>Check project lockfiles</div><div class="d">package-lock.json, yarn.lock, uv.lock, poetry.lock, Cargo.lock and requirements.txt, found by the menu bar app</div></div><input type="checkbox" id="projOn"></label>
<label class="row"><div><div>Check project lockfiles</div><div class="d">package-lock.json, yarn.lock, uv.lock, poetry.lock, Cargo.lock, Gemfile.lock and requirements.txt, found by the menu bar app</div></div><input type="checkbox" id="projOn"></label>
<div class="row col"><div><div>Projects folder</div><div class="d">inside your home folder. The menu bar app reads it, so macOS asks once if it's a protected folder like ~/Documents</div></div>
<div class="pathrow"><input type="text" id="projRoot" spellcheck="false" autocomplete="off"><button class="btn sm" id="projSave">&gt; save</button></div>
<div class="presets">${ROOT_PRESETS.map(r => `<button class="btn sm" data-root="${esc(r)}">${esc(r)}</button>`).join("")}</div>
Expand Down
2 changes: 1 addition & 1 deletion menubar/PkgdashMenu.swift
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ final class App: NSObject, NSApplicationDelegate {
}
var rootLabel: String { projectsRoot.path.replacingOccurrences(of: FileManager.default.homeDirectoryForCurrentUser.path, with: "~") }

let lockNames: Set<String> = ["package-lock.json", "yarn.lock", "uv.lock", "poetry.lock", "Cargo.lock", "requirements.txt"]
let lockNames: Set<String> = ["package-lock.json", "yarn.lock", "uv.lock", "poetry.lock", "Cargo.lock", "requirements.txt", "Gemfile.lock"]
let skipDirs: Set<String> = ["node_modules", "Library", "venv", "env", "target", "dist", "build", "__pycache__", "Pods", "vendor"]
let syncQueue = DispatchQueue(label: "pkgdash.projects")
var lastSync = Date.distantPast
Expand Down
Loading
Loading