summaryrefslogtreecommitdiff
path: root/crates/tor-netdoc/src
Commit message (Collapse)AuthorAgeFilesLines
* hs: Prevent a client from using a `MiddleOnly` relay for onion servicesNeel Chauhan2025-05-201-4/+0
| | | | | | > The actual impact of this patch is to prevent usage of MiddleOnly > relays as Introduction Points. The Rendezvous Point logic isn't > hooked up yet - nick
* Resolve clippy warnings from 1.83Nick Mathewson2025-05-134-10/+6
| | | | | Now that our MSRV is 1.83, clippy is happy to make more recommendations for us.
* Merge branch 'proto_enforce' into 'main'Nick Mathewson2025-04-223-24/+231
|\ | | | | | | | | | | | | Enforce recommended and required protocol versions in arti-client Closes #1849 and #1923 See merge request tpo/core/arti!2929
| * netdoc: improve documentation for check_protocolsNick Mathewson2025-04-161-1/+7
| |
| * protover, *: Add documentation about what "supported" means.Nick Mathewson2025-04-161-1/+2
| |
| * Fix a pair of documentation links.Nick Mathewson2025-04-161-2/+2
| |
| * Add warnings about removing supported protocols.Nick Mathewson2025-04-161-0/+2
| |
| * Implement PartialEq for ProtoStatuses unconditionally.Nick Mathewson2025-04-161-4/+2
| |
| * protover,netdoc: Implement serde for Protocols etc.Nick Mathewson2025-04-161-2/+36
| |
| * netdoc: Put all ProtoStatuses into a single Arc<>d objectNick Mathewson2025-04-162-19/+55
| | | | | | | | | | We'll want this so that we can expose them before we expose the rest of the consensus (which we need to do for spec conformance).
| * netdoc: functionality for detecting missing subprotos.Nick Mathewson2025-04-161-2/+91
| | | | | | | | Also, add a new ErrorKind for this sort of error.
| * New functions to report supported subprotocolsNick Mathewson2025-04-161-0/+41
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Part of #1849. Note that these functions are distributed across crates, so that if (in the future) we stop doing API breaks with every release, we will get the right outputs. Note also that these functions build the list of protocols out of specific symbolic features, rather than numbers: this makes it easier to avoid errors about "which feature was Relay=4 again", and easier to avoid accidentally referring to a protocol that doesn't exist, like "Consensus" (should be "Cons") or "HsDir" (case is wrong).
* | tor-netdoc: Joined OnceLock import with other std::sync importshashcatHitman2025-04-171-2/+1
| | | | | | | | Whoops! Missed that.
* | tor-netdoc: Replace OnceCell with OnceLockhashcatHitman2025-04-171-3/+3
|/ | | | - [`once_cell::sync::OnceCell`] has been replaced by [`std::sync::OnceLock`].
* tor-netdoc: use more idiomatic rustSteven Engler2025-04-031-2/+1
|
* tor-netdoc: fix `clippy::len_zero`Steven Engler2025-04-031-1/+1
| | | | | | | | | | | | | | | | | | ```text warning: length comparison to one --> crates/tor-netdoc/src/parse/tokenize.rs:470:12 | 470 | if args.len() >= 1 { | ^^^^^^^^^^^^^^^ help: using `!is_empty` is clearer and more explicit: `!args.is_empty()` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#len_zero note: the lint level is defined here --> crates/tor-netdoc/src/lib.rs:9:9 | 9 | #![warn(clippy::all)] | ^^^^^^^^^^^ = note: `#[warn(clippy::len_zero)]` implied by `#[warn(clippy::all)]` ```
* squash! Upgrade rand dependency to 0.9.Nick Mathewson2025-03-184-9/+9
| | | | - The Rng::gen() functions have been renamed to Rng::random().
* squash! Upgrade rand dependency to 0.9.Nick Mathewson2025-03-182-2/+2
| | | | - `rand::thread_rng()` has been deprecated and renamed to `rand::rng()`
* Always use full path to rand::thread_rng().Nick Mathewson2025-03-181-2/+1
| | | | | This is partly for consistency, and partly to facilitate a global search-and-replace.
* Merge branch 'interface-abstraction-of-the-daleks' into 'main'Nick Mathewson2025-03-181-1/+0
|\ | | | | | | | | Wrap x25519-dalek and ed25519-dalek types. See merge request tpo/core/arti!2868
| * Wrap ed25519-dalek types.Nick Mathewson2025-03-181-1/+0
| | | | | | | | | | | | | | | | | | | | | | With this change, we'll no longer need to expose the types from dalek-cryptography as part of our API, and we'll have more freedom to switch ed25519 implementations, or to upgrade to a newer `rand` ahead of their schedule. Unlike with x25519-dalek, I had to tweak the API a bit: There's no way to get a &PublicKey out of a Keypair now, and implementing the old ed25519-dalek traits seemed unnecessary.
* | netdoc: Reject BOMs and NULs.Nick Mathewson2025-03-172-2/+55
| | | | | | | | | | | | | | | | | | | | | | | | Per <https://spec.torproject.org/dir-spec/netdoc.html>, our netdocs never have a BOM, and never have internal NULs. This makes Arti reject such documents. For arguments on why it's okay to increase parser strictness, see the (forthcoming) proposal 356 at torspec!342, and see older discussion at torspec#296. Closes #1739.
* | netdoc: Make some parsing init functions fallible.Nick Mathewson2025-03-179-38/+40
|/ | | | | | | I'm about to make our parsers reject some strings at construction time, so it makes sense to have these functions become fallible. This is a breaking change.
* Merge branch 'happy-families' into 'main'Nick Mathewson2025-02-254-6/+216
|\ | | | | | | | | | | | | Client implementation for happy families Closes #1848 See merge request tpo/core/arti!2792
| * netdoc: Add "family-cert" entries to routerdesc parserNick Mathewson2025-02-251-3/+79
| |
| * netdoc: Add "family-ids" line to microdesc parserNick Mathewson2025-02-122-2/+56
| |
| * netdoc: Type to represent a relay family idNick Mathewson2025-02-121-1/+81
| | | | | | | | | | This corresponds to the entries in "family-ids" in the happy families design.
* | tor-netdoc: Fix useless conversion warning.Gabriela Moldovan2025-02-241-1/+1
|/ | | | This fixes a warning that triggers on the latest stable release (1.85).
* Merge branch 'mod-module-files' into 'main'Nick Mathewson2025-01-071-0/+1
|\ | | | | | | | | clippy: deny `mod_module_files` See merge request tpo/core/arti!2689
| * clippy: deny `mod_module_files`Steven Engler2025-01-061-0/+1
| | | | | | | | | | | | Denies 'mod.rs' files for consistency. https://rust-lang.github.io/rust-clippy/master/index.html#mod_module_files
* | fix: fix typosDimitris Apostolou2025-01-061-1/+1
|/
* add_warnings, *: Allow clippy::needless_lifetimesNick Mathewson2024-12-031-0/+1
| | | | | | | | In 1.83, this warning triggers on many of our crates. We're thinking of fixing them all, but for now, we're going to disable the warning. This is part of #1765.
* PoW: Consolidate feature flags into a single flag.Wesley Aptekar-Cassels2024-11-256-17/+17
| | | | | | | | | | | | | | | | | This replaces the hs-pow, hs-pow-full, hs-pow-v1, pow-v1, and pow-full features with a single hs-pow-full feature. It's possible that in the future we will want to split different schemes into different features, but we can do that when it comes up. For now, having this as a single flag makes it clearer what's going on, since the previous thing was not actually expressive enough to capture some things we care about (like "at least one pow scheme is enabled" that works in a future-compatible way). This change is not semver breaking since it's a experimental feature. Related: #1751
* tor-netdoc: Error on PowParams::V1 when hs-pow-v1 is disabled.Wesley Aptekar-Cassels2024-11-251-2/+11
|
* tor-netdoc: Don't include pow_params in HsDesc when feature is disabled.Wesley Aptekar-Cassels2024-11-252-7/+8
|
* tor-netdoc: Support writing pow-params line.Wesley Aptekar-Cassels2024-11-253-1/+110
| | | | | | | I'm not particularly happy with the code that does the actual writing out of the pow-params line, in particular the error handling there seems very verbose. However, I don't know of a better way to structure it given that APIs I'm working with.
* TimerangeBound: Stop using std::ops::Bound.Wesley Aptekar-Cassels2024-11-252-7/+7
| | | | Fixes: #1691
* tor-netdoc: add clippy allows and `#[non_exhaustive]`Steven Engler2024-11-201-0/+2
|
* Disable a lot of dead code warningsIan Jackson2024-10-171-0/+3
| | | | | | | Now cargo check --workspace --no-default-features --all-targets cargo build -p arti --no-default-features --features=memquota,tokio,native-tls are both clean.
* Add a little test coverage for pow-params parsing.Wesley Aptekar-Cassels2024-10-091-0/+108
| | | | | | | | Cover some of the novel edge cases we're introducing around object parameters and repetition. This still feels awfully ad-hoc, but it's better than nothing. Co-authored-by: Micah Elizabeth Scott <[email protected]>
* hs-pow inner desc: broaden pow-params rule, disallow object for v1.Wesley Aptekar-Cassels2024-10-092-3/+8
| | | | | | | | | | | We should not be restricting pow-params to occur only once at the rule level, and we shouldn't be disallowing object parameters at that level either. Instead, the v1 scheme itself needs to check for and disallow objects. Future schemes may allow object parameters. Test cases for this will be added in a subsequent commit. Co-authored-by: Micah Elizabeth Scott <[email protected]>
* Fix incorrect doc comment.Wesley Aptekar-Cassels2024-10-091-1/+2
| | | | | | Looks like a copy/paste error. Co-authored-by: Micah Elizabeth Scott <[email protected]>
* hs-pow: inner doc test using canned data from C tor.Wesley Aptekar-Cassels2024-10-091-4/+39
| | | | | | | | | | | This proliferates the canned hsdesc inner doc testing strategy, adding another file with data encoded with onion-pow-example running on C tor. Tests that it parses successfully, and asserts that the pow params line contents are correct. This is a positive test only. This strategy seems problematic, but it's better than nothing. Co-authored-by: Micah Elizabeth Scott <[email protected]>
* hs-pow: Explain what the v1 scheme refers to, in PowParams.Wesley Aptekar-Cassels2024-10-091-0/+7
| | | | | | | Adds another breadcrumb as requested so new folks happening upon this in the docs can get oriented. Co-authored-by: Micah Elizabeth Scott <[email protected]>
* hs-pow: Change rule to require pow_params type parameter.Wesley Aptekar-Cassels2024-10-091-1/+1
| | | | | | | This can now notice pow_params lines which are invalid because they have no parameters. Co-authored-by: Micah Elizabeth Scott <[email protected]>
* hs-pow: Use TimerangeBound for puzzle parameters.Wesley Aptekar-Cassels2024-10-091-9/+9
| | | | Co-authored-by: Micah Elizabeth Scott <[email protected]>
* hs-pow: Refactor to prefer stub types rather than cfg sprawl.Wesley Aptekar-Cassels2024-10-095-34/+46
| | | | | | | | | | | | | | | | | | | | | | In this design, the thin multiplexing layer between PoW types is always available when onion services are in use, but the specific pow schemes (and their dependency libraries) are gated by crate features everywhere. There are now no new cfg() gates. When the pow-v1 scheme is disabled, we can parse `pow-params v1` lines into an empty type (so clients know a PoW scheme exists that might be supported if they were configured differently). We currently don't save the contents of unknown hsdesc items. On the relaycell side, the hs ext module already sets a strong precedent for keeping unrecognized data as a byte vec, and it doesn't provide a good way to signal soft parse errors like unrecognized optional extensions. There, the `v1` type is completely optional, and services lacking a pow scheme suggested by a client would see one of these 'unrecognized' blobs. This isn't necessarily helpful but it fits the rest of the design. Co-authored-by: Micah Elizabeth Scott <[email protected]>
* tor-hspow: Big refactor, dissolve this crateWesley Aptekar-Cassels2024-10-094-34/+63
| | | | | | | | | | | | | | | | | My previous strategy here was to try and centralize hspow in one crate, writing it like a self-contained feature. That introduced friction in the data types, prompting the use of simplistic types at the netdoc/cell layers and full-featured types in the optional modules. This changes tactics, dissolving the low-level parts of tor-hspow into tor-hscrypto and the high-level parts into hsclient/hsservice. Full featured types are used everywhere now, but the tradeoff is that compile-time configurability is a lot more pervasive. Anything that knows about PoW types at all needs to be fully configured out. I took this opportunity to try a more complete set of crate features, allowing users to configure individual PoW schemes. Co-authored-by: Micah Elizabeth Scott <[email protected]>
* First pass at implementing onion proof-of-work clientWesley Aptekar-Cassels2024-10-092-2/+2
| | | | | | | | This adds a module to tor-hspow for version-independent client logic. The entire module and its invocations are disabled unless the new "hs-pow" compile time feature is set. Co-authored-by: Micah Elizabeth Scott <[email protected]>
* tor-netdoc: Add parsing support for pow-params.Wesley Aptekar-Cassels2024-10-093-0/+120
| | | | | | | | This implements support for extensible proof-of-work parameters. Right now only a single type is defined, but in theory we can see up to one line per type on an onion service. Co-authored-by: Micah Elizabeth Scott <[email protected]>