| Commit message (Collapse) | Author | Age | Files | Lines |
| | |
|
| |
|
|
|
|
| |
It's better to use "TODO" like we do in the rest of Arti, because
otherwise this has a chance of being forgotten (because nobody really
greps for "IDEA").
|
| | |
|
| |
|
|
|
|
|
|
|
|
|
|
| |
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.
|
| | |
|
| |
|
|
| |
`RawKeystoreEntry` no longer exists, so these tests need to be updated.
|
| | |
|
| |
|
|
|
|
|
|
|
|
|
|
| |
I think this adds unnecessary indirection, and it's a bit confusing to
have two separate keystore entry types (we have `KeystoreEntry` too).
This type exists just to server as a wrapper over the `RawEntryId` of an
unrecognized keystore entry, and the `KeystoreId` of the keystore it was
found in.
This commit folds `RawKeystoreEntry` into `UnrecognizedEntry`, which was
previously a thin wrapper over `RawKeystoreEntry`.
|
| |
|
|
|
|
| |
Change all call sites.
This completes the rename.
|
| | |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This fixes a bug that was causing the ephemeral keystore to retrieve
certs in a format that couldn't be handled by the `KeyMgr`. This caused
all certificate retrievals from `EphemeralKeystore` done via the
`KeyMgr` to fail with an internal error.
For context, the only supported cert type is `TorEd25519Cert`, which is
a pre-encoded certificate (i.e. a type wrapper over a `Vec<u8>`).
These certificates are stored as-is by the Arti native keystore (the
bytes are written to a file on disk). When retrieving a
`TorEd25519Cert`, the Arti keystore uses `parse_certificate_erased()` to
parse the cert into a `ParsedEd25519Cert` before returning it as a
type-erased `ErasedKey`. This works as intended with the `KeyMgr`
retrieval and downcasting logic, which expects the certificate to be
returned in the `ParsedCert` format specified in the `ToEncodableCert`
implementation.
Before this change, the ephemeral keystore, on the other hand, did not
play well with the `KeyMgr` when it came to cert retrieval: it would
incorrectly store the `KeystoreItem` as-is, and retrieve it as an
`ErasedKey` using the `ErasedKey::into_erased()` implementation. This
would then cause the `KeyMgr` to fail to downcast the `ErasedKey` to the
correct type (because the returned erased item was of a different type
than `ParsedCert`).
This commit also removes `KeystoreItem::into_erased()`, which was a
footgun (because certificates are not actually supposed to be retrieved
in the format returned by `CertData::into_erased()`).
|
| | |
|
| |
|
|
| |
Typos found with codespell
|
| | |
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
This will make it easier to see the correspondence between CTorPaths
and the HS client/service key specifiers.
Initially, I was hoping this would make it easier to write a d-d macro
that automatically derives a `CTorPath` variant (e.g.
`HsClientDescEncKeypair`) from the KeySpecifier type name
(`HsClientDescEncKeypairSpecifier`), but alas, I don't think d-d can
"chop off" name suffixes ("Specifier", in this case).
`from_ctor_path()`/`ctor_path()` implementations for converting
`CTorPath`s to and from key specifiers.
|
| |
|
|
| |
Run maint/add_warning
|
| |
|
|
|
|
| |
This currently can't be used due to upstream limitations in the ssh_key
crate, which will be removed likely in the next release. In the
meantime, we can put in all the groundwork.
|
| | |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
```text
error: implicitly cloning a `String` by calling `to_string` on its dereferenced type
--> crates/tor-config/src/lib.rs:109:32
|
109 | V::String(_, s) => s.to_string(),
| ^^^^^^^^^^^^^ help: consider using: `s.clone()`
|
= help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#implicit_clone
note: the lint level is defined here
--> crates/tor-config/src/lib.rs:20:9
|
20 | #![deny(clippy::implicit_clone)]
| ^^^^^^^^^^^^^^^^^^^^^^
```
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
| |
First, run
```
git grep -l "^edition =" |
xargs perl -i -pe 's/^edition *=.*/edition = "2024"/;'
```
Second, manually verify that all Cargo.toml files have changed,
and nothing else has changed.
Third, run cargo fmt again.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* CLI: Add `keys-raw` and subcommand `remove-by-path`
* arti: Add `arti::subcommand::raw` for the CLI `keys-raw`
* tor-keymgr: Add `ArtiNativeKeystoreError::UnexpectedRawEntry`,
`ArtiEphemeralKeystoreError::NotSupported`
* tor-keymgr: Add `tor-keymgr::raw` module
* tor-keymgr: Add `Keystore::remove_unchecked`
* tor-keymgr: Change `Keystore::list` to return `KeystoreEntry`
* tor-keymgr: Add field `KeystoreEntry::raw_id`
* doc: Update keys.md
* doc: Add raw.md
* tor-keymgr: BREAKING: `UnrecognizedEntryError::new` associated
function is now only accessible within the crate `tor-keymgr`
* tor-keymgr: BREAKING: `UnrecognizedEntryId` is renamed to
`UnrecognizedEntry`
* tor-keymgr: BREAKING: `KeyMgr::list()` and `Keystore::list()`
now return `Result<Vec<KeystoreEntryResult<KeystoreEntry>>>`
|
| |
|
|
| |
Made with https://crates.io/crates/typos-cli
|
| |
|
|
|
| |
* Change return type `Result<Vec<(KeyPath, KeystoreItemType)>>` if favor
of `Result<Vec<StdResult<(KeyPath, KeystoreItemType), UnrecognizedEntryError>>>`
|
| |
|
|
|
|
|
| |
The `IoError::other` function is an easier way to say
`IoError::new(IoErrorKind::Other, ...)`. It's been around since
1.74, but clippy started warning about the more verbose version in
1.87.
|
| | |
|
| |
|
|
|
|
| |
Drop redundant/unused param item_type: &KeystoreItemType from
keystore::Keystore::insert. Method now uses param
key: &dyn EncodableItem to obtain a KeystoreItemType
|
| |
|
|
|
|
|
|
| |
Motivation: Param _item_type is redundant since prev commit. No point
in checking if key_data's item type and _item_type are the same, we
do things as per key_data's item type from now on.
- Removes a test for item type validation.
|
| |
|
|
| |
Makes param item_type redundant. Renames item_type -> _item_type.
|
| |
|
|
| |
Closes #1455
|
| |
|
|
| |
Closes #1455 [PATCH 4(v3)/4]
|
| |
|
|
| |
Part of #1455 [PATCH 3(v3)/4]
|
| |
|
|
| |
Part of #1455
|
| | |
|
| | |
|
| |
|
|
| |
Closes #1455 [PATCH 4(v2)/4]
|
| |
|
|
| |
Part of #1455 [PATCH 3(v2)/4]
|
| |
|
|
| |
_sigh_
|
| |
|
|
| |
Closes #1455 [PATCH 4/4]
|
| |
|
|
|
|
|
|
|
|
|
|
| |
Part of #1455 [PATCH 3/4]
Abstract of the test(s):
Encoded (key) A -> Decoded (key) A
Decoded A -> Encoded B
Encoded B -> Decoded B
Assert that Decoded A == Decoded B
|
| |
|
|
| |
- `rand::thread_rng()` has been deprecated and renamed to `rand::rng()`
|
| |
|
|
| |
Part of #1396
|
| |
|
|
|
|
|
| |
This helps us get rid of our uses of `KeyUnknownCert`. Needed because
`KeyUnknownCert` can't readily be converted back to `EncodedEd25519Cert`
(while `ParsedEd25519Cert` *can* -- see the `certs` module from
`tor-relay-crypto`).
|
| |
|
|
|
|
| |
This updates and reenables the cert management tests.
Part of #1768
|
| | |
|
| |
|
|
|
|
|
| |
This will soon be used, when we modify the `ArtiNativeKeystore` cert
lookup code to actually parse certificates before returning them.
Part of #1768
|
| |
|
|
|
|
|
|
| |
This is necessary because `ParsedCert`s will not be `EncodableItem`s.
This is because we cannot (and don't want to) write certificates that
have not yet been validated to the keystore. They do need to be
retrievable from the keystore though, so we also change `ErasedKey`
to be `Box<dyn ItemType>` instead.
|
| | |
|
| | |
|
| | |
|
| |
|
|
|
| |
This makes `ArtiNativeKeystore::get` deserialize the keystore item as a
cert, if its `KeystoreItemType` is `Cert`.
|