<feed xmlns='http://www.w3.org/2005/Atom'>
<title>mirrors/arti.git/crates/tor-keymgr/src/keystore/arti.rs, branch arti-v1.2.6</title>
<subtitle>mirror of https://gitlab.torproject.org/tpo/core/arti
</subtitle>
<id>http://git.dilluti0n.com/mirrors/arti.git/atom?h=arti-v1.2.6</id>
<link rel='self' href='http://git.dilluti0n.com/mirrors/arti.git/atom?h=arti-v1.2.6'/>
<link rel='alternate' type='text/html' href='http://git.dilluti0n.com/mirrors/arti.git/'/>
<updated>2024-07-30T14:20:24Z</updated>
<entry>
<title>tor-keymgr: Use Path::try_exists() instead of Path::exists().</title>
<updated>2024-07-30T14:20:24Z</updated>
<author>
<name>Gabriela Moldovan</name>
<email>gabi@torproject.org</email>
</author>
<published>2024-07-30T14:14:47Z</published>
<link rel='alternate' type='text/html' href='http://git.dilluti0n.com/mirrors/arti.git/commit/?id=761d33b6ef9413bc05b4d48104f597f69ebc9305'/>
<id>urn:sha1:761d33b6ef9413bc05b4d48104f597f69ebc9305</id>
<content type='text'>
</content>
</entry>
<entry>
<title>tor-keymgr: Fix ArtiNativeKeystore::contains() bug.</title>
<updated>2024-07-17T15:55:13Z</updated>
<author>
<name>Gabriela Moldovan</name>
<email>gabi@torproject.org</email>
</author>
<published>2024-07-17T15:13:46Z</published>
<link rel='alternate' type='text/html' href='http://git.dilluti0n.com/mirrors/arti.git/commit/?id=a48804f9a0770ab54a117a35c6ffdf4df9387950'/>
<id>urn:sha1:a48804f9a0770ab54a117a35c6ffdf4df9387950</id>
<content type='text'>
This fixes a bug in `ArtiNativeKeystore`'s `Keystore::contains()`
implementation: previously, it called Path::exists() on the relative
path (built by concatenating the key specifier and the extension), so
unless your current directory happened to be the root of the keystore,
`contains()` would always return `false`.

`KeyMgr::generate` uses `Keystore::contains()` under the hood, so it
was affected by this bug too: if called `overwrite = false`, it would
misbehave and overwrite any existing keys.

Internally, we call `KeyMgr::generate` in a couple of places:
  * `tor-hsservice/src/lib.rs`, to generate the `hsid` if it doesn't
    already exist. This callsite is not affected by the bug, because
    `KeyMgr::generate` is only called if `KeyMgr::get` returns `None`
  * `tor-hsservice/src/ipt_mgr.rs`, to generate `KS_hss_ntor` and
    `KS_hs_ipt_sid` keys for intro point establishment. This callsite is
    also not affected (because it too calls `get()` before attempting to
    `generate()`)

The bug affects any downstream users that use `KeyMgr::generate`
with a key manager backed by `ArtiNativeKeystore`.

------
`KeyMgr::get_or_generate` is not affected, even though it calls
`Keymgr::generate` (it performs a separate extra check before calling
`generate()`). (Both suffer from a known TOCTOU race, but that's a
separate matter.) As an aside, I'd like to somehow unify
`KeyMgr::get_or_generate` and `KeyMgr::get` (I've had some attempts in
the past but ended up abandoning them because the result was more
unergonomic than the existing APIs).

Part of #1492
</content>
</entry>
<entry>
<title>tor-keymgr: Rename function to clarify it returns a relative path (fmt).</title>
<updated>2024-07-17T15:05:43Z</updated>
<author>
<name>Gabriela Moldovan</name>
<email>gabi@torproject.org</email>
</author>
<published>2024-07-17T15:05:43Z</published>
<link rel='alternate' type='text/html' href='http://git.dilluti0n.com/mirrors/arti.git/commit/?id=415e6e86e73ca1bf6c847d0bd488a091f9a18f3d'/>
<id>urn:sha1:415e6e86e73ca1bf6c847d0bd488a091f9a18f3d</id>
<content type='text'>
</content>
</entry>
<entry>
<title>tor-keymgr: Rename function to clarify it returns a relative path.</title>
<updated>2024-07-17T15:05:10Z</updated>
<author>
<name>Gabriela Moldovan</name>
<email>gabi@torproject.org</email>
</author>
<published>2024-07-17T15:05:10Z</published>
<link rel='alternate' type='text/html' href='http://git.dilluti0n.com/mirrors/arti.git/commit/?id=e259e166c51e4e633eb52d45fe62bb53c3e2403f'/>
<id>urn:sha1:e259e166c51e4e633eb52d45fe62bb53c3e2403f</id>
<content type='text'>
</content>
</entry>
<entry>
<title>tor-keymgr: Add test for ArtiNativeKeystore::contains.</title>
<updated>2024-07-17T15:01:02Z</updated>
<author>
<name>Gabriela Moldovan</name>
<email>gabi@torproject.org</email>
</author>
<published>2024-07-17T15:01:02Z</published>
<link rel='alternate' type='text/html' href='http://git.dilluti0n.com/mirrors/arti.git/commit/?id=87145fb76f09391a452ddbb0c8d0f897109ca9e3'/>
<id>urn:sha1:87145fb76f09391a452ddbb0c8d0f897109ca9e3</id>
<content type='text'>
This new assertion fails, because the implementation of
`ArtiNativeKeystore::contains()` is buggy: it calls Path::exists() on
the relative path built by concatenating the key specifier and the
extension (so unless your current directory happens to be the root of
the keystore, contains() is always going to return false).

