Commit Graph

7187 Commits

Author SHA1 Message Date
Ian Jackson cc25c82d4b HS configuration: Add and honour `allow_onion_addrs` in configuration
We put this in `[address_filter]`.

The interaction with the corresponding stream preference is a bit
complicated.  We must turn the stream pref into a `BoolOrAuto`.
2023-06-28 13:32:54 +01:00
Nick Mathewson 2bee27a737 Merge branch 'hsdir-identity' into 'main'
tor-hsclient: Completely hide hsdir identities in errors

See merge request tpo/core/arti!1326
2023-06-28 12:30:22 +00:00
Ian Jackson 88e3b7a147 Merge branch 'config2' into 'main'
Overhaul art's config tests

See merge request tpo/core/arti!1320
2023-06-28 12:25:37 +00:00
Ian Jackson 41737efced tor-hsclient: Completely hide hsdir identities in errors 2023-06-28 13:02:44 +01:00
gabi-250 63a7b25711 art cfg tests: Fix garbled doc wording 2023-06-28 12:56:09 +01:00
gabi-250 d56f28bc6f arti cfg tests: Fix doc comment 2023-06-28 12:56:09 +01:00
Ian Jackson fa0fb50d80 CI: run a normal all-features-test
I think we do actually do this as part of the coverage job, but that's
not really very clear (and getting the report in that job may be
annoying).

We also do it on nightly as part of the nightly test, but that's an
"allow_fail".
2023-06-28 12:56:09 +01:00
Ian Jackson ac38c862ec arti cfg tests: Overhaul exception handling (fmt) 2023-06-28 12:56:09 +01:00
Ian Jackson c0c0beb8e1 arti cfg tests: Overhaul exception handling
This was super confusing and fragile.  Amongst the problems:

 * Information about exceptional config keys was spread across a
   number of places, manipulated in ad-hoc ways (conditional Vec
   appends, etc).

 * As a consequence, each exceptional table has confusing and unclear
   semantics.

 * It doesn't deal well with the way that cargo sometimes enables
   features for dependency crates even if arti itself wouldn't demand
   them; this can lead to sub-crates supporting config keys when the
   tests in arti don't expect them to, causing spurious test failures.

Fix this:

 * Introduce a new, systematic, way of writing information about
   configuration keys that need some kind of special handling.

 * Use this new approach in *both* sets of "thorough" config tests.

 * Be more relaxed about deprecated keys.  We don't want to tightly
   couple this to absence in the supported file, I think.

 * Understand more clearly the concept of keys of which we don't know,
   in the current build config, whether the code is expected to
   accept them.

I have tested this locally with:

   for p in '-p arti' '--workspace'; do for f in '--no-default-features --features=tokio,native-tls' '--all-features' ''; do nailing-cargo test $p $f; done; done
2023-06-28 12:56:09 +01:00
Ian Jackson 479ed9d168 arti cfg tests: Remove a comment relating to work already done
We *do* have a thing that works like this.

It's fragile and confusing and that's what I'm about to fix.
2023-06-28 12:56:09 +01:00
Ian Jackson 0cde6134d0 arti cfg tests: Code motion
Bring the exciting tests together, and move some more normal tests out
of the middle.
2023-06-28 12:56:09 +01:00
Ian Jackson 2656b8fa04 geoip: conditionalise a test
Without this, the build fails with
  cargo test --workspace --no-default-features --features=tokio,native-tls
2023-06-28 12:56:09 +01:00
Ian Jackson ebb3455b3e Conditionalise an import
Fixes a warning with
  cargo clippy --locked --offline --workspace --all-targets
2023-06-28 12:56:09 +01:00
Ian Jackson a6aa113865 Mark a builder as non-exhaustive
If all the fields vanish, this generates a warning with
  cargo clippy --locked --offline --workspace --all-targets

Fix that.
2023-06-28 12:56:09 +01:00
gabi-250 6b8218f960 Merge branch 'keymgr-error-kind' into 'main'
keymgr: Implement ErrorKind for keymgr error types

See merge request tpo/core/arti!1315
2023-06-28 11:34:23 +00:00
Alexander Færøy 26c4a274c7 Merge branch 'dirclient-todos' into 'main'
Resolve remaining dirclient HS todos

