walkdiff 0.11.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,25 @@
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
+
3
23
  ## 0.11.0
4
24
 
5
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.
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.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
 
@@ -28,7 +28,9 @@ 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
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
32
34
  such as `eval`, `shell=True`, raw HTML, `unsafe`, Go's `InsecureSkipVerify`, Java deserialization, C#'s
33
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
@@ -115,7 +117,7 @@ Tokens and code stay on your machine, apart from the host itself, package names
115
117
 
116
118
  ## In CI
117
119
 
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.
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.
119
121
 
120
122
  ## AI review
121
123
 
@@ -165,6 +167,54 @@ Choose Semgrep's rules in `.walkdiff.json`; an empty list turns Semgrep off:
165
167
 
166
168
  CI runners need the scanners installed in the job before running Walkdiff.
167
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
+
168
218
  ## Breaking changes
169
219
 
170
220
  Walkdiff flags changes that could break other code or a deployment, under the "Breaking change" category
@@ -219,6 +269,18 @@ without the definition changing, and inputs of a GitHub Action's `action.yml`.
219
269
  Walkdiff flags poor implementations and bad practice in the code a PR adds, under the "Code quality"
220
270
  category in the Risks tab. These findings never count as security findings.
221
271
 
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
+
222
284
  **Function metrics** are built in and cover Rust, TypeScript, Python, Go, Java, Kotlin, C#, C and C++. A function is flagged when
223
285
  the PR adds it over a limit, pushes it over one, or makes one already over the limit at least 20%
224
286
  worse. The Changes tab also shows each modified function's complexity change. Test code is left out.