summaryrefslogtreecommitdiff
path: root/crates/tor-netdoc
Commit message (Collapse)AuthorAgeFilesLines
...
| * | | tor-netdoc: routerstatus entries: Add note about location of `m` itemIan Jackson2026-06-111-0/+3
| | | |
| * | | tor-netdoc: routerstatus entries: Add `p` itemIan Jackson2026-06-115-0/+20
| | | |
| * | | tor-netdoc: routerstatus: r item: add dir-port argumentIan Jackson2026-06-113-0/+7
| | | | | | | | | | | | | | | | This was simply missing.
| * | | tor-netdoc: routerstatus: r item: add blank lines to structIan Jackson2026-06-111-0/+5
| |/ /
* | | tor-netdoc: Add RouterDesc::hidden_serive_dirClara Engler2026-06-112-0/+14
| | | | | | | | | | | | | | | Adds RouterDesc::hidden_service_dir as well as an accompanying ZST token.
* | | tor-netdoc: Replace bool with ItemPresent in RouterDesc (fmt)Clara Engler2026-06-111-1/+2
| | | | | | | | | | | | No functional change.
* | | tor-netdoc: Replace bool with ItemPresent in RouterDescClara Engler2026-06-112-4/+18
|/ / | | | | | | | | | | | | | | This commit modifies RouterDesc to replace all occurrences of `bool` with `Option<ItemPresent<T>>` while adding respective ZST tokens for the respective items. In this case, it adjusts caches_extra_info and tunnelled_dir_server.
* | Merge branch 'ntor-crosscert' into 'main'Clara Engler2026-06-114-40/+279
|\ \ | | | | | | | | | | | | Add Ed25519NtorCrossCert See merge request tpo/core/arti!4022
| * | tor-netdoc: Specify requires_signed_with_ext in ed25519_cert_invalidClara Engler2026-06-111-6/+5
| | | | | | | | | | | | | | | | | | This commit adds an argument to the generic test specifying whether the type requires the respective extension or not, in order to replace a clumsy std::any solution.
| * | tor-netdoc: Add TODO for merging generic test functionsClara Engler2026-06-111-0/+2
| | |
| * | tor-netdoc: Actually call ed25519_cert_invalid for Ed25519NtorCrossCertClara Engler2026-06-111-1/+1
| | | | | | | | | | | | | | | Accidentially made a mistake here, will merge them into a single test as a follow-up.
| * | tor-netdoc: Remove "both keys must be different" testClara Engler2026-06-111-9/+0
| | | | | | | | | | | | | | | We will not need it for Ed25519NtorCrossCert so let's remove it, as discussed in IRC.
| * | tor-netdoc: Remove #[allow(unused)]Clara Engler2026-06-111-1/+0
| | |
| * | tor-netdoc: Use .verify_inner() in .verify()Clara Engler2026-06-111-42/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | This commit removes the old .verify() method and replaces it with .verify_inner() plus the logic to actually verify the signatures and expiration dates using tor-checkable. The verification logic is purposely different as the new one was taken from the legacy one.
| * | tor-netdoc: Use .verify_inner() in legacy parserClara Engler2026-06-111-15/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This commit changes the legacy parser to make use of the just added .verify_inner() method. For this, we replace the part that extracts crosscert_cert to only extract the inner signature and expiry timestamp, because this is what will be used ultimately. Inside this extraction, we change the parser to only obtain the KeyUnknownCert without any further checks, after which we will pass it to .verify_inner() to store the signatures and expiry date. Following this change, we now only change the places where the previous crosscert_cert was used to extract signatures and expiration dates to use the just extracted cc_sig and cc_expiry instead.
| * | tor-netdoc: Ed25519NtorCrossCert::verify_inner()Clara Engler2026-06-112-1/+93
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This commit creates a new method, Ed25519NtorCrossCert::verify_inner(), which in essence represents a copying of the verification logic for ntor cross certificates from the legacy parser into parse2 logic, with the eventual goal to unify these two. Unfortunately, a 1:1 move using --color-moved was not possible, because the legacy parser uses edcert::UnvalidatedEdCert for this, which is a very legacy parser specific type, as it contains a Pos in its inner items. Instead, I encourage reviewers to review the functional equality between these two implementations using the following approach: 1. Open the .verify_inner() in one pane. 2. Open routerdesc.rs below the position where this commit introduces the "XXX" comment in another pane next to it; this is the lion's share of the legacy implementation of it. 3. Ensure that the properties that the legacy implementation achieves is also achieved by .verify_inner(). This may require you to take a look at UnvalidatedEdCert::check_cert_type() and similar methods and verify that the if statements in .verify_inner() are equivalent. As outlined above, we cannot make use of these methods directly ourselves inside .verify_inner(). Keep in mind that the legacy parser only returns a tor_cert::UncheckedCert, whereas .verify_inner() returns a gated type. This is okay because UncheckedCert contains these gated types inside it anyways.
| * | tor-netdoc: Documentation improvements for Ed25519NtorCrossCertClara Engler2026-06-111-4/+6
| | | | | | | | | Co-authored-by: Ian Jackson
| * | tor-netdoc: Add test for Ed25519NtorCrossCertClara Engler2026-06-111-0/+55
| | | | | | | | | | | | | | | | | | This commit adds the tests for Ed25519NtorCrossCert by implementing Ed25519CertTest for it and executing the respective generic test functions for it.
| * | tor-netdoc: Dynamically add signed-with violationClara Engler2026-06-111-11/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This commit changes the invalid ed25519 cert unit test violation of a missing signed-with extension if the generic type is not Ed25519NtorCrossCertificate, as this type does not use this extension. Instead, we change the test vector to a `mut Vec<_>` and push the missing signed-with test if the generic parameter IS NOT of type Ed25519NtorCrossCert.
| * | tor-netdoc: Switch invalid CertType in unit testClara Engler2026-06-111-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | Switches the invalid/out-of-place CertType away from ntor cross-cert because we will add a test for this soon. Instead, we now just an RSA certificate, should not collide with any edcert.
| * | tor-netdoc: Provide signing key in Ed25519CertTestClara Engler2026-06-111-0/+6
| | | | | | | | | | | | | | | | | | | | | This commit extends .verify() and .new_signed() in Ed25519CertTest to accept the signing key next to the certified key in order to also support Ed25519 certificates not containing the signed-with extension, such as ntor certificates.
| * | tor-netdoc: Add Ed25519NtorCrossCertClara Engler2026-06-113-2/+123
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | This commit adds the Ed25519NtorCrossCert type for use with EmbeddedCert. So far, this certificate may not be used directly tet, because of the non-trivial X25519 -> Ed25519 conversion which is explained in a doc comment. The next commits will add more parse2-like types for actually parsing it, by honoring the `bit` found in `ntor-onion-key-crosscert` items. A unit test will be added in the immediate next commit.
* | Merge branch 'validity-time-range' into 'main'Clara Engler2026-06-113-6/+16
|\ \ | |/ |/| | | | | tor-netdoc: ns preamble: break out validity_time_range See merge request tpo/core/arti!4054
| * tor-netdoc: netstatus preamble: use saturating sub for starting_timeIan Jackson2026-06-102-1/+2
| |
| * tor-netdoc: ns preamble: break out validity_time_range (tidy)Ian Jackson2026-06-031-5/+3
| | | | | | | | Remove the otiose `preamble` and `timebound_range` bindings again.
| * tor-netdoc: ns preamble: break out validity_time_rangeIan Jackson2026-06-033-7/+16
| | | | | | | | | | | | | | We are going to want to use this when we implement verification for network statuses from parse2. Review with --color-moved.
| * tor-netdoc: ns preamble: break out validity_time_range (prep)Ian Jackson2026-06-031-3/+5
| | | | | | | | | | Introduce and use bindings `preamble` and `timebound_range` that will make the next change easier to review.
* | tor-netdoc: Fix ed25519_invalid_cert unit testClara Engler2026-06-111-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | This commit fixes the ed25519_invalid_cert unit test to not use `now` as the expiration date when generating a certificate in order to test the failed verification of it. The reason for this is that we want to change the verification function to be *inclusive* of the expiry date. If we were to use `now` as the expiry date while also being at `now`, we would no longer get an error. We will do the actual change in the next commits.
* | Merge branch 'fix-eventdns-todo' into 'main'Ian Jackson2026-06-101-1/+0
|\ \ | | | | | | | | | | | | tor-netdoc: Remove accidential TODO left-over See merge request tpo/core/arti!4081
| * | tor-netdoc: Remove accidential TODO left-overClara Engler2026-06-091-1/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | This commit removes an accidential TODO left-over related to eventdns, which now appears as it would refer to caches-extra-info. I must have forgotten to rebase this out after we decided to not include eventdns in arti!4006, but looking at torspec!498, it is obvious that the comment refers to eventdns and not caches-extra-info.
* | | tor-netcoc: NetdocParseableUnverified derive: forbid NetdocParseableIan Jackson2026-06-102-0/+12
| | |
* | | tor-netdoc: parse2: Add more docs about verificationIan Jackson2026-06-101-3/+26
| | | | | | | | | | | | | | | Prompted by https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/4070#note_3422636
* | | tor-netdoc: parse2: use TimeRangebound in exampleIan Jackson2026-06-101-3/+6
| | |
* | | tor-netdoc: parse2: Deprecate check_validity_timeIan Jackson2026-06-104-1/+9
| | | | | | | | | | | | | | | | | | | | | | | | As per https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/4070#note_3422637 We must allow it in poc, but poc is a thing we're trying to abolish/replace, so that's OK.
* | | tor-netdoc: authcert: use TimerangeBound for UnverifiedAuthCert::verify (fmt)Ian Jackson2026-06-101-94/+44
| | | | | | | | | | | | Precisely the result of rustfmt.
* | | tor-netdoc: authcert: use TimerangeBound for UnverifiedAuthCert::verifyIan Jackson2026-06-102-37/+48
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-netdoc: authcert tests: add some parenthesesIan Jackson2026-06-101-4/+4
| | |
* | | tor-netdoc: authcert tests: insist on return value typeIan Jackson2026-06-101-5/+5
| | | | | | | | | | | | | | | | | | | | | We're about to make UnverifiedAuthCert::verify return a TimerangeBound, not an AuthCert. For the success cases, declare the expected return type.
* | | Merge branch 'clippy-string-slice' into 'main'Nick Mathewson2026-06-1037-0/+57
|\ \ \ | | | | | | | | | | | | | | | | Lint for clippy::string_slice See merge request tpo/core/arti!4086
| * | | everywhere: Add #[allow(clippy::string_slice)]Clara Engler2026-06-0913-0/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-0932-0/+33
| |/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* | | tor-netdoc: Fix a doc comment formatting botchIan Jackson2026-06-091-1/+1
| | |
* | | tor-netdoc: Introduce toplevel NeteworkStatus typeIan Jackson2026-06-095-0/+74
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | All of the pieces are in place for this now. Some of the pieces are not entirely complete or correct at this point: that's sorted out by other MRs already open. Currently there is no encoding, no verification functdion, and no tests. Encoding depends on another oustanding MR (arti!4058). Verification depends on the rework in arti!4065. Tests are still to come.
* | | Merge branch 'fuzz-parse2' into 'main'Nick Mathewson2026-06-092-2/+10
|\ \ \ | | | | | | | | | | | | | | | | netdoc: Add fuzzing support for parse2 with authcert, mds See merge request tpo/core/arti!4068
| * | | netdoc: Add fuzzing support for parse2 with authcert, mdsNick Mathewson2026-06-042-2/+10
| | | |
* | | | Merge branch 'deftly' into 'main'Nick Mathewson2026-06-091-1/+1
|\ \ \ \ | | | | | | | | | | | | | | | | | | | | Bump derive-deftly to 1.11.3 to get $impl See merge request tpo/core/arti!4083
| * | | | Bump derive-deftly to 1.11.3Ian Jackson2026-06-091-1/+1
| | |/ / | |/| | | | | | | | | | New beta semver policy means we should pin the patchlevel.
* | | | tor-netdoc: F64Finite, initially for votes' stats itemsIan Jackson2026-06-093-0/+135
| | | | | | | | | | | | | | | | | | | | The actual item field isn't in the struct yet, because that would produce conflicts with other outstanding work in this same struct.
* | | | tor-netdoc: document new encoding implsIan Jackson2026-06-091-0/+2
| | | |
* | | | tor-netdoc: impl EncodeOrd for SignatureIan Jackson2026-06-091-1/+8
| | | | | | | | | | | | | | | | This will let us encode consensus signatures sections.