See merge request tpo/core/arti!1323
2023-06-28 11:33:32 +00:00
Gabriela Moldovan dff8c0163b keymgr: Implement HasKind for ArtiNativeKeystoreError. 2023-06-28 11:59:00 +01:00
Gabriela Moldovan 6ed8f5b9ea tor-error: Add KeystoreAccessFailed, KeystoreFsPermissions to ErrorKind. 2023-06-28 11:59:00 +01:00
Gabriela Moldovan ef1c969c73 keymgr: Implement HasKind for SshKeyError. 2023-06-28 11:59:00 +01:00
Gabriela Moldovan c8a128cc59 tor-error: Add KeystoreCorrupted to ErrorKind. 2023-06-28 11:59:00 +01:00
Nick Mathewson f778d32a0e Merge branch 'ticket_914' into 'main'
Remove support for receiving unauthenticated SENDMEs.

Closes #914

See merge request tpo/core/arti!1283
2023-06-28 10:54:05 +00:00
Nick Mathewson 6f3761c24f dirclient: use correct default max_len
Yes, it's 50 kilobytes, not 50 kibibytes. I double-checked this with
the C implementation and with param-spec.txt's documentation for
`HSV3MaxDescriptorSize`.
2023-06-27 16:21:29 -04:00
Nick Mathewson 4692dba5e0 hsclient: Use HsDescDownloadRequest::set_max_len. 2023-06-27 16:21:29 -04:00
Nick Mathewson 32e3cde3fd dirclient: Correct an erroneous comment. 2023-06-27 16:21:29 -04:00
Nick Mathewson 38db06ee4b dirclient: Make maximum hsdesc length adjustable. 2023-06-27 16:21:29 -04:00
Nick Mathewson 01ea20759b dirclient: Explain why hardcoding "3" is ok. 2023-06-27 16:04:49 -04:00
gabi-250 eb54691c50 Merge branch 'keymanip-ed-to-curve' into 'main'
llcrypto: Implement ed25519_to_curve25519_private conversion.

See merge request tpo/core/arti!1297
2023-06-27 19:10:33 +00:00
gabi-250 bf32cf16b6 Merge branch 'fix-keymgr-error-impl' into 'main'
keymgr: Fix infinite recursion in Error impl.

See merge request tpo/core/arti!1319
2023-06-27 18:51:34 +00:00
Gabriela Moldovan aa5e9b1e95 llcrypto: Add reference to paper about keypair reuse. 2023-06-27 19:23:42 +01:00
Gabriela Moldovan b466b24a18 llcrypto: Remove `# Availability` doc sections.
This removes the `# Availability` section from the
`convert_ed25519_to_curve25519_private` and
`convert_curve25519_to_ed25519_private` docs.

We don't generally have this sort of section anywhere else in the
codebase (we use unstable cargo-docs features to make sure items are
annotated correctly).
2023-06-27 19:23:42 +01:00
Gabriela Moldovan 32261d4006 llcrypto: Add cvt-x25519 feature flag for exporting key conversion functions.
The `convert_curve25519_to_ed25519_private` and
`convert_ed25519_to_curve25519_private` functions are now exported by
`tor-llcrypto` if the `cvt-25519` feature is enabled.
2023-06-27 19:23:42 +01:00
Gabriela Moldovan 9e80a206ca llcrypto: Add keymgr feature to semver.md 2023-06-27 19:23:42 +01:00
Gabriela Moldovan 94f405704f llcrypto: Add `Panics`, `Availability` docs for convert_ed25519_to_curve25519_private. 2023-06-27 19:23:42 +01:00
Gabriela Moldovan 7c44984f3d llcrypto: Fix clippy lint. 2023-06-27 19:23:42 +01:00
Gabriela Moldovan e06fc04b0b llcrypto: Explain what we need the ed25519->x25519 conversion for. 2023-06-27 19:23:42 +01:00
Gabriela Moldovan fa6290c0cc llcrypto: Document how convert_ed25519_to_curve25519_private computes the key. 2023-06-27 19:23:42 +01:00
Gabriela Moldovan 7ecb2221a0 llcrypto: Add note about bumping x25519-dalek and clamping.
This adds a TODO explaining how convert_ed25519_to_curve25519_private
will need to be audited when we upgrade to the latest x25519-dalek.

