walkdiff 0.10.0 → 0.12.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,38 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.12.0
4
+
5
+ - **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.
6
+ - **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.
7
+ - **Infrastructure as code:** a new "Infrastructure" category, counted towards security, for the lines a PR adds to infrastructure files.
8
+ - **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.
9
+ - **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.
10
+ - **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.
11
+ - **Supply chain:** a new "Supply chain" category, counted towards security, for how packages reach the build. It works offline.
12
+ - **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.
13
+ - **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.
14
+ - **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`.
15
+ - **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.
16
+ - **Review checklist wording:** grouped findings now say how many places for every kind of finding, including known vulnerabilities, licences and new endpoints.
17
+ - **Easier to extend:**
18
+ - Each language's rules live in one module, and the review's checks in one list.
19
+ - 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.
20
+ - Findings name the check that raised them.
21
+ - [Adding a language](docs/adding-a-language.md) and [Adding a check](docs/adding-a-check.md) explain how.
22
+
23
+ ## 0.11.0
24
+
25
+ - **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.
26
+ - **Kotlin and C#:** files in these languages now get changed units with change facts, callers traced across the repository, function metrics, risky-API rules and syntax highlighting.
27
+ - **Kotlin:** extension functions are named by the type they extend, as `String.shout`.
28
+ - **C#:** file-scoped namespaces name the declarations after them, as `Acme.Server.Runner.Run`.
29
+ - **JSON logs:** `--log-format json`, or `WALKDIFF_LOG_FORMAT=json` in CI, prints each message to stderr as one JSON object per line, with `time`, `level` and `msg`, plus fields such as the analysis step or the report's folder. Messages now have levels, `info`, `warn` or `error`, and the text format is unchanged.
30
+ - **Test files are recognised the same way everywhere:**
31
+ - `ServerTest.java`, `ParserTests.kt`, `Tests/` folders and `_test` files in any language count as tests in every check.
32
+ - Go's `TestXxx` functions and Rust's `tests.rs` stay off the review path.
33
+ - Test files no longer get function-metric findings or a "no tests changed" note.
34
+ - **Semgrep's environment is patched:** Walkdiff now installs the fixed versions of `mcp` (1.30.0) and OpenTelemetry (1.45.2) with Semgrep, which still pins vulnerable ones itself. Existing installs pick this up on the next run.
35
+
3
36
  ## 0.10.0
4
37
 
5
38
  - **Dependency checks for Go and Java:** PRs that add or bump dependencies in `go.mod`, `pom.xml`, `build.gradle`, `build.gradle.kts`, Gradle version catalogs (`*.versions.toml`) or `gradle.lockfile` now get what npm, Cargo and Python ones get. Each new direct dependency is noted, checked for trust (known malicious, not on its registry, very new, or a lookalike name) and against your licence allowlist, and versions new to the build are looked up in OSV. Go and Maven packages are looked up through [deps.dev](https://deps.dev), which covers the Go module proxy, Maven Central and Google's Maven repository. `go.sum` isn't read, since it lists versions the build dropped, and a Maven module of the project's own group is recognised as part of the project.
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.10.0](CHANGELOG.md). To run it on your team's PRs, see the [pilot guide](docs/pilot.md).
8
+ Status: early release, [v0.12.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,7 +15,7 @@ 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
- - **Changed units, not hunks.** For Rust, TypeScript/JavaScript, Python, Go, Java, C and C++, each changed function,
18
+ - **Changed units, not hunks.** For Rust, TypeScript/JavaScript, Python, Go, Java, Kotlin, C#, C and C++, each changed function,
19
19
  method, type, class or macro appears once, whole, before and after, with edited words marked. A class shows only the
20
20
  code it owns; its methods are separate cards. In JavaScript and TypeScript tests, each `describe`,
21
21
  `it`/`test` and hook such as `beforeEach` is a unit too, named by its title, such as `parser › reads includes`.
@@ -28,9 +28,11 @@ All changes has five tabs, including **Conversation** in the app: **Changes** (f
28
28
  - **Blast radius.** For every function, method or type the PR changes, removes or renames, the report
29
29
  lists where the rest of the code still uses it, linked to the host at the head commit, and flags the
30
30
  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
32
- such as `eval`, `shell=True`, raw HTML, `unsafe`, Go's `InsecureSkipVerify`, Java deserialization or C's
33
- `strcpy` (only in code, not comments or strings), sensitive
31
+ - **Risks and security findings.** Built-in rules flag likely secrets (redacted in the report), new
32
+ HTTP endpoints (and one without the auth its neighbours declare, or code that turns auth or CSRF
33
+ checks off), risky APIs
34
+ such as `eval`, `shell=True`, raw HTML, `unsafe`, Go's `InsecureSkipVerify`, Java deserialization, C#'s
35
+ `BinaryFormatter` or C's `strcpy` (only in code, not comments or strings), sensitive
34
36
  areas such as auth, payments, migrations and CI, new dependencies, and known vulnerabilities in
35
37
  dependency versions new to `package-lock.json`, `Cargo.lock`, `poetry.lock`, `uv.lock`, pinned
36
38
  requirements, `go.mod`, `pom.xml`, Gradle build files and version catalogs, or `gradle.lockfile`
@@ -56,7 +58,7 @@ Known limits: tests are recognised by the usual names (`describe`, `it`, `test`
56
58
  test helper with another name shows under "imports & top level"; a unit renamed as well as moved and
57
59
  edited, or mostly rewritten, shows as removed plus added (see
58
60
  [troubleshooting](docs/troubleshooting.md#a-function-shows-as-removed-and-added)); code is highlighted
59
- only in Rust, TypeScript/JavaScript, Python, Go, Java, C and C++; and `.h` headers are read as C++, which
61
+ only in Rust, TypeScript/JavaScript, Python, Go, Java, Kotlin, C#, C and C++; and `.h` headers are read as C++, which
60
62
  reads C too unless the code uses a C++ keyword such as `new` as a name.
61
63
 
62
64
  ## Usage
@@ -68,6 +70,15 @@ npx walkdiff review https://github.com/owner/repo/pull/123
68
70
  npx walkdiff review https://gitlab.com/group/project/-/merge_requests/45 --no-serve --out ./report
69
71
  ```
