narcx 0.0.0-stage β 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +137 -2
- package/assets/fonts/IBMPlexMono-Bold.ttf +0 -0
- package/assets/fonts/IBMPlexMono-Italic.ttf +0 -0
- package/assets/fonts/IBMPlexMono-Regular.ttf +0 -0
- package/assets/fonts/IBMPlexSans-Bold.ttf +0 -0
- package/assets/fonts/IBMPlexSans-Regular.ttf +0 -0
- package/assets/fonts/IBMPlexSans-SemiBold.ttf +0 -0
- package/assets/fonts/LICENSE-OFL.txt +93 -0
- package/dist/cli.js +2644 -0
- package/dist/preload.cjs +493 -0
- package/dist/shady-ai-tool.cjs +163 -0
- package/package.json +54 -4
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 arrrshia
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,138 @@
|
|
|
1
|
-
#
|
|
1
|
+
# narc
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+

|
|
4
|
+
|
|
5
|
+
*Claude Code, Codex CLI, T3 Code and Gemini CLI audited with narcx on 2026-11-25: out-of-the-box defaults, no TLS interception, kernel-level file tracing where the binary is native. Grades: D, C, F, F.*
|
|
6
|
+
|
|
7
|
+
> npm package: **`narcx`** Β· installed command: **`narc`**
|
|
8
|
+
|
|
9
|
+
Catch any local CLI tool, AI coding harness or MCP server red-handed when it phones home or reads your dotfiles.
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
npx narcx -- <command> [args...]
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
`narc` wraps the command, watches it from three angles at once, prints live `[NARC π¨]` alerts on stderr while the tool runs, and finishes with a box-drawn **Privacy Scorecard** (plus an optional shareable PNG and a JSON audit log). It needs no sudo, never terminates TLS, and makes zero outbound network calls of its own.
|
|
16
|
+
|
|
17
|
+
```
|
|
18
|
+
ββ NARC Β· PRIVACY SCORECARD ββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
|
19
|
+
β $ shady-ai-tool (narc --demo fixture) ββββββ β
|
|
20
|
+
β exit 0 Β· 1.1s Β· layers: proxy, preload, lsof β F β β
|
|
21
|
+
β score 0/100 (13 deductions) ββββββ β
|
|
22
|
+
ββ SENSITIVE FILES TOUCHED (8) βββββββββββββββββββββββββββββββββββββββββββββββββ€
|
|
23
|
+
β β ~/.ssh/id_rsa SSH keys createReadStreamΓ1 openΓ1 β
|
|
24
|
+
β β ~/.aws/credentials AWS credentials promises.readFileΓ1 β
|
|
25
|
+
β β ~/.claude.json Claude Code config readFileSyncΓ1 β
|
|
26
|
+
ββ OUTBOUND (7 hosts) ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ€
|
|
27
|
+
β TELEMETRY (4) β
|
|
28
|
+
β β us.i.posthog.com 2 req 698 B β 332 B β via hook POST /batch/ β
|
|
29
|
+
β β metrics.shady-ai.dev 1 req 1.3 KB β 0 B β via proxy β
|
|
30
|
+
β UNKNOWN (1) β
|
|
31
|
+
β β² cdn.shady-ai.dev 1 req 92 B β 166 B β via hook GET /updateβ¦ β
|
|
32
|
+
β LLM API (2) β
|
|
33
|
+
β β api.anthropic.com 1 req 188 B β 166 B β via hook POST /v1/mesβ¦ β
|
|
34
|
+
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
## Try it in ten seconds
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
npx narcx --demo --card ./demo-report.png
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
`--demo` runs a built-in mock "shady-ai-tool" against a throwaway fake HOME full of decoy secrets. Every "vendor" it contacts is a loopback sink, so nothing leaves your machine, yet every layer fires and you get an `F`.
|
|
44
|
+
|
|
45
|
+
## Usage
|
|
46
|
+
|
|
47
|
+
```bash
|
|
48
|
+
npm i -g narcx # or just use npx narcx
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
```
|
|
52
|
+
narc [options] -- <command> [args...]
|
|
53
|
+
|
|
54
|
+
--card [path] Save a 1200x675 dark-mode Privacy Scorecard PNG (default ./narc-report.png)
|
|
55
|
+
--json [path] Export the raw audit log as JSON (default ./narc-report.json)
|
|
56
|
+
--deep Kernel-level tracing: fs_usage on macOS (asks for sudo), strace -f on Linux
|
|
57
|
+
--demo Run the built-in mock shady-ai-tool
|
|
58
|
+
--render <json> Re-render the scorecard (terminal + --card PNG) from a saved --json report
|
|
59
|
+
-v, --verbose Also show LLM API traffic, other dotfile reads and repeat requests live
|
|
60
|
+
-q, --quiet No live alerts, only the exit scorecard
|
|
61
|
+
--no-lsof Disable the lsof socket poller
|
|
62
|
+
--interval <ms> lsof poll interval (default 150)
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
Examples:
|
|
66
|
+
|
|
67
|
+
```bash
|
|
68
|
+
narc -- npx some-ai-cli --help
|
|
69
|
+
narc --card --json -- claude -p "summarise this repo"
|
|
70
|
+
narc -v -- node ./my-mcp-server.js
|
|
71
|
+
narc --deep -- ./some-go-binary serve
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
The child's stdin/stdout/stderr are inherited untouched, so interactive tools keep working. `narc` exits with the child's exit code (or `128 + signal`). Ctrl-C is forwarded to the child; a second Ctrl-C kills it.
|
|
75
|
+
|
|
76
|
+
## How it watches (no sudo required)
|
|
77
|
+
|
|
78
|
+
| Layer | Mechanism | What it sees |
|
|
79
|
+
| --- | --- | --- |
|
|
80
|
+
| 1. Proxy sniffer | Ephemeral HTTP + HTTPS `CONNECT` proxy on `127.0.0.1`, injected via `HTTP_PROXY` / `HTTPS_PROXY` / `ALL_PROXY` (and lower-case twins, `NO_PROXY=""`, `NODE_USE_ENV_PROXY=1`) | Plain HTTP: host, method, path, bytes. HTTPS: `CONNECT` host, port and tunnel byte volume only. TLS is never broken, so cert pinning keeps working. |
|
|
81
|
+
| 2. Preload hook | A tiny CommonJS script injected with `NODE_OPTIONS="--require β¦"` (existing `NODE_OPTIONS` preserved). Patches `fs.readFile`, `readFileSync`, `open`, `openSync`, `createReadStream`, `readdir(Sync)`, `fs.promises.readFile/open/readdir`, `http(s).request/get`, `globalThis.fetch` and `dns.lookup`. Streams NDJSON events to narc over a Unix domain socket (loopback TCP fallback). | Exact full URLs including paths like `/v1/ingest`, methods, request/response byte sizes, and exact sensitive file paths in any Node child or grandchild. Zero cert errors. |
|
|
82
|
+
| 3. OS fallback | `lsof -i -n -P` polled every 150 ms over the child's process tree (`-n -P` so lsof itself never does DNS). With `--deep`: `strace -f -e trace=openat,connect` on Linux, `fs_usage -w -f filesys` on macOS. | Raw sockets from Go/Rust/Python binaries that ignore proxy env vars; with `--deep`, file opens from any binary. |
|
|
83
|
+
|
|
84
|
+
Events from several layers about the same host are merged. Request counts and bytes come from the highest-fidelity source that saw the host (hook > proxy > strace/fs_usage > lsof), and the scorecard tells you which (`via hook+lsof`). IPs seen only by lsof are mapped back to hostnames when the hook observed the DNS lookup; otherwise they are listed as the bare IP.
|
|
85
|
+
|
|
86
|
+
All child processes, temp files, the proxy and the IPC socket are torn down on exit, `SIGINT`, `SIGTERM` and `SIGHUP`.
|
|
87
|
+
|
|
88
|
+
## What gets flagged
|
|
89
|
+
|
|
90
|
+
**Sensitive file watchlist** (HIGH): `~/.claude.json`, `~/.claude/**`, `~/.codex/**`, `~/.cursor/**`, `~/.gemini/**`, `~/.config/opencode/**`, `~/.local/share/opencode/**`, `~/.config/gh/**`, `~/.ssh/**`, `~/.aws/**`, `~/.gitconfig`, `~/.npmrc`, `~/.netrc`, `~/.pypirc`, `.env`, `.env.*` (anywhere), `~/.gnupg/**`, `~/.docker/config.json`, `~/.kube/**`, `~/.config/gcloud/**`, macOS keychains, and Chrome/Chromium/Brave/Edge/Arc/Firefox/Safari cookie and login stores.
|
|
91
|
+
|
|
92
|
+
When the command is a package runner (`npx`, `pnpm dlx`, `bunx`, `uvx`, β¦), the runner's own activity (registry lookups, `~/.npmrc`, `~/.gitconfig`) is attributed by pid, shown dimmed as `via npx Β· not graded`, and excluded from the grade. Anything the tool's own processes do is still graded.
|
|
93
|
+
|
|
94
|
+
Coding agents (`claude`, `codex`, `gemini`, `cursor`, `opencode`, `t3`, `aider`, `copilot`, β¦) may read `~/.gitconfig` without penalty: git identity is part of their job, exactly as it is for `git` itself. Every other tool reading it is still flagged. `--regrade report.json` re-derives a saved report's summaries and grade from its recorded events under the current rules, so old audits can be re-scored after a rules change without re-running the tool.
|
|
95
|
+
|
|
96
|
+
Reads inside the tool's **own namespace** are listed with an `OWN CONFIG` label and not penalised: running `claude` may read `~/.claude.json`, `gh` may read `~/.config/gh`, `git` may read `~/.gitconfig` and `~/.ssh`, `npm`/`npx` may read `~/.npmrc`, and so on. Other dotfiles under `~` are kept in the JSON as low-priority context.
|
|
97
|
+
|
|
98
|
+
**Domain classifier**
|
|
99
|
+
|
|
100
|
+
- Loopback (`127.0.0.1`, `::1`, `localhost`) is never an outbound host and is dropped entirely.
|
|
101
|
+
- `LLM` (never penalised): `api.anthropic.com`, `mcp-proxy.anthropic.com`, `api.openai.com`, `chatgpt.com`, `generativelanguage.googleapis.com`, `cloudcode-pa.googleapis.com`, `openrouter.ai`, `api.githubcopilot.com` and a few other model backends, matched exactly or as subdomains.
|
|
102
|
+
- `AUTH` (never penalised): `oauth2.googleapis.com`, `accounts.google.com`, `auth.openai.com`, `console.anthropic.com`, β¦
|
|
103
|
+
- `TELEMETRY` (red, β25 each): `posthog.com`, `sentry.io`, `segment.io`, `segment.com`, `mixpanel.com`, `amplitude.com`, `datadoghq.com`, vendor metrics endpoints such as `ab.chatgpt.com` (Codex's Statsig/OTLP endpoint) and `play.googleapis.com` (Google Clearcut), observability/error-reporting vendors (`grafana.net`, `honeycomb.io`, `newrelic.com`, `bugsnag.com`, `axiom.co`, `google-analytics.com`, β¦) and their subdomains; any host with a `telemetry`, `ingest`, `analytics`, `metrics`, `statsig`, `launchdarkly`, `otlp` or `otel` label; and generic hosts on known logging paths when the path is visible. Telemetry rules win over the LLM list, so `ab.chatgpt.com` is red while `chatgpt.com` is not.
|
|
104
|
+
- `OTHER` (yellow, β10 each): everything else, including package registries and update servers. Decide for yourself.
|
|
105
|
+
- Raw IPs seen only by the lsof poller while the proxy was already naming hosts in the same run are reported as *suppressed* and not graded: they are almost always the same connections seen twice.
|
|
106
|
+
|
|
107
|
+
**Grade**: start at 100, then β25 per telemetry host, β30 per sensitive file read outside the tool's own namespace, β10 per unknown host. `A+` 100 Β· `A` 90+ Β· `B` 80+ Β· `C` 65+ Β· `D` 50+ Β· `F` below 50.
|
|
108
|
+
|
|
109
|
+
## Honest file-read coverage
|
|
110
|
+
|
|
111
|
+
The preload hook only sees Node processes. If the audited tool is a native (Bun/Rust) binary and `--deep` is off, narc reports **file reads not traced** rather than a clean sheet, the `3RD-PARTY SECRETS` metric shows `β`, and the JSON carries `fileTracing: { mode, coverage, untraced }`. A Node wrapper around a native binary (Codex) is reported as *partial* with the unhooked executable named.
|
|
112
|
+
|
|
113
|
+
## The PNG scorecard
|
|
114
|
+
|
|
115
|
+
`--card` renders a 1200Γ675 Swiss-editorial audit sheet: warm paper (`#F4F1EA`), hairline rules, tabular IBM Plex Mono data, vermilion only for telemetry, third-party secret reads and D/F grades. Hand-built SVG rasterised with `@resvg/resvg-js`; no Puppeteer, Playwright or canvas binaries. IBM Plex Sans and IBM Plex Mono (SIL OFL) are bundled in `assets/fonts/` and passed to resvg explicitly so the card renders identically on every machine. `--title "Claude Code 2.1.323"` sets the sheet's headline; `--render report.json --card out.png` re-renders a saved report.
|
|
116
|
+
|
|
117
|
+
## Guardrails
|
|
118
|
+
|
|
119
|
+
- `narc` makes no outbound network calls. Everything binds to `127.0.0.1`; `lsof` runs with `-n -P`; no reverse DNS, no update checks, no telemetry. Audit it: `grep -rn "http" src/` finds only the local proxy and the demo sinks.
|
|
120
|
+
- Two runtime dependencies: `picocolors` and `@resvg/resvg-js`, plus ~1 MB of bundled OFL fonts.
|
|
121
|
+
- The preload hook never throws into the host program. Every patch is wrapped so a failure inside narc falls through to the original call.
|
|
122
|
+
|
|
123
|
+
## Limitations worth knowing
|
|
124
|
+
|
|
125
|
+
- Node's built-in `fetch` and `http` ignore proxy env vars before Node 24, which is why layer 2 exists. Non-Node tools that ignore proxies are only seen by `lsof` (host IP, port, no path), or by `--deep`.
|
|
126
|
+
- `lsof` polling can miss connections shorter than the poll interval. Lower `--interval` if you need more; it costs one `ps` and one `lsof` spawn per tick.
|
|
127
|
+
- Bytes for `CONNECT` tunnels are TLS record bytes, slightly larger than the payload. Bytes from the hook are plaintext request/response bytes on the socket.
|
|
128
|
+
- `--deep` on macOS: `fs_usage` cannot follow forks, so narc traces system-wide and filters by process name, the only identity `fs_usage` prints. Another process with the same name as something in the child's tree can be mis-attributed. Paths wider than the `fs_usage` column are left-trimmed and rebuilt under `$HOME`. If you run `sudo narc --deep β¦`, the traced command is spawned as `$SUDO_USER` with that user's HOME.
|
|
129
|
+
- `--deep` on Linux needs `ptrace` permission (often blocked in containers); narc checks and falls back silently.
|
|
130
|
+
|
|
131
|
+
## Development
|
|
132
|
+
|
|
133
|
+
```bash
|
|
134
|
+
npm install
|
|
135
|
+
npm run build # tsup -> dist/cli.js (ESM, shebang), dist/preload.cjs, dist/shady-ai-tool.cjs
|
|
136
|
+
npm test # vitest: classifier, watchlist matcher, grading, collector, lsof/strace/fs_usage parsers
|
|
137
|
+
npm run demo # node dist/cli.js --demo --card ./demo-report.png
|
|
138
|
+
```
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
Copyright Β© 2017 IBM Corp. with Reserved Font Name "Plex"
|
|
2
|
+
|
|
3
|
+
This Font Software is licensed under the SIL Open Font License, Version 1.1.
|
|
4
|
+
|
|
5
|
+
This license is copied below, and is also available with a FAQ at: http://scripts.sil.org/OFL
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
-----------------------------------------------------------
|
|
9
|
+
SIL OPEN FONT LICENSE Version 1.1 - 26 February 2007
|
|
10
|
+
-----------------------------------------------------------
|
|
11
|
+
|
|
12
|
+
PREAMBLE
|
|
13
|
+
The goals of the Open Font License (OFL) are to stimulate worldwide
|
|
14
|
+
development of collaborative font projects, to support the font creation
|
|
15
|
+
efforts of academic and linguistic communities, and to provide a free and
|
|
16
|
+
open framework in which fonts may be shared and improved in partnership
|
|
17
|
+
with others.
|
|
18
|
+
|
|
19
|
+
The OFL allows the licensed fonts to be used, studied, modified and
|
|
20
|
+
redistributed freely as long as they are not sold by themselves. The
|
|
21
|
+
fonts, including any derivative works, can be bundled, embedded,
|
|
22
|
+
redistributed and/or sold with any software provided that any reserved
|
|
23
|
+
names are not used by derivative works. The fonts and derivatives,
|
|
24
|
+
however, cannot be released under any other type of license. The
|
|
25
|
+
requirement for fonts to remain under this license does not apply
|
|
26
|
+
to any document created using the fonts or their derivatives.
|
|
27
|
+
|
|
28
|
+
DEFINITIONS
|
|
29
|
+
"Font Software" refers to the set of files released by the Copyright
|
|
30
|
+
Holder(s) under this license and clearly marked as such. This may
|
|
31
|
+
include source files, build scripts and documentation.
|
|
32
|
+
|
|
33
|
+
"Reserved Font Name" refers to any names specified as such after the
|
|
34
|
+
copyright statement(s).
|
|
35
|
+
|
|
36
|
+
"Original Version" refers to the collection of Font Software components as
|
|
37
|
+
distributed by the Copyright Holder(s).
|
|
38
|
+
|
|
39
|
+
"Modified Version" refers to any derivative made by adding to, deleting,
|
|
40
|
+
or substituting -- in part or in whole -- any of the components of the
|
|
41
|
+
Original Version, by changing formats or by porting the Font Software to a
|
|
42
|
+
new environment.
|
|
43
|
+
|
|
44
|
+
"Author" refers to any designer, engineer, programmer, technical
|
|
45
|
+
writer or other person who contributed to the Font Software.
|
|
46
|
+
|
|
47
|
+
PERMISSION & CONDITIONS
|
|
48
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
|
49
|
+
a copy of the Font Software, to use, study, copy, merge, embed, modify,
|
|
50
|
+
redistribute, and sell modified and unmodified copies of the Font
|
|
51
|
+
Software, subject to the following conditions:
|
|
52
|
+
|
|
53
|
+
1) Neither the Font Software nor any of its individual components,
|
|
54
|
+
in Original or Modified Versions, may be sold by itself.
|
|
55
|
+
|
|
56
|
+
2) Original or Modified Versions of the Font Software may be bundled,
|
|
57
|
+
redistributed and/or sold with any software, provided that each copy
|
|
58
|
+
contains the above copyright notice and this license. These can be
|
|
59
|
+
included either as stand-alone text files, human-readable headers or
|
|
60
|
+
in the appropriate machine-readable metadata fields within text or
|
|
61
|
+
binary files as long as those fields can be easily viewed by the user.
|
|
62
|
+
|
|
63
|
+
3) No Modified Version of the Font Software may use the Reserved Font
|
|
64
|
+
Name(s) unless explicit written permission is granted by the corresponding
|
|
65
|
+
Copyright Holder. This restriction only applies to the primary font name as
|
|
66
|
+
presented to the users.
|
|
67
|
+
|
|
68
|
+
4) The name(s) of the Copyright Holder(s) or the Author(s) of the Font
|
|
69
|
+
Software shall not be used to promote, endorse or advertise any
|
|
70
|
+
Modified Version, except to acknowledge the contribution(s) of the
|
|
71
|
+
Copyright Holder(s) and the Author(s) or with their explicit written
|
|
72
|
+
permission.
|
|
73
|
+
|
|
74
|
+
5) The Font Software, modified or unmodified, in part or in whole,
|
|
75
|
+
must be distributed entirely under this license, and must not be
|
|
76
|
+
distributed under any other license. The requirement for fonts to
|
|
77
|
+
remain under this license does not apply to any document created
|
|
78
|
+
using the Font Software.
|
|
79
|
+
|
|
80
|
+
TERMINATION
|
|
81
|
+
This license becomes null and void if any of the above conditions are
|
|
82
|
+
not met.
|
|
83
|
+
|
|
84
|
+
DISCLAIMER
|
|
85
|
+
THE FONT SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
86
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO ANY WARRANTIES OF
|
|
87
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT
|
|
88
|
+
OF COPYRIGHT, PATENT, TRADEMARK, OR OTHER RIGHT. IN NO EVENT SHALL THE
|
|
89
|
+
COPYRIGHT HOLDER BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
|
|
90
|
+
INCLUDING ANY GENERAL, SPECIAL, INDIRECT, INCIDENTAL, OR CONSEQUENTIAL
|
|
91
|
+
DAMAGES, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
|
92
|
+
FROM, OUT OF THE USE OR INABILITY TO USE THE FONT SOFTWARE OR FROM
|
|
93
|
+
OTHER DEALINGS IN THE FONT SOFTWARE.
|