<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: SwordSec</title>
    <description>The latest articles on DEV Community by SwordSec (@swordsec).</description>
    <link>https://dev.to/swordsec</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F4256418%2Fd7af2a3f-77e6-48a1-a7b7-68ce25d0608c.jpg</url>
      <title>DEV Community: SwordSec</title>
      <link>https://dev.to/swordsec</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/swordsec"/>
    <language>en</language>
    <item>
      <title>How SwordCheck audits your Mac's security with Rust: FileVault, SIP, Gatekeeper and friends</title>
      <dc:creator>SwordSec</dc:creator>
      <pubDate>Fri, 20 Nov 2026 22:21:16 +0000</pubDate>
      <link>https://dev.to/swordsec/how-swordcheck-audits-your-macs-security-with-rust-filevault-sip-gatekeeper-and-friends-19on</link>
      <guid>https://dev.to/swordsec/how-swordcheck-audits-your-macs-security-with-rust-filevault-sip-gatekeeper-and-friends-19on</guid>
      <description>&lt;p&gt;&lt;em&gt;Cross-posted from the SwordCheck project (AGPL-3.0) by SwordSec. The binary is read-only: it never changes a setting on your machine.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;We built &lt;strong&gt;SwordCheck&lt;/strong&gt; — a small Rust CLI that gives your Mac a security check-up and scores the results out of 100. It is free and open source: &lt;a href="https://github.com/SwordSec/SwordCheck" rel="noopener noreferrer"&gt;github.com/SwordSec/SwordCheck&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;This post is about the parts we think are interesting beyond the tool itself: how the checks work, how we keep them testable, and what the supply-chain scans look at.&lt;/p&gt;

&lt;h2&gt;
  
  
  The audit: 17 checks, one score
&lt;/h2&gt;

&lt;p&gt;Each check inspects one security setting on macOS — FileVault, SIP, Gatekeeper, the firewall and its stealth mode, Remote Login, sharing services, AirDrop visibility, automatic login, the guest account, screen lock, passwordless sudo, launch items, XProtect signatures, pending updates, and more.&lt;/p&gt;

&lt;p&gt;Every check has a &lt;strong&gt;weight&lt;/strong&gt; (FileVault is 25, Gatekeeper 15, ...) and maps to a section of the &lt;a href="https://www.cisecurity.org/cis-benchmarks" rel="noopener noreferrer"&gt;CIS Apple macOS benchmark&lt;/a&gt;. A &lt;code&gt;Pass&lt;/code&gt; earns the full weight, &lt;code&gt;Warn&lt;/code&gt; half, &lt;code&gt;Fail&lt;/code&gt; nothing; the sum becomes a score out of 100 with A–F grades.&lt;/p&gt;

&lt;p&gt;Two rules we kept from the start:&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;
&lt;strong&gt;A check never passes on a guess.&lt;/strong&gt; If the command it runs fails, times out or prints something we did not expect, the result is &lt;code&gt;Unknown&lt;/code&gt; with the raw output attached — &lt;code&gt;Unknown&lt;/code&gt; results are excluded from the denominator instead of being counted as good.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;The tool never changes a setting.&lt;/strong&gt; Where a fix is a single correct command, the report prints that command for you to run yourself. For things like FileVault or SIP the advice names the exact place in System Settings or Recovery.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Testability: &lt;code&gt;CommandRunner&lt;/code&gt; and &lt;code&gt;MockRunner&lt;/code&gt;
&lt;/h2&gt;

