@misconfig/cli 1.4.0 → 1.5.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/CHANGELOG.md +16 -0
- package/README.md +113 -8
- package/bin/misconfig.js +0 -0
- package/engine/catalog.js +94 -1
- package/engine/index.js +49 -58
- package/engine/templates.js +236 -0
- package/lib/findings.js +4 -1
- package/lib/formats.js +158 -0
- package/lib/html.js +4 -1
- package/lib/main.js +63 -14
- package/lib/package-update.js +1 -1
- package/lib/print.js +37 -11
- package/lib/rule-files.js +63 -0
- package/package.json +1 -1
- package/report/styles.css +6 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 1.5.0
|
|
4
|
+
|
|
5
|
+
- `--jsonl` prints the findings as JSON Lines: one finding on each line, worst first, with the same keys every time, for jq, grep and log collectors. The README lists the keys, and a 1.x release won't rename or remove one. Marks that reorder text, and characters that some programs treat as line breaks, are written as `\u` escapes, so a checked file can't add a line or change how one reads on screen.
|
|
6
|
+
- `--sarif FILE` also saves the findings as SARIF 2.1.0, for GitHub code scanning and other SARIF viewers. The report prints as before. Critical and high findings are errors, medium ones are warnings, and low and info ones are notes, and each rule's security severity sits in GitHub's band for its level. Files are named from the checked folder, and files in your home folder from `HOME`, not by their full paths. A check that stopped early is marked unfinished.
|
|
7
|
+
- The SARIF file is written under another name and moved into place. In a project from someone else, a link left at that path is replaced, not followed into another file.
|
|
8
|
+
- A GitHub Action, `gkdataio/misconfig`, runs the check from this repository at the commit or tag a workflow names. Nothing is fetched from npm. It checks only the repository, saves the SARIF file and names it as an output for `github/codeql-action/upload-sarif`, unless the check failed or stopped early: uploading a partial file would mark the findings it didn't reach as fixed.
|
|
9
|
+
- A name in a checked file can't give a CI system a command through the log. GitHub Actions reads `##[name]` anywhere in a line and `::name::` at the start of one, Azure Pipelines reads `##vso[name]`, and TeamCity reads `##teamcity[name]`. Where a name spells one, the report shows � inside it, and `--json`, `--jsonl` and SARIF write it with a `\u` escape that parsers read back unchanged. Earlier versions printed such a name as written, so a project could add an annotation to a CI run or mask text in its log, and on Azure Pipelines set a variable.
|
|
10
|
+
- While the action's report prints, GitHub is also told to read no workflow commands, as a second guard.
|
|
11
|
+
- Every rule has a name that needs no finding to fill it in, such as "An MCP server runs an unpinned package". SARIF lists rules by it.
|
|
12
|
+
- `--rules FILE` adds a team's own rules to a check, from a JSON file. A rule names the settings files it reads and what in them makes a finding, and brings its own wording. Its findings are in every kind of output, take points off the score and count for `--fail-on`. `docs/rules.md` explains the format, which may still change, and `examples/rules/company.json` is a file to start from.
|
|
13
|
+
- A rule of your own can only add a finding. It can't run anything, read a file misconfig doesn't already read, or hide what a built-in rule finds, and rules are never taken from a checked project. It holds no regular expression: its files are paths and its tests compare text, so a rules file can't be written to stall a check.
|
|
14
|
+
- Six built-in rules are now written in the same form, as data in `engine/templates.js`: `CU-NO-SANDBOX`, `ZED-ALWAYS-ALLOW`, `ZED-TRUST-ALL`, `CL-YOLO`, `CL-AUTO-COMMANDS` and `AMP-ALLOW-ALL`. They find what they found before.
|
|
15
|
+
- A project that defines MCP servers by the ten thousand no longer holds a check up for minutes. The time spent listing each agent's servers grew with the square of their number.
|
|
16
|
+
- `examples/github-actions/code-scanning.yml` is a workflow that runs the action and sends its findings to code scanning. Both example workflows stop a job after ten minutes.
|
|
17
|
+
- The repository runs its tests on every push and pull request, on Linux, macOS and Windows with Node.js 18, 20, 22 and 24, and checks itself with its own action. Issues have a form for each kind of report in CONTRIBUTING.md.
|
|
18
|
+
|
|
3
19
|
## 1.4.0
|
|
4
20
|
|
|
5
21
|
- An optional `--attribute` scan matches existing Claude Code and Codex file-edit records to observed settings. `--i-edited` records a personal claim. The timeline shows the editor evidence alongside the approving account.
|
package/README.md
CHANGED
|
@@ -11,11 +11,28 @@
|
|
|
11
11
|
|
|
12
12
|
# misconfig
|
|
13
13
|
|
|
14
|
-
misconfig checks the settings that control Claude Code, Codex and other coding agents. It shows which file sets a permission, starts an MCP server or runs a hook, explains the risk, and gives you a fix. Version 1.
|
|
14
|
+
misconfig checks the settings that control Claude Code, Codex and other coding agents. It shows which file sets a permission, starts an MCP server or runs a hook, explains the risk, and gives you a fix. Version 1.5 adds JSON Lines and SARIF output and a GitHub Action, so findings can go to scripts, log collectors and GitHub code scanning.
|
|
15
15
|
|
|
16
16
|
To hear when a release ships, choose **Watch → Custom → Releases** on the [GitHub repository](https://github.com/gkdataio/misconfig), or subscribe to the [release feed](https://github.com/gkdataio/misconfig/releases.atom). These channels also work for people who keep using 1.3.2.
|
|
17
17
|
|
|
18
|
-
## New in 1.
|
|
18
|
+
## New in 1.5
|
|
19
|
+
|
|
20
|
+
Findings can now go to other programs. The report you read is the same.
|
|
21
|
+
|
|
22
|
+
```sh
|
|
23
|
+
npx @misconfig/cli@1.5.0 --jsonl
|
|
24
|
+
npx @misconfig/cli@1.5.0 --sarif misconfig.sarif
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
`--jsonl` prints the findings as JSON Lines: one finding on each line, worst first, for `jq`, `grep` and log collectors. [Findings as JSON Lines](https://github.com/gkdataio/misconfig#findings-as-json-lines) lists what each line holds.
|
|
28
|
+
|
|
29
|
+
`--sarif FILE` also saves the findings as SARIF 2.1.0, the format GitHub code scanning and other viewers read. The report still prints.
|
|
30
|
+
|
|
31
|
+
On GitHub, the new action runs the check from this repository at the commit or tag your workflow names, without fetching anything from npm, and saves the SARIF file for code scanning. [In CI](https://github.com/gkdataio/misconfig#in-ci) has the workflow.
|
|
32
|
+
|
|
33
|
+
`--rules FILE` adds rules of your own to the check, for what your team's policy says about agent settings. [Your own rules](https://github.com/gkdataio/misconfig#your-own-rules) shows one.
|
|
34
|
+
|
|
35
|
+
## Computer review
|
|
19
36
|
|
|
20
37
|
The demo requires CLI 1.4 or newer and Node.js 18 or later. Try it on a sample profile. On Windows, use `npx.cmd` if PowerShell blocks `npx`.
|
|
21
38
|
|
|
@@ -28,9 +45,9 @@ The demo changes a sample calendar server from 1.2.3 to 1.2.4. A sample Codex re
|
|
|
28
45
|
### Review your computer
|
|
29
46
|
|
|
30
47
|
```sh
|
|
31
|
-
npx @misconfig/cli@1.
|
|
32
|
-
npx @misconfig/cli@1.
|
|
33
|
-
npx @misconfig/cli@1.
|
|
48
|
+
npx @misconfig/cli@1.5.0
|
|
49
|
+
npx @misconfig/cli@1.5.0 --review
|
|
50
|
+
npx @misconfig/cli@1.5.0 --history
|
|
34
51
|
```
|
|
35
52
|
|
|
36
53
|
Your first scan lists the settings available for review. **Since your last scan** shows later additions, edits and removals. **Awaiting your approval** also includes changes you skipped. The same local history follows you across project folders.
|
|
@@ -45,11 +62,11 @@ misconfig compares the computer and administrator settings it discovers, includi
|
|
|
45
62
|
|
|
46
63
|
### Who changed a setting?
|
|
47
64
|
|
|
48
|
-
Run `npx @misconfig/cli@1.
|
|
65
|
+
Run `npx @misconfig/cli@1.5.0 --offline --attribute` to match observed edits against local Claude Code or Codex records. This works after approval, too. To read particular sessions, pass `--session "path/to/session.jsonl"` for each one.
|
|
49
66
|
|
|
50
67
|
An agent attribution requires a completed file tool, the same file, the exact change to the setting, and a tool timestamp between the two scans. Supported records include Claude Code’s Edit and Write results and Codex’s completed file changes with numbered diffs. Reconstructed patches must also match the saved file fingerprints. A shell command, file owner, or nearby agent session alone leaves the author unknown. A matching record identifies a recorded edit. Other unlogged writes can produce the same setting, and local records are editable.
|
|
51
68
|
|
|
52
|
-
If you made an edit yourself, use its `e-` ID from `--history`. For example, `npx @misconfig/cli@1.
|
|
69
|
+
If you made an edit yourself, use its `e-` ID from `--history`. For example, `npx @misconfig/cli@1.5.0 --i-edited e-4` records your OS account as **self-reported**. Conflicting sources appear as uncertain. An edit with no matching evidence stays **Edit author unknown**.
|
|
53
70
|
|
|
54
71
|
Session records can contain private conversations and tool inputs. Only `--attribute` or `--session` reads them on your computer. Automatic discovery searches the last seven days in Claude’s projects and Codex’s sessions and archived sessions, honoring their config directory overrides. The search reads up to 48 local files, 4 MiB from the end of each, up to 32 MiB total. It reports partial coverage when a limit or read error is encountered. Only matching source labels and timestamps enter the history.
|
|
55
72
|
|
|
@@ -106,26 +123,110 @@ npx @misconfig/cli --lookup # also ask OSV.dev about what's installed
|
|
|
106
123
|
| `--project-only` | Skips the agent settings on this computer |
|
|
107
124
|
| `--fail-on <level>` | Exits with code 1 if it finds anything at that level or worse: `critical`, `high`, `medium` or `low` |
|
|
108
125
|
| `--json` | Prints the full result as JSON |
|
|
126
|
+
| `--jsonl` | Prints the findings as JSON Lines, one finding on each line |
|
|
127
|
+
| `--sarif FILE` | Also saves the findings in `FILE` as SARIF 2.1.0, for GitHub code scanning and other SARIF viewers |
|
|
128
|
+
| `--rules FILE` | Also checks with your own rules from `FILE`. Repeat it for more files |
|
|
109
129
|
| `--yes` | Runs `--lookup` without asking, for scripts |
|
|
110
130
|
| `--help` / `--version` | Print the supported options or installed version |
|
|
111
131
|
|
|
132
|
+
### Findings as JSON Lines
|
|
133
|
+
|
|
134
|
+
```sh
|
|
135
|
+
npx @misconfig/cli --jsonl | jq -r 'select(.severity == "high") | "\(.rule) \(.file):\(.line)"'
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
Each line is one finding:
|
|
139
|
+
|
|
140
|
+
| Key | What it holds |
|
|
141
|
+
| --- | --- |
|
|
142
|
+
| `type` | `finding`. A later release may print other kinds of lines, so select on it |
|
|
143
|
+
| `rule` | The rule's ID, such as `MCP-UNPINNED` |
|
|
144
|
+
| `severity` | `critical`, `high`, `medium`, `low` or `info` |
|
|
145
|
+
| `category` | `permissions`, `mcp`, `instructions`, `hooks`, `workspace` or `installs` |
|
|
146
|
+
| `agent` | The agent it affects, such as `Claude Code`, or `null` |
|
|
147
|
+
| `title`, `why`, `fix` | The finding, in the report's words |
|
|
148
|
+
| `file`, `line` | Where it is. A file in the checked folder is named from that folder, one in your home folder starts with `~/`, and any other has its full path. `null` when a finding isn't about one file or one line |
|
|
149
|
+
| `evidence` | The line the finding points at, with secrets masked, or `null` |
|
|
150
|
+
| `ruleUrl` | The rule at [misconfig.ai/rules](https://misconfig.ai/rules). For one of your own rules, its `reference`, or `null` without one |
|
|
151
|
+
| `checkedAt` | When the check ran, in UTC |
|
|
152
|
+
| `ruleset`, `cli` | The versions of the rules and of the CLI that made the line |
|
|
153
|
+
|
|
154
|
+
A 1.x release can add a key and won't rename or remove one. Every key is always there. Marks that reorder text, and characters that some programs treat as line breaks, are written as `\u` escapes, so a checked file can't add a line or change how one reads on screen. A check that finds nothing prints nothing, and the exit code is the same as without `--jsonl`.
|
|
155
|
+
|
|
156
|
+
### Your own rules
|
|
157
|
+
|
|
158
|
+
A team can add rules for its own policy. `--rules FILE` reads them from a JSON file and checks with them as well as the built-in ones.
|
|
159
|
+
|
|
160
|
+
```sh
|
|
161
|
+
npx @misconfig/cli --rules company-rules.json
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
```json
|
|
165
|
+
{
|
|
166
|
+
"rules": [
|
|
167
|
+
{
|
|
168
|
+
"id": "ACME-GATEWAY",
|
|
169
|
+
"name": "Claude Code doesn't use the company gateway",
|
|
170
|
+
"severity": "high",
|
|
171
|
+
"category": "permissions",
|
|
172
|
+
"why": "env.ANTHROPIC_BASE_URL in {file} isn't the company gateway, so prompts and code leave without its logging and data controls.",
|
|
173
|
+
"fix": "Set env.ANTHROPIC_BASE_URL to https://llm-gateway.acme.example in {file}.",
|
|
174
|
+
"files": ["~/.claude/settings.json"],
|
|
175
|
+
"match": [{ "not": { "path": "env.ANTHROPIC_BASE_URL", "equals": "https://llm-gateway.acme.example" } }]
|
|
176
|
+
}
|
|
177
|
+
]
|
|
178
|
+
}
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
A rule names the settings files it reads and what in them makes a finding. Its findings are in the report, `--json`, `--jsonl` and SARIF like any other. They take points off the score, and `--fail-on` counts them. [The rules format](https://github.com/gkdataio/misconfig/blob/main/docs/rules.md) explains every key, and [`examples/rules/company.json`](https://github.com/gkdataio/misconfig/blob/main/examples/rules/company.json) is a file to start from.
|
|
182
|
+
|
|
183
|
+
A rule can only add a finding. It can't run anything, read a file misconfig doesn't already read, or hide what a built-in rule finds. Rules are read only from the files you name, never from the checked project. In CI, keep the rules file where a pull request can't change it. The format is new in 1.5 and may change before it settles.
|
|
184
|
+
|
|
112
185
|
### In CI
|
|
113
186
|
|
|
114
187
|
After checkout, run a project-only scan before installing the project's dependencies. Pin the CLI version in your workflow. This mode checks repository findings and skips personal approvals and history.
|
|
115
188
|
|
|
116
189
|
```sh
|
|
117
|
-
npx --yes @misconfig/cli@1.
|
|
190
|
+
npx --yes @misconfig/cli@1.5.0 --project-only --fail-on high
|
|
118
191
|
```
|
|
119
192
|
|
|
120
193
|
On GitHub, copy the [example workflow](https://github.com/gkdataio/misconfig/blob/main/examples/github-actions/misconfig.yml) into `.github/workflows/misconfig.yml`. It checks out the repository, sets up Node.js and runs the CLI as a shell step. The `--yes` before the package name lets npx fetch the pinned CLI.
|
|
121
194
|
|
|
195
|
+
To see the findings in the repository's Security tab and on pull requests, use the action with code scanning. Copy the [code scanning workflow](https://github.com/gkdataio/misconfig/blob/main/examples/github-actions/code-scanning.yml) instead:
|
|
196
|
+
|
|
197
|
+
```yaml
|
|
198
|
+
- uses: gkdataio/misconfig@v1.5.0
|
|
199
|
+
id: misconfig
|
|
200
|
+
with:
|
|
201
|
+
fail-on: high
|
|
202
|
+
- uses: github/codeql-action/upload-sarif@915412ff23e8b7659517e607487dbeae018f2934 # v4.39.5
|
|
203
|
+
if: ${{ !cancelled() && steps.misconfig.outputs.sarif != '' }}
|
|
204
|
+
with:
|
|
205
|
+
sarif_file: ${{ steps.misconfig.outputs.sarif }}
|
|
206
|
+
category: misconfig
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
The action runs the CLI from this repository at the commit or tag you name, so nothing is fetched from npm and the checked project can't change what runs. It checks only the repository, never the runner's own settings. Code scanning is available for public repositories, and for organization-owned ones with GitHub Code Security.
|
|
210
|
+
|
|
211
|
+
| Input | What it does |
|
|
212
|
+
| --- | --- |
|
|
213
|
+
| `fail-on` | Fails the step at this level or worse: `critical`, `high` (the default), `medium` or `low`. `none` reports without failing |
|
|
214
|
+
| `path` | The folder the repository is checked out in. Defaults to the workspace |
|
|
215
|
+
| `sarif` | Where to save the SARIF file. Defaults to `misconfig.sarif` in the runner's temp folder |
|
|
216
|
+
|
|
217
|
+
The `sarif` output is the file's path. It's empty when the check failed or stopped early, so a partial file is never uploaded: code scanning would mark the findings it didn't reach as fixed.
|
|
218
|
+
|
|
122
219
|
With `--fail-on high`, exit `0` means the scan finished below the threshold, `1` means a high or critical finding, and `2` means an error or an incomplete scan with no finding at the threshold. An interrupted prompt returns `130`.
|
|
123
220
|
|
|
221
|
+
A name in a checked file can't give the CI system a command through the log. Where one spells a command that GitHub Actions, Azure Pipelines or TeamCity reads from a log, such as `##[error]`, the report shows � inside it and JSON output writes it with a `\u` escape. The action also tells GitHub to read no workflow commands while the report prints.
|
|
222
|
+
|
|
124
223
|
## Privacy
|
|
125
224
|
|
|
126
225
|
- Computer scans save review history under `~/.misconfig/computer-v1/`. It contains paths, labels, short summaries, keyed fingerprints, observation times and review decisions. The OS account that owns the files can edit them. `--no-history` skips this storage. HTML and JSON reports can include paths and reviewer names, so check the contents before sharing them.
|
|
127
226
|
- The malware-list request to misconfig.ai carries the CLI version and operating system family. Interactive computer scans also check the public package version on npm. `--offline` skips both requests, and `DO_NOT_TRACK=1` keeps the malware-list request from being counted.
|
|
128
227
|
- `--lookup` sends package names and versions to OSV.dev after the prompt, or with the CLI's `--yes`. The `npx` launcher may contact npm to fetch the CLI before its own offline mode starts. An installed copy or the extracted demo works without that download.
|
|
228
|
+
- `--jsonl` and `--sarif` upload nothing. Both hold what the report shows for each finding: the file, the finding's own words and, in JSON Lines, the masked line it points at. SARIF names a file in your home folder from `HOME`, not by its full path. Read either before you share it.
|
|
229
|
+
- `--rules` reads your rules on this computer. Nothing in them is sent anywhere, and neither is what they find.
|
|
129
230
|
- Credential files such as `.env` and `id_rsa`, and programs inside skills, are listed by name only and never opened. Secrets inside agent files are masked as they're read.
|
|
130
231
|
|
|
131
232
|
The [privacy policy](https://misconfig.ai/privacy) lists everything misconfig.ai receives and how long it's kept.
|
|
@@ -144,12 +245,16 @@ misconfig is plain JavaScript with no dependencies, so what you install is what'
|
|
|
144
245
|
| --- | --- |
|
|
145
246
|
| [`engine/catalog.js`](https://github.com/gkdataio/misconfig/blob/main/engine/catalog.js) | The wording, level and fix of every rule |
|
|
146
247
|
| [`engine/index.js`](https://github.com/gkdataio/misconfig/blob/main/engine/index.js) | The checks that apply the rules, and the scoring |
|
|
248
|
+
| [`engine/templates.js`](https://github.com/gkdataio/misconfig/blob/main/engine/templates.js) | Rules written as data, and what a rule of your own can say |
|
|
147
249
|
| [`engine/known.js`](https://github.com/gkdataio/misconfig/blob/main/engine/known.js) | Known malware, agent advisories and attack traces, each with its source |
|
|
148
250
|
| [`engine/locations.js`](https://github.com/gkdataio/misconfig/blob/main/engine/locations.js) | Where each agent keeps its files on macOS, Windows and Linux |
|
|
149
251
|
| [`lib/discover.js`](https://github.com/gkdataio/misconfig/blob/main/lib/discover.js) | Which files the command reads, and the limits on what it reads |
|
|
150
252
|
| [`lib/html.js`](https://github.com/gkdataio/misconfig/blob/main/lib/html.js) | The page `--open` saves |
|
|
253
|
+
| [`lib/formats.js`](https://github.com/gkdataio/misconfig/blob/main/lib/formats.js) | Findings as JSON Lines and as SARIF |
|
|
254
|
+
| [`lib/rule-files.js`](https://github.com/gkdataio/misconfig/blob/main/lib/rule-files.js) | How `--rules` reads your rules |
|
|
151
255
|
| [`lib/computer-review.js`](https://github.com/gkdataio/misconfig/blob/main/lib/computer-review.js) | Changes, approvals and accepted risks |
|
|
152
256
|
| [`lib/edit-attribution.js`](https://github.com/gkdataio/misconfig/blob/main/lib/edit-attribution.js) | How optional local edit records are matched |
|
|
257
|
+
| [`action/main.js`](https://github.com/gkdataio/misconfig/blob/main/action/main.js) | The GitHub Action |
|
|
153
258
|
|
|
154
259
|
## Contributing
|
|
155
260
|
|
package/bin/misconfig.js
CHANGED
|
File without changes
|