diff --git a/.changeset/fuzz-targets.md b/.changeset/fuzz-targets.md new file mode 100644 index 000000000..b5734c22d --- /dev/null +++ b/.changeset/fuzz-targets.md @@ -0,0 +1,18 @@ +--- +--- + +feat(fuzz): a cargo-fuzz target per untrusted-input parser + +The rewrite's four hand-written parsers — the NIP-01 client frame, the REQ/COUNT filter, the +settings loader and the NIP-11 identity/document pair — take bytes from a socket or an +operator's file, and the existing suite only replays cases its author thought of. `fuzz/` is a +cargo-fuzz crate with its own nightly pin (`nightly-2026-08-21`) because cargo-fuzz emits +`-Zsanitizer` and the repository pin is a stable; it path-depends on `nostream-core`, +`nostream-config` and `nostream-relay` rather than copying a parser, so a campaign exercises the +crate that ships. Each of the four targets calls its parser on every input, asserts the +invariant named in its doc comment, and runs from committed seeds drawn from the crates' own +tests. `docs/rewrite/fuzz.md` is the runbook: install, environment, build and run commands, what +a 60 s smoke test does and does not reach, what a finding means, and the longer campaign that is +gated on #871's tauceti runbook and not started here. CI gains `fuzz/**` in the Rust path filter, a +format gate over the crate, and one `cd fuzz && cargo check`, so the crate cannot rot between +campaigns; no campaign runs in CI. Rust only: no published package changes, so this entry carries no version bump. diff --git a/.github/workflows/checks.yml b/.github/workflows/checks.yml index c211fc9f6..3a7e38b8b 100644 --- a/.github/workflows/checks.yml +++ b/.github/workflows/checks.yml @@ -57,6 +57,7 @@ jobs: - 'rust-toolchain.toml' - 'resources/default-settings.yaml' - 'scripts/rust.sh' + - 'fuzz/**' - '.github/workflows/checks.yml' commit-lint: @@ -300,6 +301,16 @@ jobs: run: cargo check -p nostream-storage --no-default-features --all-targets - name: Release build run: cargo build --workspace --all-features --release + # The fuzz crate is its own workspace, so none of the checks above see it — the job's own + # `cargo fmt --all --check` skips `fuzz/`, and naming its manifest is what brings it under + # the same pinned rustfmt. + - name: Fuzz crate formatting + run: cargo fmt --manifest-path fuzz/Cargo.toml --check + # `cargo check` picks up `fuzz/rust-toolchain.toml` (nightly, which cargo-fuzz's + # `-Zsanitizer` needs) and compiles only: no campaign runs here. A parser change that + # breaks the crate fails this step instead of surfacing at the next campaign. + - name: Fuzz crate compiles + run: cd fuzz && cargo check kani-proofs: diff --git a/.gitignore b/.gitignore index 41f1dd99e..55ada68a1 100644 --- a/.gitignore +++ b/.gitignore @@ -56,6 +56,12 @@ coverage-report/ # Rust /target/ +# Fuzz build output, generated corpus and findings. The crate itself is committed: +# fuzz/Cargo.toml, fuzz/Cargo.lock, fuzz/rust-toolchain.toml and fuzz/seeds/**. +/fuzz/target/ +/fuzz/corpus/ +/fuzz/artifacts/ + # A migration target is the dataset: `--target .` writes it here, and this repository is public. /lmdb/ /migration-manifest.json diff --git a/docs/rewrite/fuzz.md b/docs/rewrite/fuzz.md new file mode 100644 index 000000000..a265b46ef --- /dev/null +++ b/docs/rewrite/fuzz.md @@ -0,0 +1,264 @@ +# Fuzzing the four untrusted-input parsers + +`fuzz/` is a cargo-fuzz crate of its own that builds one libFuzzer target per parser this row +covers. It is a development tool: nothing in the daemon, the services or the test suite builds +it, and no campaign runs in CI. Two peer-reachable parsers are not covered yet — +`nip44::validate_payload` (from `strategies/gift_wrap.rs:82`) and +`expiration::get_event_expiration` (from `strategies/mod.rs:174`, and through +`handlers/event.rs:67`) — and #1293 tracks their targets; this row does not add them. + +| target | parser | entry point | +|---|---|---| +| `client_frame` | NIP-01 client frame | `nostream_core::messages::decode` (`crates/nostream-core/src/messages.rs:383`) | +| `filter` | REQ/COUNT filter | `nostream_core::filter::validate_filter` (`crates/nostream-core/src/filter.rs:251`) | +| `settings` | settings loader | `nostream_config::load` (`crates/nostream-config/src/load.rs:390`) | +| `nip11` | NIP-11 identity and document | `nostream_relay::nip11::parse_relay_pubkey` and `nostream_relay::nip11::document` (`crates/nostream-relay/src/nip11.rs:198`, `:106`) | + +The four are fed what their production callers hand them: `client_frame` a whole websocket text +frame, `filter` one JSON filter document — a single REQ element, not a frame, so a whole frame +is refused by the non-object arm — `settings` the bytes of an operator's settings file, and +`nip11` the string an operator writes into `info.pubkey`/`info.self` plus, from the same bytes, +a settings document for the `document` panic harness. Nothing here is a copy of a parser: each +target path-depends on the workspace crate that owns it (`fuzz/Cargo.toml`), so a change under +`crates/` is what a campaign exercises. + +## Environment + +Every `cargo fuzz` command on this host runs with the rustup proxies first on `PATH`, the +rustup home that holds the nightly, and no `CARGO_TARGET_DIR`: + +``` +export PATH=/home/node/.cargo/bin:$PATH +export RUSTUP_HOME=/home/node/.cargo/rustup +unset CARGO_TARGET_DIR +``` + +- `/home/node/.cargo/bin` holds the `cargo`/`rustc` proxies: they are what read the + `rust-toolchain.toml` of the directory a command starts in. Putting the pinned stable + toolchain's own `bin` directory first instead makes `cargo fuzz build` fail with "the option + `Z` is only accepted on the nightly compiler". +- `RUSTUP_HOME` must be exported. Unset, rustup resolves the profile home, which holds only the + repository pin, and reports that `nightly-2026-08-21` is not installed. +- `CARGO_TARGET_DIR` must be unset. With it set, the target executables land under + `$CARGO_TARGET_DIR/x86_64-unknown-linux-gnu/release/` instead of `fuzz/target`, and the paths + below are wrong. + +`cargo install` puts `cargo-fuzz` in `$CARGO_HOME/bin` (`~/.cargo/bin` by default), which has to +be on `PATH` as well. + +## Install the tool + +Once per machine: + +``` +cargo install cargo-fuzz --version 0.13.2 --locked +``` + +The tool is cargo-fuzz 0.13.2, the version these runs were taken with; `cargo fuzz --version` +prints it. Recon could not install it and the red team's probes ran a throwaway copy, so the +campaigns recorded in the job's `build.md` are the tool's first real use in this repository. + +## Why every command runs from `fuzz/`, and never names a version + +`cd fuzz` first, always. rustup resolves a toolchain pin from the working directory, so +`fuzz/rust-toolchain.toml` is what selects the nightly, and a command started at the repository +root never sees it. + +The crate carries its own pin because cargo-fuzz always emits `-Zsanitizer=address`, and the +repository pin (`rust-toolchain.toml` → `1.99.1`) is a stable rustc that rejects `-Z` and has +no `-Csanitizer` at all. The channel is `nightly-2026-08-21`; it is named here once, in +`fuzz/rust-toolchain.toml`. No command passes a toolchain name or `+toolchain` — the +repository's rule is that the pin file is the one place a toolchain moves. + +## Seeds + +`fuzz/seeds//` holds the hand-written inputs each target starts from, and each is a +case the crate's own tests already use (the target's doc comment names the invariant). The +generated corpus is not committed: `fuzz/corpus/` is ignored, and the runbook's commands copy +the seeds into it, one directory per target: + +``` +cd fuzz +for t in client_frame filter settings nip11; do + mkdir -p corpus/$t + cp -n seeds/$t/* corpus/$t/ +done +``` + +`fuzz/Cargo.toml`, `fuzz/Cargo.lock`, `fuzz/rust-toolchain.toml` and `fuzz/seeds/**` are +committed; `fuzz/target/`, `fuzz/corpus/` and `fuzz/artifacts/` are ignored. + +## Build + +From `fuzz/`, with the environment above: + +``` +cargo fuzz build client_frame +cargo fuzz build filter +cargo fuzz build settings +cargo fuzz build nip11 +``` + +`cargo fuzz list` prints exactly those four names. The binaries land under +`fuzz/target/x86_64-unknown-linux-gnu/release/`. A cold build compiles the whole dependency +graph — 2 m 01 s for `client_frame` on this host — and each later target links in seconds. + +### The lock + +`fuzz/Cargo.lock` is a second resolution of the same crates: 228 packages against the +workspace's 335, with newer patches on roughly sixty shared crates. Refresh it in the same +change that moves the root `Cargo.lock`, so a campaign's finding speaks about the graph the +relay ships rather than the one this crate happens to resolve. + +## Run a short campaign + +From `fuzz/`, after the seeds are copied: + +``` +cargo fuzz run client_frame corpus/client_frame -- -max_total_time=60 -max_len=524288 -timeout=10 -rss_limit_mb=2048 -print_final_stats=1 +cargo fuzz run filter corpus/filter -- -max_total_time=60 -max_len=524288 -timeout=10 -rss_limit_mb=2048 -print_final_stats=1 +cargo fuzz run settings corpus/settings -- -max_total_time=60 -max_len=524288 -timeout=10 -rss_limit_mb=2048 -print_final_stats=1 +cargo fuzz run nip11 corpus/nip11 -- -max_total_time=60 -max_len=524288 -timeout=10 -rss_limit_mb=2048 -print_final_stats=1 +``` + +The flags are the bounds, enforced by libFuzzer rather than by a timer in the harness: + +- `-max_len=524288` is the payload bound the shipped configuration sets: + `resources/default-settings.yaml:212` ships `network.maxPayloadSize: 524288`, and + `nostream_relay::transport::max_payload_size` returns it + (`crates/nostream-relay/src/transport.rs:50-56`). The bound is configured, not constant: + `DEFAULT_MAX_PAYLOAD` = 131 072 applies only when that key is absent (`transport.rs:28`), + which is why a command copied from the constant — `-max_len=131072` — fuzzed a quarter of + the range the shipped file admits. Raising `maxPayloadSize` must move this flag with it; +- `-timeout=10` and `-rss_limit_mb=2048` turn a hang or an unbounded allocation into a finding + instead of a run that is merely slow. Both are coupled to the payload bound: at + `-max_len=524288` the measured peak RSS was `settings` 495 MB, `nip11` 405 MB, `filter` 86 MB + and `client_frame` 49 MB, so raising `network.maxPayloadSize` must raise `-rss_limit_mb` and + `-timeout` with it. + +A clean run exits 0, prints a `Done runs in second(s)` line and leaves an empty +`fuzz/artifacts//`. A finding is a **file** in that directory, not the directory +itself: `cargo fuzz run` creates the empty directory on a clean run. + +### What 60 s is, and is not + +It is a smoke test: every committed seed is executed, then the mutator explores for a minute. +It is not a campaign. libFuzzer grows its input length limit from the seeds, so a 60 s run +reaches a few KiB of input — measured 87 to 4190 across the four targets — nowhere near the +configured 512 KiB `-max_len` bound. The flag bounds the run; the smoke test does not approach +it. + +The `INITED cov:`/`ft:` figures on the first line are recorded for trend, not as a guard: a +stub body (`let _ = data.len();`) already measures `INITED cov: 14`, so a figure above zero +proves nothing on its own. What proves the parser is reached is the target body itself (the +job's criteria grep for the call), and a figure near the stub baseline is the signal that the +call was optimised away or gated off. + +### A wide pass, when the size bound matters + +The short campaign never approaches `-max_len`: libFuzzer's length controller grows inputs a +little at a time from the seeds' size, which is why the runs above ended with `lim` under 4 KiB +while the bound is 512 KiB. Inputs near the bound are exercised only with the controller off: +`-len_control=0` lets the mutator jump straight for `-max_len`-sized inputs instead of crawling +up to them. + +``` +cargo fuzz run client_frame corpus/client_frame -- -max_total_time=60 -max_len=524288 -len_control=0 -timeout=10 -rss_limit_mb=2048 -print_final_stats=1 +cargo fuzz run filter corpus/filter -- -max_total_time=60 -max_len=524288 -len_control=0 -timeout=10 -rss_limit_mb=2048 -print_final_stats=1 +cargo fuzz run settings corpus/settings -- -max_total_time=60 -max_len=524288 -len_control=0 -timeout=10 -rss_limit_mb=2048 -print_final_stats=1 +cargo fuzz run nip11 corpus/nip11 -- -max_total_time=60 -max_len=524288 -len_control=0 -timeout=10 -rss_limit_mb=2048 -print_final_stats=1 +``` + +Every target reached `lim: 524288` within the minute on this host: `client_frame` 1 549 209 +runs, `filter` 2 053 925, `settings` 7 210, `nip11` 24 538; no artifacts, and libFuzzer printed +`slowest_unit_time_sec: 0` for all four. The cost is the parser's: `settings` and `nip11` parse +a document of up to the bound on every execution, so they complete thousands of runs where the +frame targets do millions, and the peak-RSS coupling above is unchanged: memory scales with the +bound. All four are worth running — none is slow enough to be left out — but a wide pass is +still a smoke test of the size range, not an exploration of it; exhaustive work at 512 KiB +belongs to the gated long campaign. + +## What a finding means + +An artifact file under `fuzz/artifacts//` is a crashing or hanging input. It is never +committed. Either the parser is fixed in the same change with the input added as a regression +case (and then the artifact becomes part of the explanation in the PR), or the input's bytes, +its sha256 and the issue filed for it are recorded and the artifact attached to that issue. + +A finding above the configured payload bound (`network.maxPayloadSize`, 512 KiB in the shipped +file) is not production-reachable: the transport refuses a larger frame before any parser sees +it. It is still a bug worth fixing, but it cannot be a denial of service against the relay. + +`settings` and `nip11` feed documents of up to the 512 KiB bound to `serde_yaml`, which parses +through `unsafe-libyaml` (RUSTSEC-2024-0449: unmaintained, no upstream fix, already in the root +lock). A finding inside that stack cannot be patched by a version bump, so the remedy may have +to be a bound in our caller — a size or nesting-depth pre-check before the document reaches the +parser. + +## The longer campaign (written, not run) + +The 24-hour campaign is deliberately not started here: this sandbox has no spare cores for it, +and the host that does — `tauceti` — is the subject of #871's runbook, which has not been +agreed with its owner. The gate is that runbook and the operator's word, in that order. Nothing +in this document starts it. + +When the gate opens, the procedure is the short campaign with the budget raised and the corpus +kept: the same four commands, `-max_total_time` replaced by a wall-clock budget the host can +afford (start with `-max_total_time=86400`), run one target at a time, each in its own +`screen`/`systemd` unit, with `fuzz/artifacts` watched for files. The corpus directories +accumulate across runs, so copy them back into the tree only as `fuzz/seeds/` additions that a +review has seen; `fuzz/corpus/` stays ignored. + +## CI: a format gate and a compile check + +`rust-checks` runs two steps over the crate, after its existing checks: + +``` +cargo fmt --manifest-path fuzz/Cargo.toml --check +cd fuzz && cargo check +``` + +The crate is its own workspace, so the job's own `cargo fmt --all --check` cannot see it — +naming the manifest is what brings `fuzz/` under the same pinned rustfmt the workspace uses. +The second step compiles it under the crate's own pin. Neither runs a campaign: that costs +minutes per target and is nondeterministic, which is not what a PR gate is for. The steps exist +so the crate cannot rot between campaigns — a parser or dependency change that breaks it, or a +file that stops being formatted, fails the PR that made it instead of surfacing at the next +campaign. + +The same change adds `fuzz/**` to the `rust` path filter, so a PR that touches only the fuzz +crate runs the Rust jobs (it previously ran none). The cost is stated: a `fuzz/**`-only PR now +triggers `rust-checks` and, because `kani-proofs` and `windows-cli-check` gate on the same +`rust` filter, both of those too; `rust-checks` installs `nightly-2026-08-21` on any run — +including PRs that change `crates/**`. + +## The two premises this replaced + +1. **The NIP-11 generator is not reachable from a socket.** `nostream_relay::nip11::document` + has one non-test caller, the MCP server's `status_payload` + (`crates/nostream-mcp/src/server.rs:1045`), and that server is served over stdio only + (`crates/nostreamd/src/mcp_stdio.rs:109`); the module's own docs say the HTTP surface is + shut. Its input is a typed `Settings`. So the fourth target is not a byte parser: it fuzzes + the one string the module parses — `info.pubkey`/`info.self` through `parse_relay_pubkey` — + and uses the same bytes as a settings document for a panic harness over `document`. +2. **`cargo fuzz build` cannot succeed on the repository's pinned toolchain.** cargo-fuzz emits + `-Zsanitizer`, the pin is a stable, and the stable rejects `-Z`. Hence the crate's own + `nightly-2026-08-21` pin, which changes nothing outside `fuzz/`. + +## The four targets, one line each + +- `client_frame`: `decode` never panics; an accepted REQ/COUNT carries a 1..=256-character + subscription id and 1..=10 filters. +- `filter`: `validate_filter` never panics; an accepted filter's `ids`/`authors` are 4..=64 + lowercase-hex characters and its tag keys are `#` plus one ASCII letter; a refusal carries at + least one issue. +- `settings`: `load` returns `Ok` and never reports issues without having substituted the + defaults; a document the loader cannot parse, or one that is neither null nor a mapping, must + come back with `used_defaults = true` — the liveness check that a harness planting the file + where `load` does not read it cannot pass. The document is planted in a 0700 directory the + harness creates per execution and removes when the execution ends, so a killed campaign can + leave at most one such directory (and its input) in `TMPDIR`. +- `nip11`: `parse_relay_pubkey` accepts only 64 hex characters or an `npub1…` form (and the key + round-trips), refuses everything else, and errors only on a malformed `npub`; `document` + never panics or fails to serialise, and its advertised `min_pow_difficulty` lies within + `[floorBits, ceilingBits]` when adaptive proof-of-work is enabled. diff --git a/fuzz/Cargo.lock b/fuzz/Cargo.lock new file mode 100644 index 000000000..b4965a103 --- /dev/null +++ b/fuzz/Cargo.lock @@ -0,0 +1,2360 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 4 + +[[package]] +name = "aes" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b169f7a6d4742236a0a00c541b845991d0ac43e546831af1249753ab4c3aa3a0" +dependencies = [ + "cfg-if", + "cipher 0.4.4", + "cpufeatures 0.2.17", +] + +[[package]] +name = "allocator-api2" +version = "0.2.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "57b212daf2e827b1ccdd778b7eb48ba433e58cb0e4f27b43cd6b7a608425a014" + +[[package]] +name = "android_system_properties" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ae221649c9976a6f6c56ae1facf410f3ddb33cc661c4b7b61020a912d4237fbc" +dependencies = [ + "libc", +] + +[[package]] +name = "arbitrary" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3bc62ac97cc33321f50863d514c3bc38a453947a8f9e781137e47c7401020aed" + +[[package]] +name = "atoi" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f28d99ec8bfea296261ca1af174f24225171fea9664ba9003cbebee704810528" +dependencies = [ + "num-traits", +] + +[[package]] +name = "autocfg" +version = "1.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f2032f911046de80f0a198e0901378627c33f59ea0ac00e363d481118bd70a53" + +[[package]] +name = "base64" +version = "0.22.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6" + +[[package]] +name = "bech32" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32637268377fc7b10a8c6d51de3e7fba1ce5dd371a96e342b34e6078db558e7f" + +[[package]] +name = "bincode" +version = "1.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b1f45e9417d87227c7a56d22e471c6206462cba514c7590c09aff4cf6d1ddcad" +dependencies = [ + "serde", +] + +[[package]] +name = "bitflags" +version = "2.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3ded4057c258ba199e2d26386d3af3780957ecaee6c4ef4041c6b4b8b97c0b06" +dependencies = [ + "serde_core", +] + +[[package]] +name = "block-buffer" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d2f6c7dbe95a6ed67ad9f18e57daf93a2f034c524b99fd2b76d18fdfeb6660aa" +dependencies = [ + "hybrid-array", +] + +[[package]] +name = "block-padding" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a8894febbff9f758034a5b8e12d87918f56dfc64a8e1fe757d65e29041538d93" +dependencies = [ + "generic-array", +] + +[[package]] +name = "bumpalo" +version = "3.20.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "87a0cf66fd1eb2fb7b822cb78370d82303750809bc6ba855f3f58e517d3238db" + +[[package]] +name = "byteorder" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" + +[[package]] +name = "bytes" +version = "1.12.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "776dfebd015e2d8732c684a2c71003674ccb49457b539b9e82151ba38e96dd7c" + +[[package]] +name = "cbc" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "26b52a9543ae338f279b96b0b9fed9c8093744685043739079ce85cd58f289a6" +dependencies = [ + "cipher 0.4.4", +] + +[[package]] +name = "cc" +version = "1.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "95e45cf2980b2d467be49a9ed942c9179b701063a7ca3d037de7ee9bd67f8d66" +dependencies = [ + "find-msvc-tools", + "jobserver", + "libc", + "shlex", +] + +[[package]] +name = "cfg-if" +version = "1.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4e7648175b45a9a48536d676f68d918270699102aa8dab5496df06904c914600" + +[[package]] +name = "chacha20" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "65c35e4b699c7e15ccbe7ee35c005e4fc0a278d22238a2857e6ce2dadeda1b06" +dependencies = [ + "cfg-if", + "cipher 0.5.2", + "cpufeatures 0.3.1", + "rand_core 0.10.1", +] + +[[package]] +name = "chrono" +version = "0.4.45" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1aa79e62e7697b8e29b513a68abacf485adcd1fe8284a4316c5ae868e6633327" +dependencies = [ + "iana-time-zone", + "num-traits", + "serde", + "windows-link", +] + +[[package]] +name = "cipher" +version = "0.4.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "773f3b9af64447d2ce9850330c473515014aa235e6a783b02db81ff39e4a3dad" +dependencies = [ + "crypto-common 0.1.7", + "inout 0.1.4", +] + +[[package]] +name = "cipher" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e8cf2a2c93cd704877c0858356ed03480ff301ee950b43f1cbe4573b088bfa6c" +dependencies = [ + "block-buffer", + "crypto-common 0.2.2", + "inout 0.2.6", +] + +[[package]] +name = "cmov" +version = "0.5.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c9ea0ac24bc397ab3c98583a3c9ba74fa56b09a4449bbe172b9b1ddb016027a" + +[[package]] +name = "const-oid" +version = "0.10.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "be95d4a884358a21a199689323c29e9256b4a1b315e22f183d155422041d3a9a" + +[[package]] +name = "core-foundation-sys" +version = "0.8.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b" + +[[package]] +name = "cpufeatures" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "59ed5838eebb26a2bb2e58f6d5b5316989ae9d08bab10e0e6d103e656d1b0280" +dependencies = [ + "libc", +] + +[[package]] +name = "cpufeatures" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5ca28b0ae3115b884660db4118d803791fd6756b6e88f39c0f3f7859060d7566" +dependencies = [ + "libc", +] + +[[package]] +name = "crc" +version = "3.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5eb8a2a1cd12ab0d987a5d5e825195d372001a4094a0376319d5a0ad71c1ba0d" +dependencies = [ + "crc-catalog", +] + +[[package]] +name = "crc-catalog" +version = "2.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "217698eaf96b4a3f0bc4f3662aaa55bdf913cd54d7204591faa790070c6d0853" + +[[package]] +name = "crossbeam-queue" +version = "0.3.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "03e8bd762f7479489c70ed6c768ddca99d7296857de437a68dcb2a94365b3fae" +dependencies = [ + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-utils" +version = "0.8.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a31eee39dddec8330830986fcd7625edb5a24ec90ea038215273bbc3adb08ac6" + +[[package]] +name = "crypto-common" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "78c8292055d1c1df0cce5d180393dc8cce0abec0a7102adb6c7b1eef6016d60a" +dependencies = [ + "generic-array", + "typenum", +] + +[[package]] +name = "crypto-common" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ce6e4c961d6cd6c9a86db418387425e8bdeaf05b3c8bc1411e6dca4c252f1453" +dependencies = [ + "hybrid-array", +] + +[[package]] +name = "ctutils" +version = "0.4.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "261af4dc7a06ea8a527a8717d8cbba3417530d6ea14e1edb3de6b67806be474f" +dependencies = [ + "cmov", +] + +[[package]] +name = "data-encoding" +version = "2.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4583a4551df46e2792f82ceeac45e850d2e2d5debba0b91f102385cda5b11f06" + +[[package]] +name = "digest" +version = "0.11.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f1dd6dbb5841937940781866fa1281a1ff7bd3bf827091440879f9994983d5c2" +dependencies = [ + "block-buffer", + "const-oid", + "crypto-common 0.2.2", + "ctutils", +] + +[[package]] +name = "displaydoc" +version = "0.2.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c6232dd377dcc64799954cbd3a9bb882e9cdc1308ccd87b1c098f1fb2eaf82a8" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.10", +] + +[[package]] +name = "dotenvy" +version = "0.15.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1aaf95b3e5c8f23aa320147307562d361db0ae0d51242340f558153b4eb2439b" + +[[package]] +name = "doxygen-rs" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "415b6ec780d34dcf624666747194393603d0373b7141eef01d12ee58881507d9" +dependencies = [ + "phf", +] + +[[package]] +name = "either" +version = "1.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0e9c71c2167ca323c882b99918929403426e2373ea17242ff5653e0d5e1058be" +dependencies = [ + "serde", +] + +[[package]] +name = "equivalent" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "00d174d5400e5e8fd687ad1049e2f578285fa914201b1af7e8b112a4546bd826" + +[[package]] +name = "errno" +version = "0.3.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e35d6e78f4cebb90e51d543db8fe41528851d6deeef6ef21ebd4bfdc1e784776" +dependencies = [ + "libc", + "windows-sys 0.61.2", +] + +[[package]] +name = "etcetera" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "de48cc4d1c1d97a20fd819def54b890cadde72ed3ad0c614822a0a433361be96" +dependencies = [ + "cfg-if", + "windows-sys 0.61.2", +] + +[[package]] +name = "event-listener" +version = "5.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a23add41df1562121a9393cb065eab5146a1242410f23a644851e90cfd669d2" +dependencies = [ + "parking", + "pin-project-lite", +] + +[[package]] +name = "find-msvc-tools" +version = "0.1.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3e44f110d1777dc6559a51e7d45083945ded4f1bf3305494350f693b6d20b9c8" + +[[package]] +name = "flume" +version = "0.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5e139bc46ca777eb5efaf62df0ab8cc5fd400866427e56c68b22e414e53bd3be" +dependencies = [ + "futures-core", + "futures-sink", + "spin", +] + +[[package]] +name = "foldhash" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77ce24cb58228fbb8aa041425bb1050850ac19177686ea6e0f41a70416f56fdb" + +[[package]] +name = "form_urlencoded" +version = "1.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "afa489199eaffb1211795df1c6236ce1ad0d41a6fa45250add73e3b02420f06e" +dependencies = [ + "percent-encoding", +] + +[[package]] +name = "futures-channel" +version = "0.3.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b1f9e3d69d39e4862ffed03ed071a76f9a13ba1d9109d355b0f0aa6b15e393c4" +dependencies = [ + "futures-core", + "futures-sink", +] + +[[package]] +name = "futures-core" +version = "0.3.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "92d699e522242e69e3003b94ecc1f960f3a5e015aa7c5d7486e65ad01dd94f5e" + +[[package]] +name = "futures-executor" +version = "0.3.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "031b47cf1a3c6cc8bc2fc76cd437f521619387907d469316e7c0bc278f1f5432" +dependencies = [ + "futures-core", + "futures-task", + "futures-util", +] + +[[package]] +name = "futures-intrusive" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d930c203dd0b6ff06e0201a4a2fe9149b43c684fd4420555b26d21b1a02956f" +dependencies = [ + "futures-core", + "lock_api", + "parking_lot", +] + +[[package]] +name = "futures-io" +version = "0.3.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "53c0fa8157de1303bfffdaa1cc2a673bfffb60102f76b0ef4441659124373fed" + +[[package]] +name = "futures-macro" +version = "0.3.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9fb9654ba8355388abeb8dcb4fc62f511300867002afc858860463bdd9fe0c44" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.10", +] + +[[package]] +name = "futures-sink" +version = "0.3.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1944426bf7d03f1d14f708785e4b33efd750b36d48a157b836b3efc15ede8e1d" + +[[package]] +name = "futures-task" +version = "0.3.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cd417de3d1d015fc3bfd2b1ea46dfc7bab72ef86f1cc7cc9c78e728b34a6d1fd" + +[[package]] +name = "futures-util" +version = "0.3.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0d50a92467f8ba5dd6e3ee5d4bd04d73ab2e4e1c44474a0674821dfce14b79bc" +dependencies = [ + "futures-core", + "futures-io", + "futures-macro", + "futures-sink", + "futures-task", + "memchr", + "pin-project-lite", + "slab", +] + +[[package]] +name = "generic-array" +version = "0.14.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a" +dependencies = [ + "typenum", + "version_check", +] + +[[package]] +name = "getrandom" +version = "0.2.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff2abc00be7fca6ebc474524697ae276ad847ad0a6b3faa4bcb027e9a4614ad0" +dependencies = [ + "cfg-if", + "libc", + "wasi", +] + +[[package]] +name = "getrandom" +version = "0.3.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "899def5c37c4fd7b2664648c28120ecec138e4d395b459e5ca34f9cce2dd77fd" +dependencies = [ + "cfg-if", + "libc", + "r-efi 5.3.0", + "wasip2", +] + +[[package]] +name = "getrandom" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "300e883d756b2e4ec94e02791f39b04b522276138852cfc41d9fb7e904106099" +dependencies = [ + "cfg-if", + "libc", + "r-efi 6.0.0", + "rand_core 0.10.1", +] + +[[package]] +name = "hashbrown" +version = "0.16.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "841d1cc9bed7f9236f321df977030373f4a4163ae1a7dbfe1a51a2c1a51d9100" +dependencies = [ + "allocator-api2", + "equivalent", + "foldhash", +] + +[[package]] +name = "hashbrown" +version = "0.17.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "735eaa21a6a5ffb2e84362faaeb90c05ba8e19797ca30428478cb6ea3a4921bc" + +[[package]] +name = "hashlink" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "824e001ac4f3012dd16a264bec811403a67ca9deb6c102fc5049b32c4574b35f" +dependencies = [ + "hashbrown 0.16.1", +] + +[[package]] +name = "heck" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" + +[[package]] +name = "heed" +version = "0.20.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7d4f449bab7320c56003d37732a917e18798e2f1709d80263face2b4f9436ddb" +dependencies = [ + "bitflags", + "byteorder", + "heed-traits", + "heed-types", + "libc", + "lmdb-master-sys", + "once_cell", + "page_size", + "serde", + "synchronoise", + "url", +] + +[[package]] +name = "heed-traits" +version = "0.20.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eb3130048d404c57ce5a1ac61a903696e8fcde7e8c2991e9fcfc1f27c3ef74ff" + +[[package]] +name = "heed-types" +version = "0.20.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9d3f528b053a6d700b2734eabcd0fd49cb8230647aa72958467527b0b7917114" +dependencies = [ + "bincode", + "byteorder", + "heed-traits", + "serde", + "serde_json", +] + +[[package]] +name = "hex" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" + +[[package]] +name = "hkdf" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4aaa26c720c68b866f2c96ef5c1264b3e6f473fe5d4ce61cd44bbe913e553018" +dependencies = [ + "hmac", +] + +[[package]] +name = "hmac" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6303bc9732ae41b04cb554b844a762b4115a61bfaa81e3e83050991eeb56863f" +dependencies = [ + "digest", +] + +[[package]] +name = "http" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "918d3568bebf352712bc2ef3d46a8bcf1a75b373be6539de198e9105cbbf9ce0" +dependencies = [ + "bytes", + "itoa", +] + +[[package]] +name = "httparse" +version = "1.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6dbf3de79e51f3d586ab4cb9d5c3e2c14aa28ed23d180cf89b4df0454a69cc87" + +[[package]] +name = "hybrid-array" +version = "0.4.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "27f864f10dfb56725ce5ce5472bc52252c8f93a4ab86327122cebf62c5f59a17" +dependencies = [ + "typenum", +] + +[[package]] +name = "iana-time-zone" +version = "0.1.65" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e31bc9ad994ba00e440a8aa5c9ef0ec67d5cb5e5cb0cc7f8b744a35b389cc470" +dependencies = [ + "android_system_properties", + "core-foundation-sys", + "iana-time-zone-haiku", + "js-sys", + "log", + "wasm-bindgen", + "windows-core", +] + +[[package]] +name = "iana-time-zone-haiku" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f31827a206f56af32e590ba56d5d2d085f558508192593743f16b2306495269f" +dependencies = [ + "cc", +] + +[[package]] +name = "icu_collections" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fe090a42a0d3140fed8c63263ed1fecc02422cb2f4bfe55cd8de2de1b8e105dd" +dependencies = [ + "displaydoc", + "potential_utf", + "utf8_iter", + "yoke", + "zerofrom", + "zerovec", +] + +[[package]] +name = "icu_locale_core" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "25d29b57c17c6528d0dc4c2141cfa2d08200465acb537a3909c8b9b8a4a984c0" +dependencies = [ + "displaydoc", + "litemap", + "tinystr", + "writeable", + "zerovec", +] + +[[package]] +name = "icu_normalizer" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "404a3b8c486f205c87fe7f23ab6894d84a4ad76d6e4671ae1981ba7def87c599" +dependencies = [ + "icu_collections", + "icu_normalizer_data", + "icu_properties", + "icu_provider", + "smallvec", + "zerovec", +] + +[[package]] +name = "icu_normalizer_data" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "20f0088bfb7441f7a37fa0c9e20cb1e9cba1cac6b9ce8cd2a6dc44294f8e8cbc" + +[[package]] +name = "icu_properties" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2ea83d991c56158f7cf898bf86436c1dfe7c07ee82fe88951f2695c9f37a379f" +dependencies = [ + "displaydoc", + "icu_collections", + "icu_locale_core", + "icu_properties_data", + "icu_provider", + "zerotrie", + "zerovec", +] + +[[package]] +name = "icu_properties_data" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b98f29af82d02b163fe50161388350e743bb3107cc8e8c2f7314cb505faddfcf" + +[[package]] +name = "icu_provider" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "413099315636c588ee8f011190b329b971a09a8fae9d157e01dcae8379468514" +dependencies = [ + "displaydoc", + "icu_locale_core", + "writeable", + "yoke", + "zerofrom", + "zerotrie", + "zerovec", +] + +[[package]] +name = "idna" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3b0875f23caa03898994f6ddc501886a45c7d3d62d04d2d90788d47be1b1e4de" +dependencies = [ + "idna_adapter", + "smallvec", + "utf8_iter", +] + +[[package]] +name = "idna_adapter" +version = "1.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cb68373c0d6620ef8105e855e7745e18b0d00d3bdb07fb532e434244cdb9a714" +dependencies = [ + "icu_normalizer", + "icu_properties", +] + +[[package]] +name = "indexmap" +version = "2.14.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cc4e190f5d26ca7051642629da2c52fc03bde85a03197c99408dcd291734c855" +dependencies = [ + "equivalent", + "hashbrown 0.17.2", +] + +[[package]] +name = "inout" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "879f10e63c20629ecabbb64a8010319738c66a5cd0c29b02d63d272b03751d01" +dependencies = [ + "block-padding", + "generic-array", +] + +[[package]] +name = "inout" +version = "0.2.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3a580c13f0ffc335ef42dd3f6b1a41b726051c5e1656d9a3aa6fddb3c5dfbbf9" +dependencies = [ + "hybrid-array", +] + +[[package]] +name = "itoa" +version = "1.0.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3bd1574e617a9a6c1f8f8181bd7e841e1f20e4277607ef28945765188d6284d4" + +[[package]] +name = "jobserver" +version = "0.1.35" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1c00acbd29eabad4a2392fa0e921c874934dbbf4194312ad20f04a0ed67a3cb3" +dependencies = [ + "getrandom 0.4.3", + "libc", +] + +[[package]] +name = "js-sys" +version = "0.3.107" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8dc09d2154098bbf4ef54eab6b117a3c24cbbffe94046b16ee6d6d4510584d3a" +dependencies = [ + "cfg-if", + "futures-util", + "wasm-bindgen", +] + +[[package]] +name = "libc" +version = "0.2.191" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "65cd87c9a6d60536580b316ad985726104730a5151c99845f2490428ef91240a" + +[[package]] +name = "libfuzzer-sys" +version = "0.4.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a9fd2f41a1cba099f79a0b6b6c35656cf7c03351a7bae8ff0f28f25270f929d2" +dependencies = [ + "arbitrary", + "cc", +] + +[[package]] +name = "libredox" +version = "0.1.25" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "61ff90caf6077a803a240f62fdbe88645a890bbca49ef8174c3cb0404362171d" +dependencies = [ + "libc", +] + +[[package]] +name = "libsqlite3-sys" +version = "0.40.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b06e69070b7e12262b0cd90832f0a7396f142a2b330181255562decf9f0c6215" +dependencies = [ + "pkg-config", + "vcpkg", +] + +[[package]] +name = "litemap" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "47d9d19d1d6efa0109d2f65ff4c85cddd50bd572e5a00127ab10987290bcefae" + +[[package]] +name = "lmdb-master-sys" +version = "0.2.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aaeb9bd22e73bd1babffff614994b341e9b2008de7bb73bf1f7e9154f1978f8b" +dependencies = [ + "cc", + "doxygen-rs", + "libc", +] + +[[package]] +name = "lock_api" +version = "0.4.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "224399e74b87b5f3557511d98dff8b14089b3dadafcab6bb93eab67d3aace965" +dependencies = [ + "scopeguard", +] + +[[package]] +name = "log" +version = "0.4.35" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5d15f86d12da44cd8d4ec3c73984537eb7f4cadcb9776a575a0a8a05ca11005c" + +[[package]] +name = "md-5" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "69b6441f590336821bb897fb28fc622898ccceb1d6cea3fde5ea86b090c4de98" +dependencies = [ + "cfg-if", + "digest", +] + +[[package]] +name = "memchr" +version = "2.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cf8baf1c55e62ffcace7a9f06f4bd9cd3f0c4beb022d3b367256b91b87513d98" + +[[package]] +name = "mio" +version = "1.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "20521a903f02b0a573cd6840e9d0a5a0cc043d361fe924092cd70f8556cc9c4a" +dependencies = [ + "libc", + "wasi", + "windows-sys 0.61.2", +] + +[[package]] +name = "negentropy" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fd6f12461d14b5768028d39fab3cdfbcefb0bc7f09e95f413a00b6fdedcc9c2d" + +[[package]] +name = "nostream-config" +version = "0.1.0" +dependencies = [ + "chrono", + "nostream-core", + "serde", + "serde_json", + "serde_yaml", + "thiserror", + "url", +] + +[[package]] +name = "nostream-core" +version = "0.1.0" +dependencies = [ + "aes", + "base64", + "bech32", + "cbc", + "chacha20", + "getrandom 0.3.4", + "hex", + "hkdf", + "hmac", + "negentropy", + "secp256k1", + "serde", + "serde_json", + "sha2", + "thiserror", + "tokio", + "url", +] + +[[package]] +name = "nostream-fuzz" +version = "0.0.0" +dependencies = [ + "libfuzzer-sys", + "nostream-config", + "nostream-core", + "nostream-relay", + "serde_json", + "serde_yaml", +] + +[[package]] +name = "nostream-relay" +version = "0.1.0" +dependencies = [ + "chrono", + "futures-util", + "hex", + "hmac", + "nostream-config", + "nostream-core", + "nostream-storage", + "serde", + "serde_json", + "sha2", + "thiserror", + "tokio", + "tokio-tungstenite", + "tracing", +] + +[[package]] +name = "nostream-storage" +version = "0.1.0" +dependencies = [ + "chrono", + "futures-core", + "futures-util", + "heed", + "nostream-config", + "nostream-core", + "serde", + "serde_json", + "sqlx", + "thiserror", + "tokio", + "tracing", + "uuid", +] + +[[package]] +name = "num-traits" +version = "0.2.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" +dependencies = [ + "autocfg", +] + +[[package]] +name = "objc2-core-foundation" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2a180dd8642fa45cdb7dd721cd4c11b1cadd4929ce112ebd8b9f5803cc79d536" +dependencies = [ + "bitflags", +] + +[[package]] +name = "objc2-system-configuration" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7216bd11cbda54ccabcab84d523dc93b858ec75ecfb3a7d89513fa22464da396" +dependencies = [ + "objc2-core-foundation", +] + +[[package]] +name = "once_cell" +version = "1.21.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9f7c3e4beb33f85d45ae3e3a1792185706c8e16d043238c593331cc7cd313b50" + +[[package]] +name = "page_size" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "30d5b2194ed13191c1999ae0704b7839fb18384fa22e49b57eeaa97d79ce40da" +dependencies = [ + "libc", + "winapi", +] + +[[package]] +name = "parking" +version = "2.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f38d5652c16fde515bb1ecef450ab0f6a219d619a7274976324d5e377f7dceba" + +[[package]] +name = "parking_lot" +version = "0.12.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "93857453250e3077bd71ff98b6a65ea6621a19bb0f559a85248955ac12c45a1a" +dependencies = [ + "lock_api", + "parking_lot_core", +] + +[[package]] +name = "parking_lot_core" +version = "0.9.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2621685985a2ebf1c516881c026032ac7deafcda1a2c9b7850dc81e3dfcb64c1" +dependencies = [ + "cfg-if", + "libc", + "redox_syscall", + "smallvec", + "windows-link", +] + +[[package]] +name = "percent-encoding" +version = "2.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b4f627cb1b25917193a259e49bdad08f671f8d9708acfd5fe0a8c1455d87220" + +[[package]] +name = "phf" +version = "0.11.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fd6780a80ae0c52cc120a26a1a42c1ae51b247a253e4e06113d23d2c2edd078" +dependencies = [ + "phf_macros", + "phf_shared", +] + +[[package]] +name = "phf_generator" +version = "0.11.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3c80231409c20246a13fddb31776fb942c38553c51e871f8cbd687a4cfb5843d" +dependencies = [ + "phf_shared", + "rand 0.8.8", +] + +[[package]] +name = "phf_macros" +version = "0.11.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f84ac04429c13a7ff43785d75ad27569f2951ce0ffd30a3321230db2fc727216" +dependencies = [ + "phf_generator", + "phf_shared", + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "phf_shared" +version = "0.11.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67eabc2ef2a60eb7faa00097bd1ffdb5bd28e62bf39990626a582201b7a754e5" +dependencies = [ + "siphasher", +] + +[[package]] +name = "pin-project-lite" +version = "0.2.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c938015719552d665fd0553b90d96cd7ff58e83e4c061ca99e6bb78865a72752" + +[[package]] +name = "pkg-config" +version = "0.3.34" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f6b464fbc74e149a392436b17d523f769e057cb6877f6a5c4618bc6f11800548" + +[[package]] +name = "potential_utf" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d83eb9bc6d8e5cf568e7a1101d60ee05e81ed50ea106026f3d18deeb046d7661" +dependencies = [ + "zerovec", +] + +[[package]] +name = "ppv-lite86" +version = "0.2.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85eae3c4ed2f50dcfe72643da4befc30deadb458a9b590d720cde2f2b1e97da9" +dependencies = [ + "zerocopy", +] + +[[package]] +name = "proc-macro2" +version = "1.0.107" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "985e7ec9bb745e6ce6535b544d84d6cd6f7ad8bd711c398938ae983b91a766d9" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "quote" +version = "1.0.47" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fbf4db142a473a8d80c26bbf18454ed458bf8d26c8219c331daecfdbd079001" +dependencies = [ + "proc-macro2", +] + +[[package]] +name = "r-efi" +version = "5.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "69cdb34c158ceb288df11e18b4bd39de994f6657d83847bdffdbd7f346754b0f" + +[[package]] +name = "r-efi" +version = "6.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8dcc9c7d52a811697d2151c701e0d08956f92b0e24136cf4cf27b57a6a0d9bf" + +[[package]] +name = "rand" +version = "0.8.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e058c7de0b26af77780c769414d6257830bb240f3c38477dbc2c16e5f54d6d4c" +dependencies = [ + "rand_core 0.6.4", +] + +[[package]] +name = "rand" +version = "0.9.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9ef1d0d795eb7d84685bca4f72f3649f064e6641543d3a8c415898726a57b41" +dependencies = [ + "rand_chacha", + "rand_core 0.9.5", +] + +[[package]] +name = "rand" +version = "0.10.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f6fa277c67e6ea590466f04c3fe82cb509f0864fe470643e5570de9514a9b11" +dependencies = [ + "chacha20", + "getrandom 0.4.3", + "rand_core 0.10.1", +] + +[[package]] +name = "rand_chacha" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3022b5f1df60f26e1ffddd6c66e8aa15de382ae63b3a0c1bfc0e4d3e3f325cb" +dependencies = [ + "ppv-lite86", + "rand_core 0.9.5", +] + +[[package]] +name = "rand_core" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" + +[[package]] +name = "rand_core" +version = "0.9.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "76afc826de14238e6e8c374ddcc1fa19e374fd8dd986b0d2af0d02377261d83c" +dependencies = [ + "getrandom 0.3.4", +] + +[[package]] +name = "rand_core" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "63b8176103e19a2643978565ca18b50549f6101881c443590420e4dc998a3c69" + +[[package]] +name = "redox_syscall" +version = "0.5.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed2bf2547551a7053d6fdfafda3f938979645c44812fbfcda098faae3f1a362d" +dependencies = [ + "bitflags", +] + +[[package]] +name = "ring" +version = "0.17.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a4689e6c2294d81e88dc6261c768b63bc4fcdb852be6d1352498b114f61383b7" +dependencies = [ + "cc", + "cfg-if", + "getrandom 0.2.17", + "libc", + "untrusted", + "windows-sys 0.52.0", +] + +[[package]] +name = "rustls" +version = "0.23.46" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "48e13bd8c0e9365c43cfa5c9e8f9ad49d3c8444926c9aac819e0e4dc503c8fdf" +dependencies = [ + "once_cell", + "ring", + "rustls-pki-types", + "rustls-webpki", + "subtle", + "zeroize", +] + +[[package]] +name = "rustls-pki-types" +version = "1.16.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "102f35f7de7b06d8c61f1cff6592f5253e0dea431c74867aad5dfd70f44663fb" +dependencies = [ + "zeroize", +] + +[[package]] +name = "rustls-webpki" +version = "0.103.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3a0760a887c14823fca5a1c970b01d47c328c696c0c64829d1df50e8f853fd5" +dependencies = [ + "ring", + "rustls-pki-types", + "untrusted", +] + +[[package]] +name = "rustversion" +version = "1.0.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cf54715a573b99ac80df0bc206da022bcd442c974952c7b9720069370852e21f" + +[[package]] +name = "ryu" +version = "1.0.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9774ba4a74de5f7b1c1451ed6cd5285a32eddb5cccb8cc655a4e50009e06477f" + +[[package]] +name = "scopeguard" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" + +[[package]] +name = "secp256k1" +version = "0.33.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d7f404a8dab7a7a5a631e741d8699aa9c8e1d689fc26ccf897c7187565490b69" +dependencies = [ + "rand 0.9.5", + "secp256k1-sys", +] + +[[package]] +name = "secp256k1-sys" +version = "0.14.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f6b2992d4a3cd244539a7d5d0966aadbe5ca7fb868a5d7e38c29499b9e709bbd" +dependencies = [ + "cc", +] + +[[package]] +name = "serde" +version = "1.0.229" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4148590afebada386688f18773da617792bf2ef03ffc1e4cbd2b1d45b023e0ba" +dependencies = [ + "serde_core", + "serde_derive", +] + +[[package]] +name = "serde_core" +version = "1.0.229" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "67dca2c9c51e58a4791a4b1ed58308b39c64224d349a935ab5039aa360942a48" +dependencies = [ + "serde_derive", +] + +[[package]] +name = "serde_derive" +version = "1.0.229" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e7a5d71263a5a7d47b41f6b3f06ba276f10cc18b0931f1799f710578e2309348" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.10", +] + +[[package]] +name = "serde_json" +version = "1.0.154" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e7e9cc8b1b85264074fbcc02a88680c4096b1e47df8f739dceb03bf482f04bd6" +dependencies = [ + "itoa", + "memchr", + "serde", + "serde_core", + "zmij", +] + +[[package]] +name = "serde_yaml" +version = "0.9.34+deprecated" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6a8b1a1a2ebf674015cc02edccce75287f1a0130d394307b36743c2f5d504b47" +dependencies = [ + "indexmap", + "itoa", + "ryu", + "serde", + "unsafe-libyaml", +] + +[[package]] +name = "sha1" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aacc4cc499359472b4abe1bf11d0b12e688af9a805fa5e3016f9a386dc2d0214" +dependencies = [ + "cfg-if", + "cpufeatures 0.3.1", + "digest", +] + +[[package]] +name = "sha2" +version = "0.11.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5b0e5c7d67bc53f435386b2130fdc900488c5703770f6d8a4633060e34288a27" +dependencies = [ + "cfg-if", + "cpufeatures 0.3.1", + "digest", +] + +[[package]] +name = "shlex" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8fadd59c855ef2080decdef8ff161eb6661b86933c9d82e5ba29dc602a55aba" + +[[package]] +name = "signal-hook-registry" +version = "1.4.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c4db69cba1110affc0e9f7bcd48bbf87b3f4fc7c61fc9155afd4c469eb3d6c1b" +dependencies = [ + "errno", + "libc", +] + +[[package]] +name = "siphasher" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "33f4fe9184a62d842c9ef383018f3306d8ba224fd9d836f56d7288308847c256" + +[[package]] +name = "slab" +version = "0.4.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c790de23124f9ab44544d7ac05d60440adc586479ce501c1d6d7da3cd8c9cf5" + +[[package]] +name = "smallvec" +version = "1.16.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3244542535d5de959d90ec55d1b5ff0fd2bb7b1310223907d5f11932847f7b59" +dependencies = [ + "serde", +] + +[[package]] +name = "socket2" +version = "0.6.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3d1e2c7f27f8d4cb10542a02c49005dbd6e93095799d6f3be745fae9f8fedd4" +dependencies = [ + "libc", + "windows-sys 0.61.2", +] + +[[package]] +name = "spin" +version = "0.9.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3763264f6b73151db08c50ff20d7d8a0b8796e021cdea7ceedad07b80155fa0e" +dependencies = [ + "lock_api", +] + +[[package]] +name = "sqlx" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "edb1dddfbdfe5fb99dba0541a87b2edb8adbd59e45815db22d32d4fbbb8813dd" +dependencies = [ + "sqlx-core", + "sqlx-macros", + "sqlx-mysql", + "sqlx-postgres", + "sqlx-sqlite", +] + +[[package]] +name = "sqlx-core" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c08f9787cc5aff062567dea2205f8ae37a617b04342633ab4f74944858ea6072" +dependencies = [ + "base64", + "bytes", + "cfg-if", + "chrono", + "crc", + "crossbeam-queue", + "either", + "event-listener", + "futures-core", + "futures-intrusive", + "futures-io", + "futures-util", + "hashbrown 0.16.1", + "hashlink", + "indexmap", + "log", + "memchr", + "percent-encoding", + "rustls", + "serde", + "serde_json", + "sha2", + "smallvec", + "thiserror", + "tokio", + "tokio-stream", + "tracing", + "url", + "webpki-roots 1.0.12", +] + +[[package]] +name = "sqlx-macros" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bf62c58a1e7fd6031ee684eee21d07572f5aebe71c273a01ae4f04eeeba47c47" +dependencies = [ + "proc-macro2", + "quote", + "sqlx-core", + "sqlx-macros-core", + "syn 2.0.119", +] + +[[package]] +name = "sqlx-macros-core" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c1ff75c9d609ac84aa8a3e0d92b5c0c54bf541a7f70db492fb40c9a4bea792c8" +dependencies = [ + "cfg-if", + "dotenvy", + "either", + "heck", + "hex", + "proc-macro2", + "quote", + "serde", + "serde_json", + "sha2", + "sqlx-core", + "sqlx-mysql", + "sqlx-postgres", + "sqlx-sqlite", + "syn 2.0.119", + "thiserror", + "tokio", + "url", +] + +[[package]] +name = "sqlx-mysql" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "19eeb93b96eb10a3a59dfb436f3daf87d2fc41168ed9e9dc153ec8257dd6a761" +dependencies = [ + "bitflags", + "byteorder", + "bytes", + "chrono", + "crc", + "digest", + "dotenvy", + "either", + "futures-core", + "futures-util", + "generic-array", + "log", + "percent-encoding", + "serde", + "sha1", + "sha2", + "sqlx-core", + "thiserror", + "tracing", +] + +[[package]] +name = "sqlx-postgres" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b0e9e02f764a1fe640eeefc8eb33eeddd274204654ec9f2db8ff851a1dee2364" +dependencies = [ + "atoi", + "base64", + "bitflags", + "byteorder", + "chrono", + "crc", + "dotenvy", + "etcetera", + "futures-channel", + "futures-core", + "futures-util", + "hex", + "hkdf", + "hmac", + "itoa", + "log", + "md-5", + "memchr", + "rand 0.10.4", + "serde", + "serde_json", + "sha2", + "smallvec", + "sqlx-core", + "stringprep", + "thiserror", + "tracing", + "whoami", +] + +[[package]] +name = "sqlx-sqlite" +version = "0.9.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "88b6b78a34ddcb1db4046d462db8f79cee811019d7297b99fca8fac5de26672e" +dependencies = [ + "atoi", + "chrono", + "flume", + "form_urlencoded", + "futures-channel", + "futures-core", + "futures-executor", + "futures-intrusive", + "futures-util", + "libsqlite3-sys", + "log", + "percent-encoding", + "serde", + "sqlx-core", + "thiserror", + "tracing", + "url", +] + +[[package]] +name = "stable_deref_trait" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ce2be8dc25455e1f91df71bfa12ad37d7af1092ae736f3a6cd0e37bc7810596" + +[[package]] +name = "stringprep" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7b4df3d392d81bd458a8a621b8bffbd2302a12ffe288a9d931670948749463b1" +dependencies = [ + "unicode-bidi", + "unicode-normalization", + "unicode-properties", +] + +[[package]] +name = "subtle" +version = "2.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" + +[[package]] +name = "syn" +version = "2.0.119" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "872831b642d1a07999a962a351ed35b955ea2cfc8f3862091e2a240a84f17297" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "syn" +version = "3.0.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ae9ccbea3a7b0b09443036490c8f34a8b1b760fd345e5c0dae0aac718faea79" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "synchronoise" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3dbc01390fc626ce8d1cffe3376ded2b72a11bb70e1c75f404a210e4daa4def2" +dependencies = [ + "crossbeam-queue", +] + +[[package]] +name = "synstructure" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "901704edd0dfe137f1987838ee4f259e4e063c31371bdb423f7ae38ec6f77f02" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.10", +] + +[[package]] +name = "thiserror" +version = "2.0.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09e52cb86a36cede5cb101bf8908837b3e4c6e5e59fe7fd85c23fb56200d189e" +dependencies = [ + "thiserror-impl", +] + +[[package]] +name = "thiserror-impl" +version = "2.0.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fe5197923287db20a58125f0bc85c062f7f2c892de97b18c356f9efb14b28524" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.10", +] + +[[package]] +name = "tinystr" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "abc840c238154d58f9e86b2792261edfde565a17696e1cda1a449de27979801a" +dependencies = [ + "displaydoc", + "zerovec", +] + +[[package]] +name = "tinyvec" +version = "1.13.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fd3ca314f692efd6c868f8408f53fe444634a845f96c028b97d35f6a1f79f0ee" + +[[package]] +name = "tokio" +version = "1.54.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b52fd3255258d26fac7264ab5a76b53c13367136dc011d3d6ad4f8ed070396a3" +dependencies = [ + "bytes", + "libc", + "mio", + "pin-project-lite", + "signal-hook-registry", + "socket2", + "tokio-macros", + "windows-sys 0.61.2", +] + +[[package]] +name = "tokio-macros" +version = "2.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "78773a2a397f451582ce068015985c33193cf6dea8b74d2a639fe457b2f07b0e" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.10", +] + +[[package]] +name = "tokio-rustls" +version = "0.26.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c9cc2678c2cdd569ef8215e2afd7954ada2ae20b4fdd2c5fe6139a3b02d105db" +dependencies = [ + "rustls", + "tokio", +] + +[[package]] +name = "tokio-stream" +version = "0.1.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a3d06f0b082ba57c26b79407372e57cf2a1e28124f78e9479fe80322cf53420b" +dependencies = [ + "futures-core", + "pin-project-lite", + "tokio", +] + +[[package]] +name = "tokio-tungstenite" +version = "0.30.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "17a073bfed563fa236697a068031408a93cd9522e08abf9933ead3e73411bd71" +dependencies = [ + "futures-util", + "log", + "rustls", + "rustls-pki-types", + "tokio", + "tokio-rustls", + "tungstenite", + "webpki-roots 0.26.11", +] + +[[package]] +name = "tracing" +version = "0.1.44" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "63e71662fa4b2a2c3a26f570f037eb95bb1f85397f3cd8076caed2f026a6d100" +dependencies = [ + "log", + "pin-project-lite", + "tracing-attributes", + "tracing-core", +] + +[[package]] +name = "tracing-attributes" +version = "0.1.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7490cfa5ec963746568740651ac6781f701c9c5ea257c58e057f3ba8cf69e8da" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "tracing-core" +version = "0.1.36" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "db97caf9d906fbde555dd62fa95ddba9eecfd14cb388e4f491a66d74cd5fb79a" +dependencies = [ + "once_cell", +] + +[[package]] +name = "tungstenite" +version = "0.30.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e48ac77174b19c110a50ab2128b24215ac9cb40e0e12e093fb602d175c569d22" +dependencies = [ + "bytes", + "data-encoding", + "http", + "httparse", + "log", + "rand 0.10.4", + "rustls", + "rustls-pki-types", + "sha1", + "thiserror", +] + +[[package]] +name = "typenum" +version = "1.20.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6f5e870be6c3b371b77fe0ee0bafb859fa4964b4404c27de1d380043c4dda20" + +[[package]] +name = "unicode-bidi" +version = "0.3.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c1cb5db39152898a79168971543b1cb5020dff7fe43c8dc468b0885f5e29df5" + +[[package]] +name = "unicode-ident" +version = "1.0.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a2c754d6c33795a1c324727428e5a7dedb5b06195f9890bdbcba760d3e246563" + +[[package]] +name = "unicode-normalization" +version = "0.1.26" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "75cd3fb03d5288b3ba9a1ee103ac7e9cbb59f0b03d64f8ddfcc04dd42758a85d" +dependencies = [ + "tinyvec", +] + +[[package]] +name = "unicode-properties" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "993ad287eb20e8ba755312801cfe1413e0f25d604075863acaddca10b04c1833" + +[[package]] +name = "unsafe-libyaml" +version = "0.2.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "673aac59facbab8a9007c7f6108d11f63b603f7cabff99fabf650fea5c32b861" + +[[package]] +name = "untrusted" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1" + +[[package]] +name = "url" +version = "2.5.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f00cd2407bb42c0ef17be88d4cf020f5cceffd121665bac9b8b9493a369b3b1a" +dependencies = [ + "form_urlencoded", + "idna", + "percent-encoding", + "serde", +] + +[[package]] +name = "utf8_iter" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "af3bd9d3e571c26fcce9d033b87ea5ab061b8d2ffe9b7a5675d810d68f03edf0" +dependencies = [ + "utf_types", +] + +[[package]] +name = "utf_types" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3a3b425286980a367278453f3b6d28cdcb134b574e5a35824a6ff5eebad50bb6" + +[[package]] +name = "uuid" +version = "1.29.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3c14b15dffa2f4bd712103e857140aa04a4f2ff6e955c77d7eb8e53ee02a3b64" +dependencies = [ + "getrandom 0.4.3", + "js-sys", + "wasm-bindgen", +] + +[[package]] +name = "vcpkg" +version = "0.2.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426" + +[[package]] +name = "version_check" +version = "0.9.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a" + +[[package]] +name = "wasi" +version = "0.11.1+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ccf3ec651a847eb01de73ccad15eb7d99f80485de043efb2f370cd654f4ea44b" + +[[package]] +name = "wasip2" +version = "1.0.4+wasi-0.2.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b67efb37e106e55ce722a510d6b5f9c17f083e5fc79afc2badeb12cc313d9487" +dependencies = [ + "wit-bindgen", +] + +[[package]] +name = "wasm-bindgen" +version = "0.2.130" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a0181c14ddd6c7b8b0b0132a5f1ea2f32be0d893cd3ea97b6e3b28886b8a3d1c" +dependencies = [ + "cfg-if", + "rustversion", + "wasm-bindgen-macro", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-macro" +version = "0.2.130" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6e931a02a39abdbf66966fc35902b5ed58344750a70885bed4ebb3d8eaf28ed9" +dependencies = [ + "quote", + "wasm-bindgen-macro-support", +] + +[[package]] +name = "wasm-bindgen-macro-support" +version = "0.2.130" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2ca4b54280e455bd831e33a6b8e734baf432fe63fbc35c42ac14ce67a043a53a" +dependencies = [ + "bumpalo", + "proc-macro2", + "quote", + "syn 3.0.10", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-shared" +version = "0.2.130" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3b1f9c3798725016c6ee5f2f57869ec0831e8bbc0ab0310a86e787e97f41389e" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "web-sys" +version = "0.3.107" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d7d179596ff5ec0f6de4db64d54011bde6289cc49603d3a6e4ce3f329207ab88" +dependencies = [ + "js-sys", + "wasm-bindgen", +] + +[[package]] +name = "webpki-roots" +version = "0.26.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "521bc38abb08001b01866da9f51eb7c5d647a19260e00054a8c7fd5f9e57f7a9" +dependencies = [ + "webpki-roots 1.0.12", +] + +[[package]] +name = "webpki-roots" +version = "1.0.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7265c9301c16a8711c992c2d8da90ee77ef54b1ed51482d6dfeb00dc756b1297" +dependencies = [ + "rustls-pki-types", +] + +[[package]] +name = "whoami" +version = "2.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "626c4bac6755d76ffc12cb01b2eac751db1996b9e0041de9aa02c8c211ddc82c" +dependencies = [ + "libc", + "libredox", + "objc2-system-configuration", + "web-sys", +] + +[[package]] +name = "winapi" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" +dependencies = [ + "winapi-i686-pc-windows-gnu", + "winapi-x86_64-pc-windows-gnu", +] + +[[package]] +name = "winapi-i686-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" + +[[package]] +name = "winapi-x86_64-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" + +[[package]] +name = "windows-core" +version = "0.62.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b8e83a14d34d0623b51dce9581199302a221863196a1dde71a7663a4c2be9deb" +dependencies = [ + "windows-implement", + "windows-interface", + "windows-link", + "windows-result", + "windows-strings", +] + +[[package]] +name = "windows-implement" +version = "0.60.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "053e2e040ab57b9dc951b72c264860db7eb3b0200ba345b4e4c3b14f67855ddf" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "windows-interface" +version = "0.59.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f316c4a2570ba26bbec722032c4099d8c8bc095efccdc15688708623367e358" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "windows-link" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0805222e57f7521d6a62e36fa9163bc891acd422f971defe97d64e70d0a4fe5" + +[[package]] +name = "windows-result" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7781fa89eaf60850ac3d2da7af8e5242a5ea78d1a11c49bf2910bb5a73853eb5" +dependencies = [ + "windows-link", +] + +[[package]] +name = "windows-strings" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7837d08f69c77cf6b07689544538e017c1bfcf57e34b4c0ff58e6c2cd3b37091" +dependencies = [ + "windows-link", +] + +[[package]] +name = "windows-sys" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" +dependencies = [ + "windows-targets", +] + +[[package]] +name = "windows-sys" +version = "0.61.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ae137229bcbd6cdf0f7b80a31df61766145077ddf49416a728b02cb3921ff3fc" +dependencies = [ + "windows-link", +] + +[[package]] +name = "windows-targets" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973" +dependencies = [ + "windows_aarch64_gnullvm", + "windows_aarch64_msvc", + "windows_i686_gnu", + "windows_i686_gnullvm", + "windows_i686_msvc", + "windows_x86_64_gnu", + "windows_x86_64_gnullvm", + "windows_x86_64_msvc", +] + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" + +[[package]] +name = "windows_i686_gnu" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b" + +[[package]] +name = "windows_i686_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" + +[[package]] +name = "windows_i686_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" + +[[package]] +name = "wit-bindgen" +version = "0.57.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ebf944e87a7c253233ad6766e082e3cd714b5d03812acc24c318f549614536e" + +[[package]] +name = "writeable" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3ad82d2a33cdc9674dc7465672f271e096168fcdbe0f799d9e6db8c5892679dc" + +[[package]] +name = "yoke" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "417ef3fcf6c300b7dbd25c85531a746931c02ad536f3cf4786ed1e88223340b3" +dependencies = [ + "stable_deref_trait", + "yoke-derive", + "zerofrom", +] + +[[package]] +name = "yoke-derive" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec8ebde2db3681e8c9980cc27822030e68752690ddfa9473e739aeb4dbde6d71" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.10", + "synstructure", +] + +[[package]] +name = "zerocopy" +version = "0.8.66" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cba8a86aee14fc8cc6c208af60854b3d4ab7185a9a369a12c648faa2716ff42a" +dependencies = [ + "zerocopy-derive", +] + +[[package]] +name = "zerocopy-derive" +version = "0.8.66" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f89bca3b96ceb3cfcb4572790402f977442270d252b9a8504ebc258760c55f94" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.119", +] + +[[package]] +name = "zerofrom" +version = "0.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0ec05a11813ea801ff6d75110ad09cd0824ddba17dfe17128ea0d5f68e6c5272" +dependencies = [ + "zerofrom-derive", +] + +[[package]] +name = "zerofrom-derive" +version = "0.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f75b4683f6c7f45248d4d64056a24298c6281e0993356d7d1b4a1a962ef10d4a" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.10", + "synstructure", +] + +[[package]] +name = "zeroize" +version = "1.9.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85ccff8a4805aba1eaa4cd4afcd49f7557dd2cf5fd79ffc37f8959466effc5aa" + +[[package]] +name = "zerotrie" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ea269c3bd32f0a32c321907a2ae912ba6f4649bb0fc764a15627e99a7095a3f" +dependencies = [ + "displaydoc", + "yoke", + "zerofrom", +] + +[[package]] +name = "zerovec" +version = "0.11.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f58a2799cfe9a1670c7ea8edbd52ef8edb93cb37a7f83bf31ba9e35d9dae6a40" +dependencies = [ + "yoke", + "zerofrom", + "zerovec-derive", +] + +[[package]] +name = "zerovec-derive" +version = "0.11.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3743ddbf47738d929cd1ae2e199d40d0162979dfe31aef8ae646d2bf00bf97a" +dependencies = [ + "proc-macro2", + "quote", + "syn 3.0.10", +] + +[[package]] +name = "zmij" +version = "1.0.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "29666d0abbfad1e3dc4dcf6144730dd3a3ab225bbbdac83319345b1b44ccfc1b" diff --git a/fuzz/Cargo.toml b/fuzz/Cargo.toml new file mode 100644 index 000000000..6193e818c --- /dev/null +++ b/fuzz/Cargo.toml @@ -0,0 +1,48 @@ +[package] +name = "nostream-fuzz" +version = "0.0.0" +publish = false +edition = "2024" + +[package.metadata] +cargo-fuzz = true + +# `[workspace]` with no members keeps this crate out of the root workspace of ten: a nested +# package without it believes it belongs to the root and `cargo metadata` refuses to run. +[workspace] + +[dependencies] +libfuzzer-sys = "=0.4.13" +nostream-config = { path = "../crates/nostream-config" } +nostream-core = { path = "../crates/nostream-core" } +nostream-relay = { path = "../crates/nostream-relay" } +serde_json = "1" +serde_yaml = "0.9" + +[[bin]] +name = "client_frame" +path = "fuzz_targets/client_frame.rs" +test = false +doc = false +bench = false + +[[bin]] +name = "filter" +path = "fuzz_targets/filter.rs" +test = false +doc = false +bench = false + +[[bin]] +name = "settings" +path = "fuzz_targets/settings.rs" +test = false +doc = false +bench = false + +[[bin]] +name = "nip11" +path = "fuzz_targets/nip11.rs" +test = false +doc = false +bench = false diff --git a/fuzz/fuzz_targets/client_frame.rs b/fuzz/fuzz_targets/client_frame.rs new file mode 100644 index 000000000..447a684a1 --- /dev/null +++ b/fuzz/fuzz_targets/client_frame.rs @@ -0,0 +1,41 @@ +//! The NIP-01 client frame parser: `nostream_core::messages::decode`. +//! +//! Invariants, on every input with no early return: +//! +//! - no input panics: `decode` is total, and libFuzzer's own report is the assertion; +//! - an accepted `Subscribe`/`Count` carries a subscription id of `1..=256` `char`s and +//! `1..=10` filters — the bounds `decode_request` enforces +//! (`crates/nostream-core/src/messages.rs:465-506`), so a change that lets a 257-character +//! id or an eleventh filter through is a finding here. + +#![no_main] + +use libfuzzer_sys::fuzz_target; + +fuzz_target!(|data: &[u8]| { + let text = String::from_utf8_lossy(data); + + match nostream_core::messages::decode(&text) { + Ok(nostream_core::messages::ClientMessage::Subscribe(message)) => { + check(&message.subscription_id, message.filters.len()); + } + Ok(nostream_core::messages::ClientMessage::Count(message)) => { + check(&message.subscription_id, message.filters.len()); + } + _ => {} + } +}); + +/// The bounds a REQ/COUNT frame's parts must satisfy once `decode` accepted it. +fn check(subscription_id: &str, filters: usize) { + let length = subscription_id.chars().count(); + + assert!( + (1..=256).contains(&length), + "accepted subscription id of {length} chars: {subscription_id:?}" + ); + assert!( + (1..=10).contains(&filters), + "accepted {filters} filters in one frame" + ); +} diff --git a/fuzz/fuzz_targets/filter.rs b/fuzz/fuzz_targets/filter.rs new file mode 100644 index 000000000..0991be8d2 --- /dev/null +++ b/fuzz/fuzz_targets/filter.rs @@ -0,0 +1,51 @@ +//! The REQ/COUNT filter parser: `nostream_core::filter::validate_filter`. +//! +//! Invariants, on every input with no early return: +//! +//! - no input panics: `validate_filter` is total, and libFuzzer's own report is the assertion; +//! - an accepted filter's `ids` and `authors` entries are 4..=64 lowercase-hex characters — +//! the prefix rule `validate_prefixes` enforces +//! (`crates/nostream-core/src/filter.rs:362-410`); +//! - an accepted filter's tag keys are `#` followed by exactly one ASCII letter — the +//! unknown-key arm and `is_generic_tag_query` refuse everything else +//! (`crates/nostream-core/src/filter.rs:179-187`, `:281-285`); +//! - a refusal carries at least one issue: an empty `Err` would be an accepted filter the +//! caller cannot distinguish from a bug. +//! +//! Bytes that are not JSON become a JSON string, so the parser is still called — and a string +//! is refused at the non-object arm, the same one `null` takes (`filter.rs:252-257`), with one +//! issue at `path: ""`. + +#![no_main] + +use libfuzzer_sys::fuzz_target; +use serde_json::Value; + +fuzz_target!(|data: &[u8]| { + let value = serde_json::from_slice::(data) + .unwrap_or_else(|_| Value::String(String::from_utf8_lossy(data).into_owned())); + + match nostream_core::filter::validate_filter(&value) { + Ok(filter) => { + for prefix in filter.ids.iter().chain(filter.authors.iter()).flatten() { + assert!( + (4..=64).contains(&prefix.len()) + && prefix + .bytes() + .all(|byte| byte.is_ascii_digit() || matches!(byte, b'a'..=b'f')), + "accepted prefix {prefix:?}" + ); + } + + for key in filter.tags.keys() { + assert!( + key.len() == 2 + && key.as_bytes()[0] == b'#' + && key.as_bytes()[1].is_ascii_alphabetic(), + "accepted tag key {key:?}" + ); + } + } + Err(issues) => assert!(!issues.is_empty(), "a refusal with no issue: {value}"), + } +}); diff --git a/fuzz/fuzz_targets/nip11.rs b/fuzz/fuzz_targets/nip11.rs new file mode 100644 index 000000000..92f8b1de9 --- /dev/null +++ b/fuzz/fuzz_targets/nip11.rs @@ -0,0 +1,131 @@ +//! The NIP-11 generator: `nostream_relay::nip11::parse_relay_pubkey` and +//! `nostream_relay::nip11::document`. +//! +//! The module's only byte-shaped entry is `parse_relay_pubkey` — the place an operator-written +//! `info.pubkey`/`info.self` becomes key material. `document` is a struct literal over typed +//! `Settings`, so it is fuzzed as a panic harness over settings derived from the same bytes. +//! +//! Invariants, on every input with no early return: +//! +//! - `parse_relay_pubkey` answers `Ok(Some(key))` only for 64 hex characters or an `npub1…` +//! form, and the key round-trips through its own hex rendering; +//! - it answers `Ok(None)` for exactly `None`, `""`, and a string that is neither 64 hex nor +//! `npub1…`; and `Err` only for an `npub1…` that does not decode, so a 64-hex string never +//! errors (`crates/nostream-relay/src/nip11.rs:196-218`); +//! - `document` does not panic and serialises to JSON for settings derived from the input, and +//! when adaptive proof-of-work is enabled the advertised `min_pow_difficulty` lies in +//! `[floorBits, ceilingBits]` — `required_difficulty` at the zero rate +//! (`crates/nostream-relay/src/nip11.rs:266`, `crates/nostream-core/src/adaptive_pow.rs:88-92`). + +#![no_main] + +use std::sync::LazyLock; + +use libfuzzer_sys::fuzz_target; +use serde_yaml::Value; + +/// The version argument; the document tests its own caller's pin, so any constant will do. +const VERSION: &str = "0.0.0-fuzz"; + +fuzz_target!(|data: &[u8]| { + let text = String::from_utf8_lossy(data); + let value = (!text.is_empty()).then(|| text.as_ref()); + let parsed = nostream_relay::nip11::parse_relay_pubkey(value); + let relay_pubkey = match &parsed { + Ok(key) => *key, + Err(_) => None, + }; + + check_outcome(&text, &parsed); + + // Every input still reaches `document`: the user's document is merged over the shipped + // defaults, and a document that does not fit the typed schema leaves the defaults in place. + let defaults = shipped_defaults(); + let user = serde_yaml::from_slice::(data).unwrap_or(Value::Null); + let merged = nostream_config::merge(defaults, &user); + let settings = + nostream_config::fit(&merged, defaults).unwrap_or_else(|_| shipped_settings().clone()); + + let document = nostream_relay::nip11::document(&settings, VERSION, relay_pubkey); + + assert!( + serde_json::to_value(&document).is_ok(), + "the document did not serialise: {document:?}" + ); + + if let Some(pow) = settings + .limits + .as_ref() + .and_then(|limits| limits.event.as_ref()) + .and_then(|event| event.pow.as_ref()) + .filter(|pow| pow.enabled) + { + // `validate_document` refuses `floorBits > ceilingBits`, so settings the relay + // actually loads always carry the interval; `fit` alone does not validate, and a fuzz + // input can reach `document` with an interval it never accepts. + if pow.floor_bits <= pow.ceiling_bits { + match document.limitation.min_pow_difficulty { + Some(difficulty) => assert!( + (u64::from(pow.floor_bits)..=u64::from(pow.ceiling_bits)).contains(&difficulty), + "min_pow_difficulty {difficulty} outside [{}, {}]", + pow.floor_bits, + pow.ceiling_bits + ), + None => assert_eq!( + pow.floor_bits, 0, + "an enabled floor of {} bits advertised no difficulty", + pow.floor_bits + ), + } + } + } +}); + +/// The three outcomes of `parse_relay_pubkey`, each asserted against the input that produced it. +fn check_outcome( + text: &str, + parsed: &Result, nostream_relay::RelayError>, +) { + let hex_key = text.len() == 64 && text.bytes().all(|byte| byte.is_ascii_hexdigit()); + let npub_form = text.to_lowercase().starts_with("npub1"); + + match parsed { + Ok(Some(key)) => { + assert!(hex_key || npub_form, "accepted a key from {text:?}"); + + let round_trip = nostream_relay::nip11::parse_relay_pubkey(Some(&key.to_string())); + + assert!( + matches!(&round_trip, Ok(Some(again)) if again == key), + "the accepted key {key} does not round-trip: {round_trip:?}" + ); + } + Ok(None) => assert!(!hex_key && !npub_form, "refused the key-shaped {text:?}"), + Err(_) => assert!( + npub_form && !hex_key, + "errored on {text:?}, which is not a malformed npub" + ), + } +} + +/// The shipped `resources/default-settings.yaml`, parsed once per process. +static DEFAULT_DOCUMENT: LazyLock = LazyLock::new(|| { + let path = + std::path::Path::new(env!("CARGO_MANIFEST_DIR")).join("../resources/default-settings.yaml"); + let raw = std::fs::read_to_string(&path).expect("the shipped defaults are readable"); + serde_yaml::from_str(&raw).expect("the shipped defaults are YAML") +}); + +fn shipped_defaults() -> &'static Value { + &DEFAULT_DOCUMENT +} + +/// The shipped defaults as typed settings, parsed once per process. +static SHIPPED_SETTINGS: LazyLock = LazyLock::new(|| { + let document = shipped_defaults(); + nostream_config::fit(document, document).expect("the shipped defaults fit their schema") +}); + +fn shipped_settings() -> &'static nostream_config::Settings { + &SHIPPED_SETTINGS +} diff --git a/fuzz/fuzz_targets/settings.rs b/fuzz/fuzz_targets/settings.rs new file mode 100644 index 000000000..221d5a13a --- /dev/null +++ b/fuzz/fuzz_targets/settings.rs @@ -0,0 +1,139 @@ +//! The settings loader: `nostream_config::load`. +//! +//! Each input is planted as an operator's settings file in a scratch directory the harness +//! creates for itself (0700, unique per execution, removed when the execution ends) and loaded +//! with the shipped `resources/default-settings.yaml` as the defaults. `load` derives the +//! user file's name from `config_base_dir` — `/settings.yaml`, then `/settings.json` +//! when the first is absent (`crates/nostream-config/src/load.rs:168,179`) — and never reads +//! `SettingsPaths.settings_file`/`legacy_settings_file`, whose only other reader is the save +//! path. So the input goes to `settings.yaml`, or to `settings.json` when its last byte is odd, +//! which is the one byte that selects between the loader's two parses. +//! +//! Invariants, on every input with no early return: +//! +//! - `load` returns `Ok` and `outcome.used_defaults || outcome.issues.is_empty()`: the fallback +//! rule (`crates/nostream-config/src/load.rs:390-439`) never reports issues without having +//! substituted the defaults; +//! - liveness: when the input does not parse as the route's document format, or parses to a +//! value that is neither null nor a mapping, `outcome.used_defaults` is `true` — a harness +//! that planted the document somewhere `load` never reads would answer every one of those +//! inputs with `used_defaults = false, issues = []` and pass the first invariant vacuously. + +#![no_main] + +use std::fs; +use std::path::{Path, PathBuf}; +use std::sync::atomic::{AtomicU64, Ordering}; + +use libfuzzer_sys::fuzz_target; +use serde_yaml::Value; + +fuzz_target!(|data: &[u8]| { + let scratch = ScratchDirectory::create(); + let directory = scratch.path(); + let json_route = data.last().is_some_and(|byte| byte % 2 == 1); + let (planted, stale) = if json_route { + ("settings.json", "settings.yaml") + } else { + ("settings.yaml", "settings.json") + }; + + let _ = fs::remove_file(directory.join(stale)); + fs::write(directory.join(planted), data).expect("plant the settings document"); + + let mut paths = nostream_config::SettingsPaths::from_config_dir(directory, directory); + paths.default_settings_file = defaults_file(); + + let outcome = nostream_config::load(&paths).expect("the shipped defaults always load"); + + assert!( + outcome.used_defaults || outcome.issues.is_empty(), + "issues without a fallback: {:?}", + outcome.issues + ); + + if expects_fallback(data, json_route) { + assert!( + outcome.used_defaults, + "a document the loader cannot use answered used_defaults=false: {:?}", + String::from_utf8_lossy(data) + ); + } +}); + +/// The directory one execution plants its document in. +/// +/// Created with `create_dir`, not `create_dir_all`: a directory that already exists is a harness +/// failure rather than one this process adopts. The 0700 mode and the per-execution suffix keep +/// another user from planting a `settings.yaml` symlink for `fs::write` to follow, and `Drop` +/// removes the directory and the planted document when the execution ends. +struct ScratchDirectory(PathBuf); + +impl ScratchDirectory { + fn create() -> Self { + static SERIAL: AtomicU64 = AtomicU64::new(0); + + let nanos = std::time::SystemTime::now() + .duration_since(std::time::UNIX_EPOCH) + .map_or(0, |elapsed| elapsed.as_nanos()); + let directory = std::env::temp_dir().join(format!( + "nostream-fuzz-settings-{}-{nanos:032x}-{:x}", + std::process::id(), + SERIAL.fetch_add(1, Ordering::Relaxed) + )); + + #[cfg(unix)] + { + use std::os::unix::fs::DirBuilderExt; + + std::fs::DirBuilder::new() + .mode(0o700) + .create(&directory) + .expect("create the fuzz scratch directory; an existing one is a harness failure"); + } + #[cfg(not(unix))] + std::fs::create_dir(&directory) + .expect("create the fuzz scratch directory; an existing one is a harness failure"); + + Self(directory) + } + + fn path(&self) -> &Path { + &self.0 + } +} + +impl Drop for ScratchDirectory { + fn drop(&mut self) { + let _ = fs::remove_dir_all(&self.0); + } +} + +/// The repository's shipped defaults: this crate's manifest directory is `fuzz/`. +fn defaults_file() -> PathBuf { + Path::new(env!("CARGO_MANIFEST_DIR")).join("../resources/default-settings.yaml") +} + +/// Whether the loader must reject this input, decided with the parser the planted file selects. +/// +/// A value of `null` is not a rejection: `load_user_settings` turns it into an empty mapping, +/// which merges to the defaults with no issue. Neither is a mapping, which the validator then +/// grades on its own. +fn expects_fallback(data: &[u8], json_route: bool) -> bool { + if json_route { + return match serde_json::from_slice::(data) { + Ok(serde_json::Value::Null) => false, + Ok(value) => !value.is_object(), + Err(_) => true, + }; + } + + match serde_yaml::from_slice::(data) { + // `load_user_settings` maps a null document to an empty override set, and + // `Value::is_null` untags first: `!tag` on an empty node is null to the loader too. + Ok(value) if value.is_null() => false, + Ok(Value::Mapping(_)) => false, + Ok(_) => true, + Err(_) => true, + } +} diff --git a/fuzz/rust-toolchain.toml b/fuzz/rust-toolchain.toml new file mode 100644 index 000000000..6de0e7320 --- /dev/null +++ b/fuzz/rust-toolchain.toml @@ -0,0 +1,5 @@ +# The fuzz crate carries its own pin: cargo-fuzz always emits `-Zsanitizer=address`, and the +# repository pin is a stable rustc that rejects `-Z`. rustup resolves this file from the +# working directory, so it applies to commands started under `fuzz/` and nowhere else. +[toolchain] +channel = "nightly-2026-08-21" diff --git a/fuzz/seeds/client_frame/close.json b/fuzz/seeds/client_frame/close.json new file mode 100644 index 000000000..5604424f9 --- /dev/null +++ b/fuzz/seeds/client_frame/close.json @@ -0,0 +1 @@ +["CLOSE","sub1"] diff --git a/fuzz/seeds/client_frame/event.json b/fuzz/seeds/client_frame/event.json new file mode 100644 index 000000000..7e9ef640a --- /dev/null +++ b/fuzz/seeds/client_frame/event.json @@ -0,0 +1 @@ +["EVENT",{"id":"b1601d26958e6508b7b9df0af609c652346c09392b6534d93aead9819a51b4ef","pubkey":"22e804d26ed16b68db5259e78449e96dab5d464c8f470bda3eb1a70467f2c793","created_at":1648339664,"kind":1,"tags":[],"content":"learning terraform rn!","sig":"ec8b2bc640c8c7e92fbc0e0a6f539da2635068a99809186f15106174d727456132977c78f3371d0ab01c108173df75750f33d8e04c4d7980bbb3fb70ba1e3848"}] diff --git a/fuzz/seeds/client_frame/not-json.txt b/fuzz/seeds/client_frame/not-json.txt new file mode 100644 index 000000000..4ef97be33 --- /dev/null +++ b/fuzz/seeds/client_frame/not-json.txt @@ -0,0 +1 @@ +{"kind": diff --git a/fuzz/seeds/client_frame/req-thirteen-elements.json b/fuzz/seeds/client_frame/req-thirteen-elements.json new file mode 100644 index 000000000..38014375f --- /dev/null +++ b/fuzz/seeds/client_frame/req-thirteen-elements.json @@ -0,0 +1 @@ +["REQ","s1",{"kinds":[1]},{"kinds":[1]},{"kinds":[1]},{"kinds":[1]},{"kinds":[1]},{"kinds":[1]},{"kinds":[1]},{"kinds":[1]},{"kinds":[1]},{"kinds":[1]},{"kinds":[1]}] diff --git a/fuzz/seeds/client_frame/req-two-filters.json b/fuzz/seeds/client_frame/req-two-filters.json new file mode 100644 index 000000000..1ee19206c --- /dev/null +++ b/fuzz/seeds/client_frame/req-two-filters.json @@ -0,0 +1 @@ +["REQ","sub1",{"kinds":[1]},{"kinds":[0],"authors":["aaaa"]}] diff --git a/fuzz/seeds/client_frame/req-unknown-key.json b/fuzz/seeds/client_frame/req-unknown-key.json new file mode 100644 index 000000000..3131664f0 --- /dev/null +++ b/fuzz/seeds/client_frame/req-unknown-key.json @@ -0,0 +1 @@ +["REQ","s1",{"unknown":["x"]}] diff --git a/fuzz/seeds/filter/base.json b/fuzz/seeds/filter/base.json new file mode 100644 index 000000000..6810f848f --- /dev/null +++ b/fuzz/seeds/filter/base.json @@ -0,0 +1 @@ +{"ids":["aaaa","bbbb","cccc"],"authors":["aaaa","bbbb","cccc"],"kinds":[0,1,2,3],"since":1000,"until":1000,"limit":100,"#e":["aa","bb","cc"],"#p":["dd","ee","ff"],"#r":["00","11","22"]} diff --git a/fuzz/seeds/filter/empty-tag-value.json b/fuzz/seeds/filter/empty-tag-value.json new file mode 100644 index 000000000..30901cbce --- /dev/null +++ b/fuzz/seeds/filter/empty-tag-value.json @@ -0,0 +1 @@ +{"#d":[""]} diff --git a/fuzz/seeds/filter/geohash-invalid.json b/fuzz/seeds/filter/geohash-invalid.json new file mode 100644 index 000000000..76493eb1f --- /dev/null +++ b/fuzz/seeds/filter/geohash-invalid.json @@ -0,0 +1 @@ +{"#g":["u4pruyda"]} diff --git a/fuzz/seeds/filter/kinds-overflow.json b/fuzz/seeds/filter/kinds-overflow.json new file mode 100644 index 000000000..ccb81d45a --- /dev/null +++ b/fuzz/seeds/filter/kinds-overflow.json @@ -0,0 +1 @@ +{"kinds":[18446744073709551616]} diff --git a/fuzz/seeds/filter/limit-overflow.json b/fuzz/seeds/filter/limit-overflow.json new file mode 100644 index 000000000..f19952482 --- /dev/null +++ b/fuzz/seeds/filter/limit-overflow.json @@ -0,0 +1 @@ +{"limit":18446744073709551616} diff --git a/fuzz/seeds/filter/search-1025.json b/fuzz/seeds/filter/search-1025.json new file mode 100644 index 000000000..1186775a2 --- /dev/null +++ b/fuzz/seeds/filter/search-1025.json @@ -0,0 +1 @@ +{"search":"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"} diff --git a/fuzz/seeds/nip11/fee-schedule.yaml b/fuzz/seeds/nip11/fee-schedule.yaml new file mode 100644 index 000000000..93c6eccd9 --- /dev/null +++ b/fuzz/seeds/nip11/fee-schedule.yaml @@ -0,0 +1,12 @@ +payments: + enabled: true + feeSchedules: + admission: + - enabled: true + description: Admission fee charged per public key in msats + amount: 1000000 + whitelists: + pubkeys: + - 22e804d26ed16b68db5259e78449e96dab5d464c8f470bda3eb1a70467f2c793 + event_kinds: + - 9735 diff --git a/fuzz/seeds/nip11/hex.txt b/fuzz/seeds/nip11/hex.txt new file mode 100644 index 000000000..8360b70a9 --- /dev/null +++ b/fuzz/seeds/nip11/hex.txt @@ -0,0 +1 @@ +22e804d26ed16b68db5259e78449e96dab5d464c8f470bda3eb1a70467f2c793 \ No newline at end of file diff --git a/fuzz/seeds/nip11/info-name.yaml b/fuzz/seeds/nip11/info-name.yaml new file mode 100644 index 000000000..046415d3d --- /dev/null +++ b/fuzz/seeds/nip11/info-name.yaml @@ -0,0 +1,2 @@ +info: + name: "x" diff --git a/fuzz/seeds/nip11/npub.txt b/fuzz/seeds/nip11/npub.txt new file mode 100644 index 000000000..ab8e32702 --- /dev/null +++ b/fuzz/seeds/nip11/npub.txt @@ -0,0 +1 @@ +npub1yt5qf5nw694k3k6jt8ncgj0fdk4463jv3arshk37kxnsgeljc7fsmhwffw \ No newline at end of file diff --git a/fuzz/seeds/nip11/pow-enabled.yaml b/fuzz/seeds/nip11/pow-enabled.yaml new file mode 100644 index 000000000..32ac73785 --- /dev/null +++ b/fuzz/seeds/nip11/pow-enabled.yaml @@ -0,0 +1,6 @@ +limits: + event: + pow: + enabled: true + floorBits: 16 + ceilingBits: 32 diff --git a/fuzz/seeds/nip11/written-pubkey.txt b/fuzz/seeds/nip11/written-pubkey.txt new file mode 100644 index 000000000..99c47fb18 --- /dev/null +++ b/fuzz/seeds/nip11/written-pubkey.txt @@ -0,0 +1 @@ +replace-with-your-pubkey-in-hex \ No newline at end of file diff --git a/fuzz/seeds/settings/broken.yaml b/fuzz/seeds/settings/broken.yaml new file mode 100644 index 000000000..cab981afb --- /dev/null +++ b/fuzz/seeds/settings/broken.yaml @@ -0,0 +1 @@ +info: [unclosed diff --git a/fuzz/seeds/settings/invalid-strategy.yaml b/fuzz/seeds/settings/invalid-strategy.yaml new file mode 100644 index 000000000..8d18e28ca --- /dev/null +++ b/fuzz/seeds/settings/invalid-strategy.yaml @@ -0,0 +1,3 @@ +limits: + rateLimiter: + strategy: random diff --git a/fuzz/seeds/settings/legacy.json b/fuzz/seeds/settings/legacy.json new file mode 100644 index 000000000..8b365c2bd --- /dev/null +++ b/fuzz/seeds/settings/legacy.json @@ -0,0 +1 @@ +{"info": {"name": "legacy"}} \ No newline at end of file diff --git a/fuzz/seeds/settings/pow-floor-above-ceiling.yaml b/fuzz/seeds/settings/pow-floor-above-ceiling.yaml new file mode 100644 index 000000000..5deb21b5d --- /dev/null +++ b/fuzz/seeds/settings/pow-floor-above-ceiling.yaml @@ -0,0 +1,6 @@ +limits: + event: + pow: + enabled: true + floorBits: 16 + ceilingBits: 8 diff --git a/fuzz/seeds/settings/unknown-section.yaml b/fuzz/seeds/settings/unknown-section.yaml new file mode 100644 index 000000000..1a92ab20a --- /dev/null +++ b/fuzz/seeds/settings/unknown-section.yaml @@ -0,0 +1 @@ +bogusSection: {}