aboutsummaryrefslogtreecommitdiff
path: root/crates/tor-dirserver
Commit message (Collapse)AuthorAgeFilesLines
* tor-dirserver: Disallow non GET methodsClara Engler2026-08-121-0/+5
|
* tor-dirserver: Improve empty body checkClara Engler2026-08-121-1/+10
| | | | This commit improves the empty body check by failing if it has happened.
* tor-dirserver: Support DirBackendPlugin kludgeClara Engler2026-08-123-2/+124
| | | | | | | | This commit adds support for the directory backend plugin kludge by adding a new wrapper struct called `DirMirrorWithBackend`. It also moves http-body-util from a development dependency to a real dependency, as this makes working with hyper a lot more comfortable.
* tor-dirserver: Remove unused_async lintClara Engler2026-08-121-1/+0
| | | | No longer required.
* tor-dirserver: Remove getters from database.rsClara Engler2026-08-112-17/+13
| | | | | | | | | | This commit removes the getters in database.rs. If the overall tor-netdoc refactoring has taught us something, then that the use of getters can be quite annoying. Therefore, this commit removes the getters and marks the respective fields as pub. Given that these data types are pub(crate) only right now, it does not matter a lot anyways.
* tor-dirserver: fix tests on OpenBSDAndrew Kloet2026-08-052-3/+3
| | | | | | Use an IPv6 loopback address instead of the unspecified address when creating test servers. The address returned by binding to [::]:0 is not valid as a connection target on OpenBSD.
* Upgrade to weak-table 0.4.0Nick Mathewson2026-08-041-1/+1
| | | | | | | | Weak-table 0.4.0 replaces the backend with hashbrown for improved performance and correctness. It adds a bunch of APIs for parity with std::collections, and deprecates the risky `ahash` feature. (I'm the maintainer at this point.)
* Bump versions for tor-* and arti-* cratesSteven Engler2026-08-031-9/+9
| | | | | | | ```bash readarray -t bump < <(maint/list-crates | grep -P '^tor-|^arti-') for crate in "${bump[@]}"; do cargo set-version --bump minor -p "${crate}"; done ```
* tor-checkable: Rename `TimeBound::check_valid_*` to `if_valid_*`Ian Jackson2026-07-231-1/+1
| | | | | | | I find these names confusing. To my mind "check" implies a function returning `Result<(), _>`. Some other APIs use `unwrap` here but I think `if` is good.
* Merge branch 'edition' into 'main'Jim Newsome2026-07-226-46/+53
|\ | | | | | | | | Bump edition of tor-dirserver and tor-dirauth See merge request tpo/core/arti!4227
| * Much formatting churn for 2024 editionIan Jackson2026-07-225-45/+52
| |
| * Bump edition of tor-dirserver and tor-dirauthIan Jackson2026-07-221-1/+1
| | | | | | | | | | Apparently these crate creations were outstanding when the workspace's edition was increased.
* | dirserver: Add a TODO about reworking the DirMirror listener typeGabriela Moldovan2026-07-221-0/+7
| |
* | dirserver: Return a dummy response from DirMirror::serve()Gabriela Moldovan2026-07-221-2/+28
|/ | | | | | | | | | | This makes the `DirMirror` return a dummy 500 response. This enables us to (manually) verify that the new relay BEGIN_DIR stream handler works as expected. We will of course need some automated e2e tests too, but for the time being a manual test should do. This will all be replaced by the real implementation, once that's ready (TODO DIRMIRROR).
* Use new TimeBound name throughout the treeIan Jackson2026-07-161-1/+1
|
* Merge branch 'remove-lint' into 'main'Jim Newsome2026-07-152-3/+1
|\ | | | | | | | | | | | | Removed unnecessary lint Closes #2556 See merge request tpo/core/arti!4210
| * Remove now-unneeded allow(clippy::cognitive_complexity)Jim Newsome2026-07-151-2/+0
| |
| * add_warning: add reference to arti#2556Jim Newsome2026-07-151-1/+1
| |
| * Removed unnecessary lintpryty262026-07-151-1/+1
| | | | | | | | Removed unnecessary lint
* | tor-dirserver: Use "plain" consensus terminology rather than "ns" (fmt)Ian Jackson2026-07-151-1/+4
| |
* | tor-dirserver: Use "plain" consensus terminology rather than "ns"Ian Jackson2026-07-151-12/+12
| | | | | | | | | | | | | | | | It doesn't make sense to say that a plain consensus is an "ns" consensus, because "ns" stands for "network status" and all consensus flavours, and indeed votes, are network statusus. That's why tor-netdoc now uses "plain". Use that here too.
* | tor-dirserver: Use real consensus types, not poc (fmt)Ian Jackson2026-07-151-4/+1
| |
* | tor-dirserver: Use real consensus types, not pocIan Jackson2026-07-151-3/+2
|/
* Merge branch 'version-bumps'Nick Mathewson2026-06-301-10/+10
|\
| * Version bumps for 2.5.0Nick Mathewson2026-06-301-10/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | Closes #2617. We've lucked out this time, and it turns out that every one of our published crates gets a minor bump. So this was generated with: ``` for cr in $(./maint/list-crates); do cargo set-version -p $cr --bump minor done ```
* | Run "fixup-features".Nick Mathewson2026-06-301-0/+1
|/
* tor-dirserver: Change "categories" in Cargo.tomlIan Jackson2026-06-221-1/+1
| | | | We already seem to use "network-programming", which kind of fits.
* Bump MSRV to 1.91Clara Engler2026-06-151-1/+1
| | | | | | | | | | | | | | | | | | | This commit bumps the MSRV to 1.91 which was released on 2025-10-30. The Cargo.toml files were updated as follows: ```sh git ls-files | \ grep ".*Cargo\.toml$" | \ xargs sed -i '' 's/^rust-version = "1\.89"$/rust-version = "1\.91"/g' ``` The following files were updated manually: ``` modified: .gitlab-ci.yml modified: README.md modified: flake.nix modified: maint/docker-android/Dockerfile ```
* tor-netdoc: authcert: use TimerangeBound for UnverifiedAuthCert::verify (fmt)Ian Jackson2026-06-101-8/+8
| | | | Precisely the result of rustfmt.
* tor-netdoc: authcert: use TimerangeBound for UnverifiedAuthCert::verifyIan Jackson2026-06-101-2/+5
| | | | | | | | | | | | | | TimerangeBound is reasonably nice and this will fit in better when we want to verify votes. Adjust the one non-test call site (in tor-dirserver) using .and_then. In the tests: * Where we expected success, call .check_valid_at and add another .unwrap(). * Where we expected signature verification failure, delete the time parameters. * Where we expected timeliness failure, call .check_valid_at and map the error. * With nontrivial tolerance, add calls to `extend_[pre_]tolerance`.
* tor-dirserver: Promote tor-checkable depIan Jackson2026-06-101-1/+1
| | | | We're going to need to talk about Timebound in the non-test code.
* everywhere: Add #[allow(clippy::string_slice)]Clara Engler2026-06-091-0/+2
| | | | | | | | This commit adds #[allow(clippy::string_slice)] to all functions in the code where string slices are used, alongside a TODO comment. We do this add the function header to have it consistent, as things like expression based allow's are still experimental.
* maint: Run maint/add_warning to deny string slicesClara Engler2026-06-095-0/+5
| | | | | | | | | | | | This commit executes maint/add_warning with the just added change to deny string slices except in tests. I recommend auditing this by checking out the previous commit followed by running the script yourself and then verifying that the diff is identical to this commit. This commit makes cargo clippy fail. We will add exceptions in the next commit.
* dirserver,netdoc: Upgrade to the latest saturating-timeGabriela Moldovan2026-06-031-1/+1
|
* tor-netdoc: Rename NetdocUnverified trait to NetdocParseableUnverifiedIan Jackson2026-06-021-2/+2
| | | | | | | | | | | | The NetdocParseableUnverified derive macro implements this trait (amongst other things). Traits and derive macros should have aligned names. This is only used for parsing, so let's keep the "Parseable" part of the name. I don't think the effort of deprecated alias, for downstream compatibility, is worth it, our compatibility policy notwithstanding.
* Bump all the unstable tor- and arti- crates to 0.43.0Gabriela Moldovan2026-06-011-8/+8
| | | | | | | | | | Done using: ``` for crate in $(./maint/list-crates | rg '^(tor|arti-)'); do cargo set-version -p $crate 0.43.0 done ```
* Merge branch 'directory-signature-3' into 'main'Clara Engler2026-05-131-16/+2
|\ | | | | | | | | tor-netdoc: Sort out netstatus signatures See merge request tpo/core/arti!3937
| * tor-netdoc: Apply deferred rustfmt churnIan Jackson2026-04-291-3/+1
| |
| * tor-netdoc: Abolish poc's netstatus signature typeIan Jackson2026-04-291-14/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Use prod's Signature instead. This gets rid of: * The old parsing code. We have a new approach based on ItemValueParseable, KeywordOrString and and DigestAlgoInSignature. * The duplicate DirectorySignaturesHashesAccu and its temporary conversions. poc's verify_timeless function needs a little adjustment for the new struct layout.
* | Upgrade rand crates to 0.10.Wesley Aptekar-Cassels2026-05-121-1/+1
| | | | | | | | | | | | | | | | | | | | | | When the circ-padding feature is enabled, we use maybenot, which does not yet support rand 0.10. In the meantime, enabling this feature pulls in rand 0.9. This is not ideal, but should be okay as a temporary situation. This also replaces the use of ReseedingRng (which was removed in 0.10) with the reseeding_rng crate. This is somewhat less performant, but it should be okay.
* | release: Bump tor- and arti- crate versions.Wesley Aptekar-Cassels2026-05-061-8/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | cargo set-version -p arti-client 0.42.0 cargo set-version -p arti-config 0.42.0 cargo set-version -p arti-relay 0.42.0 cargo set-version -p arti-rpc-client-core 0.42.0 cargo set-version -p arti-rpcserver 0.42.0 cargo set-version -p arti-testing 0.42.0 cargo set-version -p arti-ureq 0.42.0 cargo set-version -p tor-async-utils 0.42.0 cargo set-version -p tor-basic-utils 0.42.0 cargo set-version -p tor-bytes 0.42.0 cargo set-version -p tor-cell 0.42.0 cargo set-version -p tor-cert 0.42.0 cargo set-version -p tor-cert-x509 0.42.0 cargo set-version -p tor-chanmgr 0.42.0 cargo set-version -p tor-checkable 0.42.0 cargo set-version -p tor-circmgr 0.42.0 cargo set-version -p tor-config 0.42.0 cargo set-version -p tor-config-path 0.42.0 cargo set-version -p tor-consdiff 0.42.0 cargo set-version -p tor-dirclient 0.42.0 cargo set-version -p tor-dircommon 0.42.0 cargo set-version -p tor-dirmgr 0.42.0 cargo set-version -p tor-dirserver 0.42.0 cargo set-version -p tor-error 0.42.0 cargo set-version -p tor-events 0.42.0 cargo set-version -p tor-general-addr 0.42.0 cargo set-version -p tor-geoip 0.42.0 cargo set-version -p tor-guardmgr 0.42.0 cargo set-version -p tor-hsclient 0.42.0 cargo set-version -p tor-hscrypto 0.42.0 cargo set-version -p tor-hsrproxy 0.42.0 cargo set-version -p tor-hsservice 0.42.0 cargo set-version -p tor-key-forge 0.42.0 cargo set-version -p tor-keymgr 0.42.0 cargo set-version -p tor-linkspec 0.42.0 cargo set-version -p tor-llcrypto 0.42.0 cargo set-version -p tor-log-ratelim 0.42.0 cargo set-version -p tor-memquota 0.42.0 cargo set-version -p tor-memquota-cost 0.42.0 cargo set-version -p tor-netdir 0.42.0 cargo set-version -p tor-netdoc 0.42.0 cargo set-version -p tor-persist 0.42.0 cargo set-version -p tor-proto 0.42.0 cargo set-version -p tor-protover 0.42.0 cargo set-version -p tor-ptmgr 0.42.0 cargo set-version -p tor-relay-crypto 0.42.0 cargo set-version -p tor-relay-selection 0.42.0 cargo set-version -p tor-rpcbase 0.42.0 cargo set-version -p tor-rpc-connect 0.42.0 cargo set-version -p tor-rtcompat 0.42.0 cargo set-version -p tor-rtmock 0.42.0 cargo set-version -p tor-socksproto 0.42.0 cargo set-version -p tor-units 0.42.0
* | tor-dirserver: Add tor-checkable as dev-dependencyClara Engler2026-04-281-0/+1
| | | | | | | | | | This is required to do some signature validation on legacy types in an upcoming commit.
* | tor-dirserver: Fix for missing_extra_infos() for NULLClara Engler2026-04-281-0/+1
| | | | | | | | | | | | | | | | | | | | If extra-infos is set to NULL, which might be the case for micro descriptors or even router descriptors because the field is optional there, this SQL query fails because it cannot LEFT JOIN server.extra_unsigned_sha1 when this field is NULL. To fix this, we simply add an additional clause to the WHERE statement that filters such rows out.
* | tor-dirserver: Make fingerprint optional in router_descriptorClara Engler2026-04-281-2/+2
|/ | | | | | | | This commit changes the schema to make the fingerprint optional. Reason for this is, that microdescriptors are also stored in this table and microdescriptors only contain an OPTIONAL onion-key, meaning it may not always be possible to determine this value from a microdescriptor, thereby making it silly to require it here.
* tor-dirserver: Make use of only one descriptor hash in missing selectionClara Engler2026-04-271-0/+2
| | | | | | | | | | | | | | | This commit makes use of the presence of only one descriptor hash inside consensus_router_descriptor_member by adding a respective AND clause to the select statements of missing descriptors to only select the rows with a non-null SHA-1 (or SHA-2 for the sake of microdescs) in the consensus_router_descriptor_member table. This is defensive programming and should not be required in practice because the docid as well as the "XOR" CHECK should already ensure that this value is always non-NULL. However, if it still happens and slips through, the statement would return NULL rows, which is not what we want and was previously prevented by ensuring this field was never NULL in the first place.
* tor-dirserver: Store precisely one descriptor hash in schemaClara Engler2026-04-273-24/+16
| | | | | | | | | | | | | | | | | | This commit modifies the consensus_router_descriptor_member table in the database schema, removing the NOT NULL constraint on unsigned_sha1 and unsigned_sha2 by replacing it with a new CHECK constraint that checks that either one of them is set but not both. The reason for this is as follows: We are going to use this table to compute the queue of missing descriptors, which means that we can only populate this table with the data we know from the consensus. The consensus however tells us only one of those hashes, namely sha1 in the case of a consensus-ns and sha2 in the case of a consensus-md. In other words: This commit can also be seen as an effort to change the design of the operation in such a way that the queue is obtained directly from the database and not computed at the start during state transition.
* dirserver: Skip warnings re SaturatingTime::saturating_duration_sinceNick Mathewson2026-04-211-0/+2
| | | | | Rust 1.95 warns us that this is an experimental API that could be stabilized in the future.
* tor-netdoc: Rename `AuthCertUnverified::verify_self_signed`Ian Jackson2026-03-311-1/+1
| | | | | | | | | | | This method verifies all the signatures, and checks that the signing authority is in the provided list. Anyway, authcerts aren't really self-signed: they're a signature by KS_auth_id_rsa on KP_auth_sign_rsa. Note that there is also a `verify_selfcert` method which does only some of the checks, and has some code duplication. That will be cleaned up later.
* Update to rusqlite 0.39.xIan Jackson2026-03-311-2/+2
| | | | | Relax the r2d2 and rusqlite deps, and manually pick the relevant hunks from `cargo update` in Cargo.lock.
* Bump versions: tor-* and arti-* unstable cratesIan Jackson2026-03-301-8/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | As per https://gitlab.torproject.org/tpo/core/arti/-/issues/2436#note_3384773 Made with nailing-cargo -Eu set-version -p arti-client 0.41.0 nailing-cargo -Eu set-version -p arti-relay 0.41.0 nailing-cargo -Eu set-version -p arti-rpcserver 0.41.0 nailing-cargo -Eu set-version -p arti-ureq 0.41.0 nailing-cargo -Eu set-version -p arti-rpc-client-core 0.41.0 nailing-cargo -Eu set-version -p tor-basic-utils 0.41.0 nailing-cargo -Eu set-version -p tor-error 0.41.0 nailing-cargo -Eu set-version -p tor-general-addr 0.41.0 nailing-cargo -Eu set-version -p tor-geoip 0.41.0 nailing-cargo -Eu set-version -p tor-memquota-cost 0.41.0 nailing-cargo -Eu set-version -p tor-llcrypto 0.41.0 nailing-cargo -Eu set-version -p tor-cert-x509 0.41.0 nailing-cargo -Eu set-version -p tor-rtcompat 0.41.0 nailing-cargo -Eu set-version -p tor-rtmock 0.41.0 nailing-cargo -Eu set-version -p tor-async-utils 0.41.0 nailing-cargo -Eu set-version -p tor-config 0.41.0 nailing-cargo -Eu set-version -p tor-config-path 0.41.0 nailing-cargo -Eu set-version -p tor-rpc-connect 0.41.0 nailing-cargo -Eu set-version -p tor-log-ratelim 0.41.0 nailing-cargo -Eu set-version -p tor-rpcbase 0.41.0 nailing-cargo -Eu set-version -p tor-memquota 0.41.0 nailing-cargo -Eu set-version -p tor-units 0.41.0 nailing-cargo -Eu set-version -p tor-bytes 0.41.0 nailing-cargo -Eu set-version -p tor-protover 0.41.0 nailing-cargo -Eu set-version -p tor-checkable 0.41.0 nailing-cargo -Eu set-version -p tor-cert 0.41.0 nailing-cargo -Eu set-version -p tor-key-forge 0.41.0 nailing-cargo -Eu set-version -p tor-hscrypto 0.41.0 nailing-cargo -Eu set-version -p tor-socksproto 0.41.0 nailing-cargo -Eu set-version -p tor-linkspec 0.41.0 nailing-cargo -Eu set-version -p tor-cell 0.41.0 nailing-cargo -Eu set-version -p tor-persist 0.41.0 nailing-cargo -Eu set-version -p tor-keymgr 0.41.0 nailing-cargo -Eu set-version -p tor-relay-crypto 0.41.0 nailing-cargo -Eu set-version -p tor-proto 0.41.0 nailing-cargo -Eu set-version -p tor-netdoc 0.41.0 nailing-cargo -Eu set-version -p tor-consdiff 0.41.0 nailing-cargo -Eu set-version -p tor-netdir 0.41.0 nailing-cargo -Eu set-version -p tor-relay-selection 0.41.0 nailing-cargo -Eu set-version -p tor-chanmgr 0.41.0 nailing-cargo -Eu set-version -p tor-ptmgr 0.41.0 nailing-cargo -Eu set-version -p tor-dircommon 0.41.0 nailing-cargo -Eu set-version -p tor-guardmgr 0.41.0 nailing-cargo -Eu set-version -p tor-circmgr 0.41.0 nailing-cargo -Eu set-version -p tor-dirclient 0.41.0 nailing-cargo -Eu set-version -p tor-dirmgr 0.41.0 nailing-cargo -Eu set-version -p tor-dirserver 0.41.0 nailing-cargo -Eu set-version -p tor-hsclient 0.41.0 nailing-cargo -Eu set-version -p tor-hsservice 0.41.0 nailing-cargo -Eu set-version -p tor-hsrproxy 0.41.0