70
72
 
73
+ To review your own branch before opening a pull request, run it inside the repository:
74
+
75
+ ```sh
76
+ npx walkdiff review --local # against the remote's default branch
77
+ npx walkdiff review --local --base develop
78
+ ```
79
+
80
+ It reads your committed work in place, without fetching or changing anything, and leaves uncommitted changes out. The report is the same, without the parts that need a host: links to the PR and its files, posting a review, and coverage from CI.
81
+
71
82
  Or install it once with `npm install --global walkdiff`, then run `walkdiff`. To work on Walkdiff itself,
72
83
  clone this repository, run `pnpm install`, and use `pnpm walkdiff` in place of `walkdiff`.
73
84
 
@@ -106,7 +117,7 @@ Tokens and code stay on your machine, apart from the host itself, package names
106
117
 
107
118
  ## In CI
108
119
 
109
- The GitHub Action (`navasvarela/walkdiff@v0.10.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.
120
+ The GitHub Action (`navasvarela/walkdiff@v0.12.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.
110
121
 
111
122
  ## AI review
112
123
 
@@ -156,6 +167,54 @@ Choose Semgrep's rules in `.walkdiff.json`; an empty list turns Semgrep off:
156
167
 
157
168
  CI runners need the scanners installed in the job before running Walkdiff.
158
169
 
170
+ ## Infrastructure
171
+
172
+ Built-in rules read the lines a PR adds to infrastructure files, outside tests and comments, under the
173
+ "Infrastructure" category, which counts towards the security summary:
174
+
175
+ | File | Flags |
176
+ | --- | --- |
177
+ | 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 |
178
+ | 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 |
179
+ | 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 |
180
+
181
+ ## Supply chain
182
+
183
+ Built-in rules check how packages reach the build, separately from whether they're vulnerable. They
184
+ compare each lockfile at the merge base and at head, and read the package-manager settings a PR adds.
185
+ They read only the repository, so they also run with `--offline`. Findings use the "Supply chain"
186
+ category, which counts towards the security summary.
187
+
188
+ Lockfiles read: `package-lock.json`, `npm-shrinkwrap.json`, `yarn.lock` (Yarn 1 and 2+),
189
+ `pnpm-lock.yaml`, `Cargo.lock`, `uv.lock`, `poetry.lock` and `go.sum`.
190
+
191
+ | Flags | Why |
192
+ | --- | --- |
193
+ | 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 |
194
+ | 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` |
195
+ | A package that moves to another registry, repository or URL | How a fork or a takeover gets in |
196
+ | 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 |
197
+ | 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) |
198
+ | 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 |
199
+ | `--extra-index-url` for pip | pip installs the highest version from any index, the original dependency confusion attack |
200
+ | Certificate checks turned off, `--trusted-host`, or a registry over `http://` | Packages can be swapped on the way |
201
+ | A changed `preinstall`, `install` or `postinstall` script in `package.json` | npm runs it on every install |
202
+ | `.pnpmfile.cjs` or a Yarn plugin | Code that runs inside the package manager |
203
+ | A `replace` in `go.mod` pointing at another module | Builds use a different module than the one required |
204
+
205
+ Only entries the PR adds or changes are judged: what was already in the lockfile was already reviewed.
206
+
207
+ Online, npm packages a lockfile upgrades within a release line (a new minor or patch, which `^` ranges
208
+ install unasked) are also compared with the release they replace, using npm's record of each:
209
+
210
+ | Flags | Severity |
211
+ | --- | --- |
212
+ | A release without the provenance the previous one had, which is how a release published from a stolen token looks | Medium |
213
+ | 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 |
214
+
215
+ This sends upgraded package names and versions to npm, except those in `dependencies.private`; turn it
216
+ off under Checks in the app's Settings ("npm release history"), or with `--offline`. Up to 300 upgrades are checked per review.
217
+
159
218
  ## Breaking changes
160
219
 
161
220
  Walkdiff flags changes that could break other code or a deployment, under the "Breaking change" category
@@ -180,7 +239,7 @@ A change also needs someone it can affect:
180
239
  | Go | A capitalised name, and for a method, a capitalised type | A `go.mod` is above it, the package isn't `main`, and no folder on its path is `internal` |
181
240
 
182
241
  Java isn't covered yet, since nothing in a Java project's files reliably tells a published library from an
183
- application. Neither are C and C++, whose API is whatever the installed headers declare.
242
+ application, and the same goes for Kotlin and C#. Neither are C and C++, whose API is whatever the installed headers declare.
184
243
 
185
244
  Otherwise it's flagged only if calls this PR didn't touch remain in the repository. Python and TypeScript
186
245
  functions under a framework's decorator are skipped, as the decorator can change how they're called. So is a
@@ -210,7 +269,19 @@ without the definition changing, and inputs of a GitHub Action's `action.yml`.
210
269
  Walkdiff flags poor implementations and bad practice in the code a PR adds, under the "Code quality"
211
270
  category in the Risks tab. These findings never count as security findings.
212
271
 
213
- **Function metrics** are built in and cover Rust, TypeScript, Python, Go, Java, C and C++. A function is flagged when
272
+ **Error handling** is checked on added code, outside tests:
273
+
274
+ | Finding | Severity | Languages |
275
+ | --- | --- | --- |
276
+ | 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 {}` |
277
+ | Catches every error: a bare `except:`, `BaseException`, `Throwable` or `catch (...)` | Low | Python, Java, Kotlin, C++ |
278
+ | May panic: `.unwrap()` or `.expect()` | Low | Rust, outside `mod tests` and `#[test]` functions |
279
+ | Result discarded: `_ = f()` | Low | Go |
280
+
281
+ A handler holding only a comment counts as a decision someone explained, and isn't flagged. Neither is a
282
+ promise `.catch(() => fallback)` that returns a value.
283
+
284
+ **Function metrics** are built in and cover Rust, TypeScript, Python, Go, Java, Kotlin, C#, C and C++. A function is flagged when
214
285
  the PR adds it over a limit, pushes it over one, or makes one already over the limit at least 20%
215
286
  worse. The Changes tab also shows each modified function's complexity change. Test code is left out.
216
287