walkdiff 0.11.0 → 0.13.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 CHANGED
@@ -1,5 +1,47 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.13.0
4
+
5
+ - **The Risks tab is a one-page overview:**
6
+ - **Headline:** the security summary, plus what else needs a decision or is background.
7
+ - **Index:** a row per kind of finding (supply chain, breaking change, docs drift and so on), grouped into security, decisions and background, with counts coloured by the worst finding. It stays in view as you scroll.
8
+ - **Sections:** one per kind, with what to check and its findings, ordered by kind and then severity. The checks that ran and didn't come last.
9
+ - **Links:** each section has a link of its own, such as `#risks/supplyChain`, and the review brief's new **At a glance** card links straight to them.
10
+ - **Breaking changes in API schemas:** each OpenAPI, GraphQL or protobuf file a PR changes or deletes is compared with its version at the merge base. A change that breaks clients already running is high; one that only breaks code built against the schema is medium.
11
+ - **OpenAPI 3 and Swagger 2:** removed operations; new or newly required parameters and request fields; enum values clients can no longer send; and response fields that were removed, retyped, or are no longer always there.
12
+ - **GraphQL:** removed types, fields, arguments and enum values; changed types; output fields that can now be null; and inputs that became required.
13
+ - **Protobuf:** removed RPCs, messages and enums; changed types; field numbers that changed; and fields removed or renamed without reserving their number.
14
+ - **Split schemas:** GraphQL and protobuf files are read together, so a type that moves to another file is compared with itself there. A schema that can't be parsed is listed under "Not checked".
15
+ - **Docs drift:** a new check flags docs a PR leaves out of date.
16
+ - **Stale mentions:** Markdown, reStructuredText or AsciiDoc that still mentions a command-line option, environment variable, config key, function or type the PR removes or renames. Changelogs and upgrade guides, and lines that also name the replacement, are left alone.
17
+ - **Doc comments:** a comment that still describes a parameter its changed function dropped, or leaves out one it gained.
18
+ - **Hotspots:** a new check notes changed files that had a change reverted in the last 90 days, keep needing fixes, or change far more often than most, from their commits in the year before the PR. A hotspot ranks higher on the review path and says why.
19
+ - **Where the history comes from:** git for local reviews. For hosted PRs, GitHub's or GitLab's API, which reads only the changed files' paths; on GitHub this needs a token.
20
+ - **Settings:** it can be turned off, and the list of what leaves your machine names it.
21
+ - **Mixed-concern PRs:** a new Scope check asks whether a PR should be split.
22
+ - **Tidy-ups and upgrades:** behaviour changes buried among 5 or more files that are only reformatted, renamed or moved, or among 10 or more upgraded packages.
23
+ - **Unrelated packages:** behaviour changes in workspace packages that neither depend on nor use each other.
24
+
25
+ ## 0.12.0
26
+
27
+ - **Attack surface:** new HTTP endpoints are noted where a PR adds them, in Express, Koa, Fastify, Hono, NestJS, FastAPI, Flask, Django, Spring, JAX-RS, ASP.NET, Go's `net/http`, gin, echo, chi, axum, actix and Rocket. A new endpoint without the auth its neighbours in the file declare is flagged, as is code that turns auth or CSRF checks off, such as `[AllowAnonymous]`, `permitAll()` or `@csrf_exempt`. A route moved within the PR isn't counted as new.
28
+ - **Error handling that hides failures:** in added code, empty `catch` and `except` blocks, `.catch(() => {})`, Go's empty `if err != nil {}` and `_ = call()`, catch-alls such as a bare `except:`, `catch (Throwable)` or `catch (...)`, and Rust's `unwrap()` and `expect()` outside tests. A handler that holds a comment counts as an explained decision. These are code-quality findings, so they don't count towards security.
29
+ - **Infrastructure as code:** a new "Infrastructure" category, counted towards security, for the lines a PR adds to infrastructure files.
30
+ - **Dockerfiles:** base images without a version, `curl … | sh`, `ADD` of a URL without `--checksum`, secrets in `ARG` or `ENV`, `USER root`, and new Dockerfiles that never set a user.
31
+ - **Kubernetes manifests:** privileged containers, the host's network, process or IPC namespaces, privilege escalation, running as root, `hostPath` volumes, added `SYS_ADMIN`, `NET_ADMIN` or `ALL` capabilities, and images without a version.
32
+ - **Terraform:** ingress from `0.0.0.0/0`, public S3 ACLs, public-access blocks turned off, publicly accessible databases, encryption turned off, and IAM wildcard actions.
33
+ - **Supply chain:** a new "Supply chain" category, counted towards security, for how packages reach the build. It works offline.
34
+ - **Lockfiles:** `package-lock.json`, `yarn.lock` (Yarn 1 and 2+), `pnpm-lock.yaml` (including pnpm 10's two-document form), `Cargo.lock`, `uv.lock`, `poetry.lock` and `go.sum` are compared before and after the PR. Walkdiff flags the same version with a different content hash, a private package (from `dependencies.private`) now resolved from a public registry, a package that moves to another registry, repository or URL, new packages from git, a URL or plain `http://`, and upgrades that start running an install script.
35
+ - **Package-manager settings:** changed registries in `.npmrc`, `.yarnrc.yml`, `bunfig.toml`, `pip.conf`, requirement files, `uv.toml`, `pyproject.toml` and `.cargo/config.toml`, pip's `--extra-index-url`, TLS checks turned off, changed npm `preinstall`, `install` and `postinstall` scripts, `.pnpmfile.cjs` and Yarn plugins, and Go `replace` lines pointing at another module.
36
+ - **npm release history:** online, npm packages a lockfile upgrades within a release line are compared with the release they replace. A release without the provenance its predecessor had is flagged as Medium. One published by an account that wasn't a maintainer before is flagged as Low, unless CI built it with provenance or trusted publishing. Upgraded package names and versions go to npm, except private ones. Turn it off in Settings as "npm release history", or with `--offline`.
37
+ - **Settings say more accurately what leaves your machine:** the list is now built from the checks themselves, and includes deps.dev, which the dependency trust check uses for Go and Maven packages.
38
+ - **Review checklist wording:** grouped findings now say how many places for every kind of finding, including known vulnerabilities, licences and new endpoints.
39
+ - **Easier to extend:**
40
+ - Each language's rules live in one module, and the review's checks in one list.
41
+ - A check can add a new kind of finding, and the report describes it, so the report page, review plan, security summary and PR comment show it with no other changes.
42
+ - Findings name the check that raised them.
43
+ - [Adding a language](docs/adding-a-language.md) and [Adding a check](docs/adding-a-check.md) explain how.
44
+
3
45
  ## 0.11.0
4
46
 
5
47
  - **Review your own branch before opening a pull request:** `walkdiff review --local` reviews the committed work on the current branch of the repository you're in, against the remote's default branch or `--base <ref>`. It reads the repository in place without fetching or changing anything, and says how many files have uncommitted changes it left out. The report is the same, without what needs a host: the PR link, links to files, posting a review, and coverage from CI.
package/README.md CHANGED
@@ -5,7 +5,7 @@
5
5
  A review companion for GitHub pull requests and GitLab merge requests. `walkdiff review <url>` fetches the
6
6
  change, analyzes it, and serves a local report.
7
7
 
8
- Status: early release, [v0.11.0](CHANGELOG.md). To run it on your team's PRs, see the [pilot guide](docs/pilot.md).
8
+ Status: early release, [v0.13.0](CHANGELOG.md). To run it on your team's PRs, see the [pilot guide](docs/pilot.md).
9
9
 
10
10
  **Documentation:** [website](https://navasvarela.github.io/walkdiff/), [getting started](docs/getting-started.md), [configuration](docs/configuration.md), [troubleshooting](docs/troubleshooting.md), [security policy](SECURITY.md).
11
11
 
@@ -15,6 +15,13 @@ The report opens on a brief: what to check, how many changes need attention, and
15
15
 
16
16
  All changes has five tabs, including **Conversation** in the app: **Changes** (files, the map of each file and the changed units), **Impact** (where other code uses what changed), **Risks** (each check's result and every finding) and **AI review**. Each tab shows a count, and its name in the URL lets you link to it, as in `#risks`.
17
17
 
18
+ **Risks** is a one-page overview:
19
+ - **Headline:** the security summary, with how many findings need a decision or are background.
20
+ - **Index:** a row per kind of finding (supply chain, breaking change, docs drift and so on), grouped into security, decisions and background, with counts coloured by the worst finding. It stays in view as you scroll.
21
+ - **Sections:** one per kind of finding, with what to check and its findings, then the checks that ran and didn't.
22
+
23
+ Each section has a link of its own, as in `#risks/supplyChain`, and the review brief's **At a glance** card links straight to them.
24
+
18
25
  - **Changed units, not hunks.** For Rust, TypeScript/JavaScript, Python, Go, Java, Kotlin, C#, C and C++, each changed function,
19
26
  method, type, class or macro appears once, whole, before and after, with edited words marked. A class shows only the
20
27
  code it owns; its methods are separate cards. In JavaScript and TypeScript tests, each `describe`,
@@ -28,7 +35,9 @@ All changes has five tabs, including **Conversation** in the app: **Changes** (f
28
35
  - **Blast radius.** For every function, method or type the PR changes, removes or renames, the report
29
36
  lists where the rest of the code still uses it, linked to the host at the head commit, and flags the
30
37
  callers this PR did not touch. Removed and renamed units show any references left behind.
31
- - **Risks and security findings.** Built-in rules flag likely secrets (redacted in the report), risky APIs
38
+ - **Risks and security findings.** Built-in rules flag likely secrets (redacted in the report), new
39
+ HTTP endpoints (and one without the auth its neighbours declare, or code that turns auth or CSRF
40
+ checks off), risky APIs
32
41
  such as `eval`, `shell=True`, raw HTML, `unsafe`, Go's `InsecureSkipVerify`, Java deserialization, C#'s
33
42
  `BinaryFormatter` or C's `strcpy` (only in code, not comments or strings), sensitive
34
43
  areas such as auth, payments, migrations and CI, new dependencies, and known vulnerabilities in
@@ -115,7 +124,7 @@ Tokens and code stay on your machine, apart from the host itself, package names
115
124
 
116
125
  ## In CI
117
126
 
118
- The GitHub Action (`navasvarela/walkdiff@v0.11.0`) and the GitLab template (`ci/gitlab-ci.yml`) generate the report for each PR, keep it as a job artifact, and post one summary comment that is updated on each push. The [pilot guide](docs/pilot.md) has the setup. Locally, `walkdiff review` also works without a URL inside a CI job, and `walkdiff comment --report <dir> --report-url <url>` posts the summary.
127
+ The GitHub Action (`navasvarela/walkdiff@v0.13.0`) and the GitLab template (`ci/gitlab-ci.yml`) generate the report for each PR, keep it as a job artifact, and post one summary comment that is updated on each push. The [pilot guide](docs/pilot.md) has the setup. Locally, `walkdiff review` also works without a URL inside a CI job, and `walkdiff comment --report <dir> --report-url <url>` posts the summary.
119
128
 
120
129
  ## AI review
121
130
 
@@ -165,6 +174,54 @@ Choose Semgrep's rules in `.walkdiff.json`; an empty list turns Semgrep off:
165
174
 
166
175
  CI runners need the scanners installed in the job before running Walkdiff.
167
176
 
177
+ ## Infrastructure
178
+
179
+ Built-in rules read the lines a PR adds to infrastructure files, outside tests and comments, under the
180
+ "Infrastructure" category, which counts towards the security summary:
181
+
182
+ | File | Flags |
183
+ | --- | --- |
184
+ | Dockerfiles | Base images without a version (not `scratch` or the file's own stages), `curl … \| sh`, `ADD https://…` without `--checksum`, secrets in `ARG` or `ENV`, `USER root`, and a new Dockerfile that never sets a user |
185
+ | Kubernetes manifests | Privileged containers, the host's network, process or IPC namespaces, privilege escalation, running as root, `hostPath` volumes, added `SYS_ADMIN`, `NET_ADMIN` or `ALL` capabilities, and images without a version |
186
+ | Terraform | Ingress from `0.0.0.0/0` (not egress), public S3 ACLs, public-access blocks turned off, publicly accessible databases, encryption turned off, and IAM wildcard actions |
187
+
188
+ ## Supply chain
189
+
190
+ Built-in rules check how packages reach the build, separately from whether they're vulnerable. They
191
+ compare each lockfile at the merge base and at head, and read the package-manager settings a PR adds.
192
+ They read only the repository, so they also run with `--offline`. Findings use the "Supply chain"
193
+ category, which counts towards the security summary.
194
+
195
+ Lockfiles read: `package-lock.json`, `npm-shrinkwrap.json`, `yarn.lock` (Yarn 1 and 2+),
196
+ `pnpm-lock.yaml`, `Cargo.lock`, `uv.lock`, `poetry.lock` and `go.sum`.
197
+
198
+ | Flags | Why |
199
+ | --- | --- |
200
+ | The same version with a different content hash | A registry never serves new files for a published version, so a hand edit or a tampered mirror is likely |
201
+ | A private package now resolved from a public registry | Dependency confusion: anyone can publish your private name publicly. Private names come from `dependencies.private` in `.walkdiff.json` |
202
+ | A package that moves to another registry, repository or URL | How a fork or a takeover gets in |
203
+ | A new package from a git repository or a plain URL, or any over `http://` | Nothing records who published it, or anyone on the network can swap it |
204
+ | An upgrade that starts running an install script, or a new package that runs one | Compromised releases often add a `postinstall` (npm and pnpm 6–8 lockfiles record this) |
205
+ | A changed registry in `.npmrc`, `.yarnrc.yml`, `bunfig.toml`, `pip.conf`, requirement files, `uv.toml`, `pyproject.toml` or `.cargo/config.toml` | Changes where every package comes from |
206
+ | `--extra-index-url` for pip | pip installs the highest version from any index, the original dependency confusion attack |
207
+ | Certificate checks turned off, `--trusted-host`, or a registry over `http://` | Packages can be swapped on the way |
208
+ | A changed `preinstall`, `install` or `postinstall` script in `package.json` | npm runs it on every install |
209
+ | `.pnpmfile.cjs` or a Yarn plugin | Code that runs inside the package manager |
210
+ | A `replace` in `go.mod` pointing at another module | Builds use a different module than the one required |
211
+
212
+ Only entries the PR adds or changes are judged: what was already in the lockfile was already reviewed.
213
+
214
+ Online, npm packages a lockfile upgrades within a release line (a new minor or patch, which `^` ranges
215
+ install unasked) are also compared with the release they replace, using npm's record of each:
216
+
217
+ | Flags | Severity |
218
+ | --- | --- |
219
+ | A release without the provenance the previous one had, which is how a release published from a stolen token looks | Medium |
220
+ | A release published by an account that wasn't a maintainer of the previous one, unless it was built by CI with provenance or trusted publishing | Low |
221
+
222
+ This sends upgraded package names and versions to npm, except those in `dependencies.private`; turn it
223
+ off under Checks in the app's Settings ("npm release history"), or with `--offline`. Up to 300 upgrades are checked per review.
224
+
168
225
  ## Breaking changes
169
226
 
170
227
  Walkdiff flags changes that could break other code or a deployment, under the "Breaking change" category
@@ -196,6 +253,20 @@ functions under a framework's decorator are skipped, as the decorator can change
196
253
  name that's still available after its definition went, through an alias, a `__getattr__` shim or a move to
197
254
  another file. A removal that untouched code still uses shows up as a broken reference instead.
198
255
 
256
+ **API schemas:** each OpenAPI, GraphQL or protobuf file the PR changes or deletes is compared with its version at
257
+ the merge base. A new schema file can't break anyone, so it isn't compared on its own. What breaks clients
258
+ already running, such as a removed operation, is high, and what breaks code built against the schema is medium.
259
+
260
+ | Format | Flags |
261
+ | --- | --- |
262
+ | OpenAPI 3 and Swagger 2 (YAML or JSON) | Removed operations; new or newly required parameters, request bodies and request fields; enum values clients can no longer send; removed or retyped response fields, and ones that are no longer always there. Bodies are compared at their top level, following `$ref`s and `allOf` within the file |
263
+ | GraphQL (`.graphql`, `.graphqls`, `.gql`) | Removed types, fields, arguments and enum values; retyped fields and arguments; output fields that can now be null; arguments and input fields that became required, or are new and required |
264
+ | Protobuf (`.proto`) | Removed RPCs, messages and enums; retyped RPCs and fields; fields and enum values whose number changed; fields and enum values removed or renamed without reserving their number |
265
+
266
+ GraphQL and protobuf schemas are often split across files, so the PR's files of each are read as one. A type
267
+ that moves to another file is compared with itself there. A schema Walkdiff can't parse is listed under "Not
268
+ checked" with the file and why.
269
+
199
270
  **Database migrations:** dropped or renamed tables and columns and changed column types, in raw SQL (including
200
271
  Prisma, Goose, dbmate and Flyway files), Alembic, Django, Rails, Knex, Sequelize and TypeORM. Only the added lines
201
272
  that run on the way up count, so rollbacks aren't flagged. Neither are temporary tables, or names the
@@ -211,14 +282,85 @@ mentions an unusual name. Django's `AlterField` isn't checked, since it mostly c
211
282
  - A key removed from a config file (`config/*.yml`, `settings.toml`, `appsettings.json`, `*.example.json` and
212
283
  similar) while code still reads it. Ordinary words like `name` are left out, as matches on them mean little.
213
284
 
214
- Not covered yet: public struct fields and interface members, new required trait methods, re-exports removed from an entry point
285
+ Not covered yet: GraphQL union members and directives, OpenAPI `$ref`s to other files, and nested body
286
+ fields beyond the top level; public struct fields and interface members, new required trait methods, re-exports removed from an entry point
215
287
  without the definition changing, and inputs of a GitHub Action's `action.yml`.
216
288
 
289
+ ## Docs drift
290
+
291
+ Walkdiff flags docs a PR leaves out of date, under its own "Docs drift" category. These are review signals,
292
+ not security findings.
293
+
294
+ - **Names the docs still use:** a command-line option (a quoted `--flag` in code), an environment variable, a
295
+ config key, or a function or type that the PR removes or renames, while Markdown, reStructuredText or AsciiDoc
296
+ files at head still mention it.
297
+ - **Severity:** options and settings are medium, because whoever follows the docs gets an error or a setting
298
+ that silently does nothing. Code names are low.
299
+ - **What's skipped:** a name that code at head still uses anywhere doesn't count, since it may be defined
300
+ elsewhere. Neither do changelogs, release notes, upgrade and migration guides, or a line that names the
301
+ replacement too, which is describing the rename.
302
+ - **Doc comments that no longer match:** a function the PR changes whose doc comment still describes a parameter
303
+ it removed, or doesn't describe one it added while describing the others. This reads JSDoc, Javadoc and KDoc
304
+ `@param`, Python's `Args:`, NumPy `Parameters` and `:param:` sections, and Rust's `# Arguments`.
305
+
306
+ Only what the PR changes is compared, so docs that were already out of date aren't flagged.
307
+
308
+ ## Hotspots
309
+
310
+ Walkdiff notes changed files whose recent history says to look harder. It reads each file's commits in the
311
+ year before the merge base, so the PR's own commits never count:
312
+
313
+ | Note | When |
314
+ | --- | --- |
315
+ | Had a change reverted recently | A commit starting with "Revert" touched it in the 90 days before the PR |
316
+ | Often fixed | At least 5 commits that fixed something touched it, a quarter or more of its changes. Fixes are commits with "fix", "bug", "hotfix", "regression", "crash" or "broken" in their subject, but not ones about typos, lint, formatting, docs, tests, CI, builds or dependencies |
317
+ | Changes often | 30 or more commits touched it |
318
+
319
+ These go under the "Hotspot" category. They're context, not questions: they don't count as security and the
320
+ review plan doesn't list them, but a hotspot file ranks higher on the review path and says why.
321
+
322
+ **Where the history comes from:**
323
+ - **`--local` reviews and checkouts with history:** the repository itself.
324
+ - **Hosted PRs and MRs:** these fetch only the PR's own commits, so Walkdiff asks the host. On GitHub that's one
325
+ GraphQL query for up to 20 files, which needs a token. On GitLab it's one request per file.
326
+
327
+ Offline, without a GitHub token, or in a shallow clone, the Risks tab lists Hotspots under "Not checked". It
328
+ looks at up to 60 changed code files, and can be turned off in the app's Settings.
329
+
330
+ ## Scope
331
+
332
+ Walkdiff flags PRs that mix concerns, under the "Scope" category, as a question for the review plan: should it be
333
+ split? Each changed file is sorted by what it carries:
334
+
335
+ - **Behaviour:** code units added, removed, or edited beyond formatting and comments.
336
+ - **Tidy-up:** code that's only reformatted, re-commented, renamed or moved.
337
+ - **Dependencies:** lockfiles.
338
+ - **Neither:** tests, docs, CI and config, which travel with the change they belong to.
339
+
340
+ It flags two things:
341
+
342
+ | Note | When |
343
+ | --- | --- |
344
+ | Mixes a tidy-up or upgrades with behaviour changes | Alongside behaviour changes, 5 or more tidy-up files, or 10 or more packages the lockfiles already had moved to new versions. New packages don't count, since they come with the code that uses them |
345
+ | Changes packages that don't use each other | Behaviour changes in two or more workspace packages (folders with their own `package.json`, `Cargo.toml`, `go.mod` and so on), each with at least 3 changed units, where neither declares a dependency on the other, names something the other changes, or calls it |
346
+
217
347
  ## Code quality
218
348
 
219
349
  Walkdiff flags poor implementations and bad practice in the code a PR adds, under the "Code quality"
220
350
  category in the Risks tab. These findings never count as security findings.
221
351
 
352
+ **Error handling** is checked on added code, outside tests:
353
+
354
+ | Finding | Severity | Languages |
355
+ | --- | --- | --- |
356
+ | Error swallowed: a handler that does nothing, or only `pass` or `...` | Medium | TypeScript, JavaScript, Python, Java, Kotlin, C#, C++, and Go's empty `if err != nil {}` |
357
+ | Catches every error: a bare `except:`, `BaseException`, `Throwable` or `catch (...)` | Low | Python, Java, Kotlin, C++ |
358
+ | May panic: `.unwrap()` or `.expect()` | Low | Rust, outside `mod tests` and `#[test]` functions |
359
+ | Result discarded: `_ = f()` | Low | Go |
360
+
361
+ A handler holding only a comment counts as a decision someone explained, and isn't flagged. Neither is a
362
+ promise `.catch(() => fallback)` that returns a value.
363
+
222
364
  **Function metrics** are built in and cover Rust, TypeScript, Python, Go, Java, Kotlin, C#, C and C++. A function is flagged when
223
365
  the PR adds it over a limit, pushes it over one, or makes one already over the limit at least 20%
224
366
  worse. The Changes tab also shows each modified function's complexity change. Test code is left out.