A security check-up for your computer, by SwordSec. It runs on macOS today; Linux and Windows are planned. A small, fast Rust CLI that audits the security settings of your Mac, scores them out of 100 and reports what to fix. It also finds known vulnerabilities in your project dependencies, macOS, common apps and Homebrew formulae, scans for malicious npm packages, and locates API keys scattered across .env and config files. The tool is read-only: it never changes a setting on your Mac. For every problem it explains what to do, and where a single command does the job it shows that command for you to run yourself. SwordCheck runs on macOS (Apple silicon and Intel). Install the latest release with: curl -fsSL https://raw.githubusercontent.com/SwordSec/SwordCheck/main/install.sh | sh The script downloads the release archive from GitHub, checks it against its published SHA-256 and puts swordcheck in ~/.local/bin. It never uses sudo. Set SWORDCHECK_VERSION=v0.1.0 to pick a release, or SWORDCHECK_INSTALL_DIR to install elsewhere. You can also download the archive yourself from the releases page. The binary is not notarized: a copy downloaded with a browser has to be allowed once under System Settings > Privacy & Security. To build from source instead, you need a Rust toolchain (1.88 or newer, from rustup.rs): git clone https://github.com/SwordSec/SwordCheck.git cd SwordCheck cargo install --path . That puts swordcheck in ~/.cargo/bin. The examples below use cargo run --, which works straight from the checkout; with the installed binary, write swordcheck instead. Run it without arguments to open the dashboard, pick a module and watch it work: cargo run Every module is also available as a flag, for scripts and CI: cargo run -- --format text # colored text report of the audit cargo run -- --json # JSON output (scripts / CI) cargo run -- --format html -o report.html cargo run -- --report report.html # one HTML page with every module (see below) cargo run -- --only filevault,sip # run selected checks only cargo run -- --min-score 80 -q # CI: exit code 1 if the score is below 80 cargo run -- --npm # malicious npm package scan (global + projects) cargo run -- --npm --online # also query the OSV.dev malicious package database cargo run -- --secrets # find API keys in .env and config files cargo run -- --secrets --secrets-path ~/project # scan a single directory / file cargo run -- --vulns # inventory of lockfiles, macOS, known apps and Homebrew (offline) cargo run -- --vulns --online # look them up in OSV.dev, NVD, CISA KEV and EPSS cargo run -- --help Tests: cargo test (the end-to-end tests in tests/cli.rs run the binary against a temporary home directory) cargo run -- --list prints the current list with id, weight and CIS section. command means the report prints a command you can run yourself; settings means the advice points to the place in System Settings (or Recovery). Pass earns full weight, Warn half, Fail none. Checks whose state cannot be determined (Unknown) and checks with an exception are left out of the denominator. If that leaves nothing to score, the score is shown as n/a. A check never passes on a guess: a command that fails, times out (20 s) or prints something unexpected gives Unknown with the raw output. Grades: 90+ A, 75+ B, 60+ C, 40+ D, below that F. Exit code The scan modes use 1 for their own "found something" condition (described in each section) and 3 when part of the scan could not be done and nothing was found in the part that did work: a script must not read an incomplete scan as a clean one. Lockfiles that could not be read are named in the report and listed under skipped in the JSON output. The dashboard is interactive and always exits with 0. Secret scan (--secrets) Summarizes which API keys live in which files on this machine. Read-only, and it never touches the network. Where it looks: in projects under your home directory: .env*, *.env, *.tfstate, *.tfvars, *.pem, *.key, credentials.json, secrets.*, .mcp.json, .git/config, .yarnrc.yml. In addition: ~/.aws/credentials, ~/.npmrc, ~/.netrc, ~/.docker/config.json, ~/.kube/config, shell history and rc files, ~/.ssh, and Claude / Cursor / VS Code settings. What it skips: dependency and build directories such as node_modules, target, vendor and testdata, hidden directories, ~/Library, ~/go/pkg. Patterns: Anthropic, OpenAI, OpenRouter, AWS, Google, DigitalOcean, GitHub, GitLab, Slack, Stripe, SendGrid, Twilio, npm, Hugging Face, Groq, Telegram, JWTs, passwords embedded in URLs and unencrypted private keys. On top of that, assignments whose name contains SECRET / TOKEN / PASSWORD / API_KEY and whose value looks random are reported under "Generic" (heuristic). Template files (.env.example etc.): only real key patterns are matched; made-up passwords are not reported. Masking: raw values are never written to any output. A finding shows at most the provider's public prefix (sk-ant-, ghp_, AKIA…) and the last 2–4 characters of long keys; passwords, generic matches and anything under 20 characters show only their length. Copies of the same key in different files are linked through secret_id, a running number that says nothing about the value. Skipped files: files over 8 MB, binary files, unreadable files and folders that cannot be opened are counted and reported, not dropped silently. PGP private key blocks are reported without a claim about passphrase protection. Flags: TRACKED IN GIT when the file is tracked by a git repository, mode 644 when group / other users can read it. Exit code: 1 if a secret sits in a git-tracked file; otherwise 3 if git could not tell whether a file with a secret is tracked, 0 if not. Only the text and json formats are supported. Limits: secrets that only exist in git history (committed, then deleted) are not found, and keys are not checked for validity against the provider. Vulnerability scan (--vulns) Lists the known vulnerabilities that affect the software on this machine and ranks them by how likely they are to be exploited. Lockfiles: Cargo.lock, package-lock.json, yarn.lock, pnpm-lock.yaml, requirements*.txt (pinned lines), poetry.lock, uv.lock, Pipfile.lock, composer.lock, Gemfile.lock, go.mod, found under your home directory. Dependency and build directories are skipped. A requirements file's -r other.txt includes are read too, whatever their name (e.g. requirements/base.txt); only relative .txt paths are followed, and an include that cannot be read makes the scan incomplete. Homebrew: installed formulae are read from the Cellar (/opt/homebrew, /usr/local or HOMEBREW_PREFIX); brew itself is never run. Well-known formulae (openssl, curl, git, node, python, php, …) are looked up; the report says how many others were left out. Casks are covered when the installed app is in the application table. Ranking: known-exploited (KEV) and malware first, then EPSS probability, then severity. The text report shows the top 25; --json has everything. Offline by default: without --online only the inventory is printed. With --online, package names and versions are sent to the services above; file paths and contents never are. Cache: responses are kept under ~/.swordcheck/cache (advisories until they change, KEV and NVD answers for a day). If the KEV download fails, an older cached catalog is still used, and the report says so and how old it is (exit code 3). NVD rate limit: without an API key the NVD allows 5 requests per 30 seconds, so the first run takes a few seconds per product. A free NVD API key makes it about ten times faster; see API keys. Options: --vulns-path PATH scans only the lockfiles under a path (and skips macOS, apps and Homebrew); --json, -o FILE and -q work as usual. Exit code: 1 if a known-exploited vulnerability or malware is found; otherwise 3 if an online lookup failed or a lockfile could not be read, 0 if not. Limits: applications and Homebrew formulae are matched through built-in tables (bundle ids and formula names), so anything that is not in a table is not checked; for these products only known-exploited CVEs are reported, not every CVE; NVD matching depends on the vendor publishing version data and can miss or over-report; unpinned requirements (flask>=2.0) and git / path / workspace dependencies are ignored and never sent anywhere, but a private registry that looks like a public one cannot be told apart from the lockfile, so its package names are looked up too. API keys Everything works without a key. The only service that offers one is the NVD, where it lifts the rate limit from 5 to 50 requests per 30 seconds. OSV.dev, CISA KEV and EPSS have no keys. cp .env.example .env && chmod 600 .env # then fill in NVD_API_KEY A key is looked up in the environment first, then in ./.env, then in ~/.swordcheck/.env. Only the names listed in .env.example are read, the file is never loaded into the environment of the commands the tool runs, and the key is sent to the NVD only. .env is in .gitignore. npm malicious package scan (--npm) Looks for npm packages that were hijacked or published as malware in the first place. Only package.json files are read; no package code is ever executed. There are two scopes: Every audit runs the npm-packages check against global install directories (npm, pnpm, yarn, bun, nvm / fnm / volta / asdf / mise and the npx cache). It is fast and affects the score and exit code. --npm additionally scans the node_modules directories of every project under your home directory and lists each finding with its location. macOS may ask for permission to let the terminal access folders such as Documents and Desktop. Options: --npm-path DIR : scan only this directory (or the node_modules directories below it); repeatable --online : sends the names and versions of installed packages to OSV.dev and looks up malicious package records. No file paths or contents are sent. The built-in list ages; up-to-date coverage comes from here. --json, -o FILE and -q work in this mode too (markdown / html are not supported) The exit code is 1 when a confirmed malicious package is found; heuristic script warnings do not affect it. Otherwise it is 3 when the --online OSV lookup failed, so the packages it did not answer for were checked against the built-in list only; malicious package records found before the failure are still reported. It is also 3 when npm root -g failed: a custom npm prefix is found only through it, so npm's own global directory may not have been scanned, and the report says so. If something turns up: remove the package or move to a clean version, delete and reinstall node_modules, and rotate the npm / GitHub / cloud credentials on that machine. Limits: lockfiles (package-lock.json etc.) are not scanned on their own, only packages installed on disk; symlinks (npm link) are not followed; the JavaScript inside packages is not analyzed. Output formats --format text|json|markdown|html (or --json for short). -o FILE writes the report to a file. The JSON output contains the score, the summary, the details of every check, the previous run and the checks that changed. Full report (--report) --report FILE runs the audit and every scan and writes one HTML page: a "Fix these first" list ordered by risk across all modules (malware, then what is exploited in the wild, then secrets in git-tracked files, then failing settings by weight), the score with its grade bands and the change since the previous audit, and one section per module with a row for every finding. Rows open for details, commands to run have a copy button, and passing checks are folded away. The page is a single file: the styles and the small script are inline, the fonts are the system's, and it loads nothing from the network, so it can be attached to a ticket or opened offline. It follows the light or dark setting and prints with every row expanded. Secret values stay masked. cargo run -- --report report.html # audit + every scan, offline cargo run -- --report report.html --online # also look versions up (OSV.dev, NVD, CISA, FIRST) cargo run -- --report report.html --vulns-path ~/app --npm-path ~/app --secrets-path ~/app The audit options (--only, --skip, --config, --min-score, --no-history) apply to its audit part, and a full audit is saved to the history as usual. The path options narrow the scans to one project; with --vulns-path, macOS, apps and Homebrew are not scanned. The exit code is 1 when the audit fails or a scan finds malware, a known-exploited vulnerability or a secret in a git-tracked file; otherwise 3 when part of a scan could not be done (an online lookup failed, a lockfile could not be read, git could not tell whether a file with a secret is tracked, or npm root -g failed). History and comparison Every full audit, from the command line or the dashboard, is saved to ~/.swordcheck/history.json (last 100 runs). The next run shows the score difference and the checks whose status changed. --history : list past audits --no-history : do not save or compare Partial runs with --only / --skip are not saved The SWORDCHECK_HOME environment variable changes the storage directory. Without it, an empty or relative HOME means no history, never one in the current folder. A run that ends while another one is scanning (--report takes minutes) is kept: the file is read again just before saving. Configuration (audit.toml) Looked up in this order: --config FILE, ./audit.toml, ~/.config/swordcheck/audit.toml. See audit.example.toml for an example: min_score = 80 skip = ["airdrop"] [weights] filevault = 40 [exceptions] ssh = "Development machine; SSH is enabled on purpose" A check with an exception still runs and shows up in the report as EXCEPTION, but it does not affect the score or the exit code. Unknown ids and fields are errors. Recommendations The tool never applies a fix. Every failed or warned check comes with advice, and where one command is a correct and complete remedy the report prints it under Run: (the dashboard shows it as "Command to run yourself"). Settings such as FileVault, SIP and Gatekeeper can only be changed in System Settings or Recovery; for those the advice names the place. Run the audit again afterwards to confirm. Dashboard swordcheck with no arguments (or --tui) opens the dashboard when it runs in a terminal. When the output is piped or redirected, the plain audit report is printed instead, so existing scripts keep working. Home: the four modules (security audit, vulnerability scan, npm malware scan, secret scan) with a description of what each one reads and sends. Online lookups are off until you press o. Running: the current phase, a progress bar with a percentage when the total is known (a moving bar when it is not), the step counter, elapsed time and the most recent items being processed. Esc goes back and stops the scan: no further network request is started (a request already in flight finishes, and what was downloaded stays cached). Results: findings on the left, the selected finding's details on the right, most urgent first. On the command line, --vulns --online prints the same phases to stderr. Code layout To add a check: define a type, implement the Check trait and add it to checks::registry(). Checks run commands through CommandRunner, so they can be tested against canned output with MockRunner. The CIS column refers to the matching section of the CIS Apple macOS 26.0 Tahoe Benchmark v1.1.0, as mapped by NIST's macOS Security Compliance Project. sharing covers several subsections of 2.3.3 (screen sharing, file sharing, remote management). Section numbers change between benchmark versions; compare with the version you use before relying on them in a compliance report. SwordCheck is not a CIS-certified tool. launch-items uses simple heuristics (programs running from temporary or hidden directories, download-and-execute, etc.); a warning is not a verdict. An unset, empty or relative HOME is no home folder, never the current folder. --secrets, --vulns, --npm and --report then exit with 2 unless each scan that searches the home folder is given a path (--secrets-path, --vulns-path, --npm-path). In the audit, launch-items and npm-packages say what they could not examine (UNKNOWN instead of PASS), and ~/.config/swordcheck/audit.toml is not looked up. This tool covers baseline configuration checks. It is not a replacement for a full security assessment. Copyright © 2026 SwordSec. SwordCheck is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License, version 3, as published by the Free Software Foundation. It is distributed in the hope that it will be useful, but without any warranty; see the license for details. In short: you may use it, at home or at work, and you may change it. If you distribute a changed version, or offer one to others over a network, you must make its source available under the same license. If the AGPL does not fit your use, contact SwordSec about a commercial license.
AI NEWS JOURNAL
Hacker News Show HNAI NEWS / JOURNAL
Show HN: SwordCheck – A read-only security check-up for your Mac
Article URL: https://github.com/SwordSec/SwordCheck Comments URL: https://news.ycombinator.com/item?id=50582903 Points: 1 # Comments: 0
번역 서비스가 일시 중지되어 원문을 표시합니다.