&lt;p&gt;Checks shell out a lot (&lt;code&gt;fdesetup&lt;/code&gt;, &lt;code&gt;csrutil&lt;/code&gt;, &lt;code&gt;spctl&lt;/code&gt;, &lt;code&gt;defaults&lt;/code&gt;, ...). To keep that honest, every check talks to the system through one trait:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight rust"&gt;&lt;code&gt;&lt;span class="c1"&gt;// src/checks/mod.rs (simplified)&lt;/span&gt;
&lt;span class="k"&gt;pub&lt;/span&gt; &lt;span class="k"&gt;trait&lt;/span&gt; &lt;span class="nc"&gt;Check&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;fn&lt;/span&gt; &lt;span class="nf"&gt;id&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;&amp;amp;&lt;/span&gt;&lt;span class="nb"&gt;self&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&lt;/span&gt;&lt;span class="kt"&gt;'static&lt;/span&gt; &lt;span class="kt"&gt;str&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="k"&gt;fn&lt;/span&gt; &lt;span class="nf"&gt;weight&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;&amp;amp;&lt;/span&gt;&lt;span class="nb"&gt;self&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt; &lt;span class="kt"&gt;u32&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="k"&gt;fn&lt;/span&gt; &lt;span class="nf"&gt;run&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="o"&gt;&amp;amp;&lt;/span&gt;&lt;span class="nb"&gt;self&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="n"&gt;r&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="o"&gt;&amp;amp;&lt;/span&gt;&lt;span class="k"&gt;dyn&lt;/span&gt; &lt;span class="nc"&gt;CommandRunner&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="o"&gt;-&amp;gt;&lt;/span&gt; &lt;span class="nc"&gt;CheckResult&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;In tests the runner is a &lt;code&gt;MockRunner&lt;/code&gt; with canned stdout, so &lt;code&gt;csrutil status&lt;/code&gt; returning "Disabled" produces the same &lt;code&gt;CheckResult&lt;/code&gt; in CI as it does on a machine. Adding a new check is: implement &lt;code&gt;Check&lt;/code&gt;, register it. The end-to-end tests in &lt;code&gt;tests/cli.rs&lt;/code&gt; run the real binary against a temporary home directory.&lt;/p&gt;

&lt;h2&gt;
  
  
  The supply-chain scans
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;npm malware:&lt;/strong&gt; a built-in incident list (event-stream, ua-parser-js, chalk/debug, Nx, Shai-Hulud, ...) plus OSV.dev malicious-package records with &lt;code&gt;--online&lt;/code&gt;. It reads &lt;code&gt;package.json&lt;/code&gt; files and never executes package code; suspicious &lt;code&gt;preinstall&lt;/code&gt;/&lt;code&gt;postinstall&lt;/code&gt; scripts (download-and-execute, reverse shells, credential reads) are flagged heuristically.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Vulnerabilities:&lt;/strong&gt; lockfiles (Cargo.lock, package-lock.json, yarn.lock, pnpm-lock.yaml, requirements*.txt, poetry.lock, uv.lock, ...) are matched against OSV.dev; macOS, common apps and Homebrew formulae against NVD, filtered to known-exploited CVEs and ranked with CISA KEV and EPSS — so the top of the report is what is being exploited in the wild, not what merely exists.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Secrets:&lt;/strong&gt; API keys in &lt;code&gt;.env&lt;/code&gt;, &lt;code&gt;.tfvars&lt;/code&gt;, &lt;code&gt;~/.aws/credentials&lt;/code&gt;, &lt;code&gt;~/.npmrc&lt;/code&gt;, &lt;code&gt;~/.docker/config.json&lt;/code&gt;, shell history, Claude/Cursor/VS Code settings and more. Values are always masked — at most the provider's public prefix and the last 2–4 characters are shown.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Everything is offline by default; &lt;code&gt;--online&lt;/code&gt; sends only package names and versions, never paths or file contents.&lt;/p&gt;

&lt;h2&gt;
  
  
  The dashboard
&lt;/h2&gt;

&lt;p&gt;Run without arguments, SwordCheck opens a &lt;code&gt;ratatui&lt;/code&gt; dashboard: pick a module, watch the progress bar, browse findings with details on the right. The TUI and the CLI both consume the same progress events, so &lt;code&gt;--vulns --online&lt;/code&gt; phases print to stderr exactly what the dashboard shows. &lt;code&gt;--report report.html&lt;/code&gt; writes a single self-contained HTML page (styles inline, nothing loaded from the network) with a "Fix these first" list ordered by risk.&lt;/p&gt;

&lt;h2&gt;
  
  
  Try it
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;curl -fsSL https://raw.githubusercontent.com/SwordSec/SwordCheck/main/install.sh &lt;span class="o"&gt;|&lt;/span&gt; sh
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;or build from source with &lt;code&gt;cargo install --path .&lt;/code&gt;. The installer verifies a SHA-256 and never uses sudo.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Honest limits:&lt;/strong&gt; the release binary is not notarized yet (a browser download needs one-time approval in Privacy &amp;amp; Security; the curl script avoids that), it covers baseline configuration rather than a full security assessment, and it is macOS-only for now — Linux and Windows are planned.&lt;/p&gt;

&lt;p&gt;Feedback, bug reports and PRs are very welcome. If you try it and something looks wrong or a check behaves oddly on your machine, that is exactly the kind of issue we want.&lt;/p&gt;

</description>
      <category>security</category>
      <category>macos</category>
      <category>rust</category>
      <category>opensource</category>
    </item>
  </channel>
</rss>
