[markdown] Add regression, scaling, and fuzzer tests for DoS fixes
Add `pkgs/markdown/test/pathological_test.dart`, expand
`pkgs/markdown/test/regression_test.dart`, and document the DoS fixes in
`pkgs/markdown/CHANGELOG.md`.
----
Each of the preceding commits fixes a quadratic O(n^2), exponential O(2^n), or
deep-recursion (`StackOverflowError`) vulnerability in `package:markdown`.
Without automated scaling assertions, deep-nesting tests, and fuzz testing over
adversarial token combinations, regressions in regexes, delimiter processing, or
AST traversal could silently reintroduce super-linear behavior without breaking
functional CommonMark/GFM output tests.
1. **`pkgs/markdown/test/pathological_test.dart`**:
- **Linear-scaling suite (`_cases`)**: Tests 51 pathological input generators
in both CommonMark and GFM (`ExtensionSet.gitHubWeb`) modes at 8 KB and
64 KB (8x size ratio), asserting that the 64 KB render time is within a
bounded linear multiple (`3 * _scale`) of the 8 KB render time (where
linear growth is ~8x and quadratic growth is ~64x).
- **Deep-nesting suite (`_deepCases`)**: Renders 6 deep-nesting generators at
depth 32,000 (nested strong emphasis, nested strong emphasis run, nested
strong emphasis with trailing text, nested strong emphasis in image alt,
nested blockquotes, and nested lists) in both CommonMark and GFM modes to
verify that no `StackOverflowError` is thrown.
- **Custom `linkBuilder` regression test**: Verifies that a custom
`linkBuilder` that does not invoke `getChildren()` produces the expected
AST when earlier delimiters resolve into emphasis elements.
- **Token-alphabet fuzzer**: Runs 200 deterministic PRNG iterations (`Random(42)`),
each picking a random subset of 2–6 tokens from a 23-token Markdown
alphabet and generating a 2,000-token string to verify that arbitrary token
combinations render in under 2 seconds without hanging or throwing.
2. **`pkgs/markdown/test/regression_test.dart`**:
- Adds targeted timing regression tests for unclosed inline link destinations
and titles and inline delimiter runs.
3. **`pkgs/markdown/CHANGELOG.md`**:
- Documents the security and performance fixes under `7.4.1-wip`.
This repository is home to tooling related Dart packages. Generally, this means packages published through the tools.dart.dev publisher that don't naturally belong to other topic monorepos (like dart-lang/build, dart-lang/test, or dart-lang/shelf).
| Package | Description | Issues | Version |
|---|---|---|---|
| api_summary | Creates an API summary for a package. | ||
| bazel_worker | Protocol and utilities to implement or invoke persistent bazel workers. | ||
| benchmark_harness | The official Dart project benchmark harness. | ||
| boolean_selector | A flexible syntax for boolean expressions, based on a simplified version of Dart's expression syntax. | ||
| boring | Raw FFI bindings to BoringSSL, compiled and bundled through Dart Native Assets. | ||
| browser_launcher | Provides a standardized way to launch web browsers for testing and tools. | ||
| cli_config | A library to take config values from configuration files, CLI arguments, and environment variables. | ||
| cli_util | A library to help in building Dart command-line apps. | ||
| clock | A fakeable wrapper for dart:core clock APIs. | ||
| code_builder | A fluent, builder-based library for generating valid Dart code. | ||
| coverage | Coverage data manipulation and formatting | ||
| csslib | A library for parsing and analyzing CSS (Cascading Style Sheets). | ||
| extension_discovery | A convention and utilities for package extension discovery. | ||
| file | A pluggable, mockable file system abstraction for Dart. | ||
| file_testing | Testing utilities for package:file. | ||
| glob | A library to perform Bash-style file and directory globbing. | ||
| graphs | Graph algorithms that operate on graphs in any representation. | ||
| html | APIs for parsing and manipulating HTML content outside the browser. | ||
| io | Utilities for the Dart VM Runtime including support for ANSI colors, file copying, and standard exit code values. | ||
| json_rpc_2 | Utilities to write a client or server using the JSON-RPC 2.0 spec. | ||
| markdown | A portable Markdown library written in Dart that can parse Markdown into HTML. | ||
| mime | Utilities for handling media (MIME) types, including determining a type from a file extension and file contents. | ||
| oauth2 | A client library for authenticating with a remote service via OAuth2 on behalf of a user, and making authorized HTTP requests with the user's OAuth2 credentials. | ||
| package_config | Support for reading and writing Dart Package Configuration files. | ||
| pool | Manage a finite pool of resources. Useful for controlling concurrent file system or network requests. | ||
| process | A pluggable, mockable process invocation abstraction for Dart. | ||
| pub_semver | Versions and version constraints implementing pub's versioning policy. This is very similar to vanilla semver, with a few corner cases. | ||
| pubspec_parse | Simple package for parsing pubspec.yaml files with a type-safe API and rich error reporting. | ||
| source_map_stack_trace | A package for applying source maps to stack traces. | ||
| source_maps | A library to programmatically manipulate source map files. | ||
| source_span | Provides a standard representation for source code locations and spans. | ||
| sse | Provides client and server functionality for setting up bi-directional communication through Server Sent Events (SSE) and corresponding POST requests. | ||
| stack_trace | A package for manipulating stack traces and printing them readably. | ||
| stream_channel | An abstraction for two-way communication channels based on the Dart Stream class. | ||
| stream_transform | A collection of utilities to transform and manipulate streams. | ||
| string_scanner | A class for parsing strings using a sequence of patterns. | ||
| term_glyph | Useful Unicode glyphs and ASCII substitutes. | ||
| test_reflective_loader | Support for discovering tests and test suites using reflection. | ||
| timing | A simple package for tracking the performance of synchronous and asynchronous actions. | ||
| unified_analytics | A package for logging analytics for all Dart and Flutter related tooling to Google Analytics. | ||
| watcher | A file system watcher. It monitors changes to contents of directories and sends notifications when files have been added, removed, or modified. | ||
| yaml | A parser for YAML, a human-friendly data serialization standard | ||
| yaml_edit | A library for YAML manipulation with comment and whitespace preservation. |
For information about our publishing automation and release process, see https://github.com/dart-lang/ecosystem/wiki/Publishing-automation.
For additional information about contributing, see our contributing page.