browsertrix-crawler/tests
Roy Teeuwen 2e9ad14454
fix: resolve dependency CVEs, fix ws v8 screencast regression, prune devDependencies from image (#1042)
## Summary

Dependency security maintenance: `yarn audit` reported 33 unique
advisories (2 critical, 19 high); this PR resolves all but one (details
below) and removes dev tooling from the published Docker image.

### Direct dependency upgrades
- `undici` ^7.16.0 → ^7.18.0 (resolves 7.27.2) — CVE-2026-1525,
CVE-2026-22036
- `ws` ^7.4.4 → ^8.20.1 — CVE-2026-45736
- `uuid` 8.3.2 → ^11.1.1 — CVE-2026-41907 (`@types/uuid` dropped; types
are bundled since v10)
- `@aws-sdk/client-s3` / `lib-storage` refreshed in-range — pulls
`fast-xml-parser` 5.7.3 (CVE-2026-25896 critical, + 5 more)

### Transitive re-resolutions (lockfile only, within existing ranges)
`fast-xml-parser` 4.5.5+, `tar-fs`, `ip-address` 10.x (via `socks`),
`minimatch`, `picomatch`, `ajv`, `js-yaml`, `@babel/helpers`,
`basic-ftp`, `flatted`, `lodash`, `qs`, `follow-redirects`,
`brace-expansion`. One resolutions entry forces `minimatch` 9.0.7 for
`@typescript-eslint/typescript-estree` (pinned exact at 9.0.3).

### ws v8 runtime fix + new test
ws v8 no longer exposes `Server` on the default export — the screencast
server crashed at startup with `ws.Server is not a constructor` (tsc did
not catch it). Fixed by using the `WebSocketServer` named export, and
added `tests/screencast.test.ts`, which runs a crawl with
`--screencastPort` and asserts a WebSocket client receives the `init`
message — this path previously had no test coverage and the new test
catches the regression.

### Docker image: prune devDependencies
The image ran a plain `yarn install`, shipping jest, eslint, lighthouse,
http-server and their transitive trees in production. The Dockerfile now
prunes to production dependencies after `tsc` and cleans the yarn cache
(runtime code only imports production deps — verified). Smaller image,
smaller vulnerability surface.

### Known remaining advisory (accepted)
`fast-xml-parser` CVE-2026-41650 (moderate) via `@webrecorder/wabac`:
the fix only exists on the 5.x line and wabac latest still pins
`^4.5.4`. Will resolve when wabac moves to fxp 5.

## Testing
- `yarn audit`: 33 unique advisories → 1 moderate (above)
- `yarn tsc`, `eslint`, `prettier` clean
- e2e against the rebuilt image: `basic_crawl.test.ts`, new
`screencast.test.ts`, plus S3 upload (versitygw), SOCKS5 proxy (3proxy),
and yaml config crawls verified
2026-06-15 20:56:29 -07:00
..
custom-behaviors tests: remove example.com from tests (#885) 2025-09-19 23:21:47 -07:00
fixtures Add downloads dir to cache external dependency within the crawl (#921) 2025-11-26 19:30:27 -08:00
invalid-behaviors tests: remove example.com from tests (#885) 2025-09-19 23:21:47 -07:00
adblockrules.test.ts tests: include tests in format and lint operations, reformat existing tests to match style 2026-04-09 12:52:33 -07:00
add-exclusion.test.ts Convert tests from JS to TS (#1003) 2026-04-02 17:05:41 -07:00
basic_crawl.test.ts Convert tests from JS to TS (#1003) 2026-04-02 17:05:41 -07:00
blockrules.test.ts tests: include tests in format and lint operations, reformat existing tests to match style 2026-04-09 12:52:33 -07:00
brave-query-redir.test.ts Convert tests from JS to TS (#1003) 2026-04-02 17:05:41 -07:00
collection_name.test.ts Convert tests from JS to TS (#1003) 2026-04-02 17:05:41 -07:00
config_file.test.ts Convert tests from JS to TS (#1003) 2026-04-02 17:05:41 -07:00
config_stdin.test.ts tests: include tests in format and lint operations, reformat existing tests to match style 2026-04-09 12:52:33 -07:00
crawl_overwrite.test.ts Convert tests from JS to TS (#1003) 2026-04-02 17:05:41 -07:00
custom-behavior-flow.test.ts Convert tests from JS to TS (#1003) 2026-04-02 17:05:41 -07:00
custom-behavior.test.ts Convert tests from JS to TS (#1003) 2026-04-02 17:05:41 -07:00
custom_driver.test.ts tests: include tests in format and lint operations, reformat existing tests to match style 2026-04-09 12:52:33 -07:00
custom_selector.test.ts Convert tests from JS to TS (#1003) 2026-04-02 17:05:41 -07:00
dedupe-basic.test.ts Page Level Dedupe support: (#1018) 2026-04-30 20:14:42 +02:00
dedupe-page.test.ts Page Level Dedupe support: (#1018) 2026-04-30 20:14:42 +02:00
dryrun.test.ts tests: include tests in format and lint operations, reformat existing tests to match style 2026-04-09 12:52:33 -07:00
exclude-redirected.test.ts tests: include tests in format and lint operations, reformat existing tests to match style 2026-04-09 12:52:33 -07:00
extra_hops_depth.test.ts tests: include tests in format and lint operations, reformat existing tests to match style 2026-04-09 12:52:33 -07:00
file_stats.test.ts Convert tests from JS to TS (#1003) 2026-04-02 17:05:41 -07:00
http-auth.test.ts tests: include tests in format and lint operations, reformat existing tests to match style 2026-04-09 12:52:33 -07:00
lang-code.test.ts Convert tests from JS to TS (#1003) 2026-04-02 17:05:41 -07:00
limit_reached.test.ts Convert tests from JS to TS (#1003) 2026-04-02 17:05:41 -07:00
log_filtering.test.ts Convert tests from JS to TS (#1003) 2026-04-02 17:05:41 -07:00
mult_url_crawl_with_favicon.test.ts Convert tests from JS to TS (#1003) 2026-04-02 17:05:41 -07:00
multi-instance-crawl.test.ts Convert tests from JS to TS (#1003) 2026-04-02 17:05:41 -07:00
non-html-crawl.test.ts Convert tests from JS to TS (#1003) 2026-04-02 17:05:41 -07:00
norm-test.test.ts Convert tests from JS to TS (#1003) 2026-04-02 17:05:41 -07:00
pageinfo-records.test.ts Convert tests from JS to TS (#1003) 2026-04-02 17:05:41 -07:00
profiles.test.ts Convert tests from JS to TS (#1003) 2026-04-02 17:05:41 -07:00
proxy.test.ts Convert tests from JS to TS (#1003) 2026-04-02 17:05:41 -07:00
qa_compare.test.ts Convert tests from JS to TS (#1003) 2026-04-02 17:05:41 -07:00
retry-failed.test.ts Convert tests from JS to TS (#1003) 2026-04-02 17:05:41 -07:00
robots_txt.test.ts Convert tests from JS to TS (#1003) 2026-04-02 17:05:41 -07:00
rollover-writer.test.ts tests: include tests in format and lint operations, reformat existing tests to match style 2026-04-09 12:52:33 -07:00
saved-state.test.ts tests: include tests in format and lint operations, reformat existing tests to match style 2026-04-09 12:52:33 -07:00
scopes.test.ts Fix allowHashUrls option and scope checking for hash URLs (#1025) 2026-04-28 22:32:12 +02:00
screencast.test.ts fix: resolve dependency CVEs, fix ws v8 screencast regression, prune devDependencies from image (#1042) 2026-06-15 20:56:29 -07:00
screenshot.test.ts Convert tests from JS to TS (#1003) 2026-04-02 17:05:41 -07:00
seeds.test.ts Convert tests from JS to TS (#1003) 2026-04-02 17:05:41 -07:00
sitemap-parse.test.ts tests: include tests in format and lint operations, reformat existing tests to match style 2026-04-09 12:52:33 -07:00
skipped_pages.test.ts Add option to write JSONL file with data on skipped pages (#966) 2026-04-09 12:51:41 -07:00
storage.test.ts Convert tests from JS to TS (#1003) 2026-04-02 17:05:41 -07:00
text-extract.test.ts tests: point test-extract at old.webrecorder.net/community (#1035) 2026-06-02 14:16:08 -07:00
upload-wacz.test.ts Convert tests from JS to TS (#1003) 2026-04-02 17:05:41 -07:00
url-normalize.test.ts tests: include tests in format and lint operations, reformat existing tests to match style 2026-04-09 12:52:33 -07:00
url_file_list.test.ts Convert tests from JS to TS (#1003) 2026-04-02 17:05:41 -07:00
utils.ts Convert tests from JS to TS (#1003) 2026-04-02 17:05:41 -07:00
vnc-serve.test.ts fix: resolve dependency CVEs, fix ws v8 screencast regression, prune devDependencies from image (#1042) 2026-06-15 20:56:29 -07:00
warcinfo.test.ts tests: include tests in format and lint operations, reformat existing tests to match style 2026-04-09 12:52:33 -07:00