Part of #1492
</content>
</entry>
<entry>
<title>tor-keymgr: Correct message for mistrust error</title>
<updated>2024-07-10T10:50:44Z</updated>
<author>
<name>Ian Jackson</name>
<email>ijackson@chiark.greenend.org.uk</email>
</author>
<published>2024-07-09T13:47:01Z</published>
<link rel='alternate' type='text/html' href='http://git.dilluti0n.com/mirrors/arti.git/commit/?id=e0f844d704e20f5d0ab6f4db32760889012cd870'/>
<id>urn:sha1:e0f844d704e20f5d0ab6f4db32760889012cd870</id>
<content type='text'>
</content>
</entry>
<entry>
<title>tor-keymgr: Make SshKeyData an opaque type.</title>
<updated>2024-05-07T18:43:35Z</updated>
<author>
<name>Gabriela Moldovan</name>
<email>gabi@torproject.org</email>
</author>
<published>2024-05-07T18:40:34Z</published>
<link rel='alternate' type='text/html' href='http://git.dilluti0n.com/mirrors/arti.git/commit/?id=dfb63f8eb8453ae417d2381859cfe7bd213651e5'/>
<id>urn:sha1:dfb63f8eb8453ae417d2381859cfe7bd213651e5</id>
<content type='text'>
This helps prevent external users from creating `SshKeyData` out of
unsupported types of `ssh_key::public::KeyData` and
`ssh_key::private::KeypairData`.
</content>
</entry>
<entry>
<title>tor-keymgr: Move arti-specific ssh code to arti module.</title>
<updated>2024-05-07T13:31:45Z</updated>
<author>
<name>Gabriela Moldovan</name>
<email>gabi@torproject.org</email>
</author>
<published>2024-05-07T11:46:52Z</published>
<link rel='alternate' type='text/html' href='http://git.dilluti0n.com/mirrors/arti.git/commit/?id=83119a81eb2ffd67d0608df6b1b2fabbf54401b7'/>
<id>urn:sha1:83119a81eb2ffd67d0608df6b1b2fabbf54401b7</id>
<content type='text'>
Some of the types and impls from `key_type/ssh.rs` (such as
`UnparsedOpenSshKey`) have nothing to do with `KeyType`, and are only
used by the `ArtiNativeKeystore`, so I'm moving them to the `arti`
keystore module.

The shared ssh-related stuff now lives in the top-level `ssh.rs`.
</content>
</entry>
<entry>
<title>tor-keymgr: Move parse_ssh_format_erased to UnparsedOpenSshKey.</title>
<updated>2024-05-07T11:20:33Z</updated>
<author>
<name>Gabriela Moldovan</name>
<email>gabi@torproject.org</email>
</author>
<published>2024-05-02T16:53:40Z</published>
<link rel='alternate' type='text/html' href='http://git.dilluti0n.com/mirrors/arti.git/commit/?id=766fe621e467442370fcabfad7d897390dc790a6'/>
<id>urn:sha1:766fe621e467442370fcabfad7d897390dc790a6</id>
<content type='text'>
I think it makes more sense for parse_ssh_format_erased to be a function
of the key than of `KeyType`.
</content>
</entry>
<entry>
<title>tor-keymgr: Make test module private again.</title>
<updated>2024-05-07T09:51:13Z</updated>
<author>
<name>Gabriela Moldovan</name>
<email>gabi@torproject.org</email>
</author>
<published>2024-05-02T12:57:45Z</published>
<link rel='alternate' type='text/html' href='http://git.dilluti0n.com/mirrors/arti.git/commit/?id=a05b126adfb8acd65d9be4a26b5d6afa4dc518f5'/>
<id>urn:sha1:a05b126adfb8acd65d9be4a26b5d6afa4dc518f5</id>
<content type='text'>
This doesn't need to be public anymore now that the test keys are
exported from `test_utils`.

Addresses https://gitlab.torproject.org/tpo/core/arti/-/merge_requests/2076#note_3016577
</content>
</entry>
</feed>