This also adds a `debug_assertions` and a test that ensures
`StaticSecret::from` is clamping the input (when we bump x25519-dalek,
the assertions will fail, as the latest version doesn't do clamping in
StaticSecret::from).
2023-06-27 19:23:42 +01:00
Gabriela Moldovan 1fe15c5012 llcrypto: Document ed25519->curve25519->ed25519 conversion behaviour. 2023-06-27 19:23:42 +01:00
Gabriela Moldovan 47606ad881 llcrypto: Implement ed25519_to_curve25519_private conversion.
In `ArtiNativeKeyStore`, private keys are stored in OpenSSH format.
However, `ssh-key` (the crate we use for parsing OpenSSH keys) doesn't
support x25519 keys. As a workaround, this type of key will stored
as ed25519 and converted to x25519 upon retrieval.

This commit implements the `convert_ed25519_to_curve25519_private`
conversion function (needed by `ArtiNativeKeyStore` to support x25519
keys).

Part of #900
2023-06-27 19:23:42 +01:00
Gabriela Moldovan 58a4cc3000 llcrypto: Add missing docs for hsv3-service feature flag. 2023-06-27 19:23:42 +01:00
Gabriela Moldovan 6dfcf40d20 keymgr: Add regression test for tor_keymgr::Error recursion bug. 2023-06-27 19:22:30 +01:00
Gabriela Moldovan a41c3a5c7c keymgr: Fix infinite recursion in Error impl.
The `source` impl `tor_keymgr::Error` was just calling itself
recursively.
2023-06-27 19:22:30 +01:00
Nick Mathewson dd7b965199 Merge branch 'revert_to_x25519_pre1' into 'main'
Back down x25519-dalek to 2.0.0-pre.1 from 2.0.0-rc.2

Closes #926

See merge request tpo/core/arti!1317
2023-06-27 18:16:38 +00:00
pinkforest 4be2e3ce0f Back down x25519-dalek to 2.0.0-pre.1 from 2.0.0-rc.2
=========================
Notes from nickm:

(This differs from pinkforest's original MR: It removes the
Cargo.lock changes and the version bump on tor-llcrypto.)

Minimal Cargo.lock changes from downgrade.

(These are exactly those changes generated by running "build" and
"test".)

There are several reasons to do this:

  * It's best to bump all of our dalek dependencies at once to rc.3
    or later, rather than the piecemeal approach we've been stuck
    with so far.

  * We don't want to do this bump right now, since there are some
    tricky questions about clamping we need to figure out (see
    #808), and we need to make sure we get them right, and we're in
    a distracted this week.

  * We _do_ need to move away from 2.0.0-rc.2 right now, since
    it was causing a failure in `cargo install arti`, and then it
    got yanked.

Thanks to pinkforest for helping us out here and explaining all of
this!

Fixes #926.

Commit-edited-by: Nick Mathewson <nickm@torproject.org>
2023-06-27 13:55:24 -04:00
Nick Mathewson 7b0370c9e0 Merge branch 'chanmgr-doc' into 'main'
Add Channel expiry info in ChanMgr docs

See merge request tpo/core/arti!1316
2023-06-27 15:14:05 +00:00
Saksham Mittal d6626acd65
Add Channel expiry info in ChanMgr docs 2023-06-27 18:24:56 +05:30
gabi-250 c3a0096b61 Merge branch 'race' into 'main'
tor-hsclient: Fix test race

Closes #923

See merge request tpo/core/arti!1308
2023-06-26 17:37:58 +00:00
Ian Jackson 062b7e7ced tor-hsclient: Increase some timeouts
1. Fix a use of 10ms that should have been TIMEOUT_SLOP.
2. Increase BODGE_YIELD by a factor of 5.

Now this test should tolerate being hung up for 125ms.  I am hoping
that this will fix the CI failure
  https://gitlab.torproject.org/Diziet/arti/-/jobs/302457
which fails at the line comparing circuit1 with circuit2a.
(I can't repro that locally.)
2023-06-26 17:57:33 +01:00
Ian Jackson e5c4551993 tor-hsclient: test: Introduce some constants for timings 2023-06-26 17:57:33 +01:00
Ian Jackson c8d1cdded7 tor-hsclient: test: Add another sleep for expiry task *start*
Without this, the expiry task can end up choosing a 600s timeout
starting *after we advanced the clock*.

Fixes #923
2023-06-26 17:55:10 +01:00