Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(sdk-crypto): Add Identity local tofu trust flag. #3610

Conversation

BillCarsonFr
Copy link
Member

part of invisible crypto, follow up of #3607
Fixes #3564

Add a new flag on read only identities tofu_trusted, that is set to true when it's the first time an identity is seen for a user. It shoud be set to false when a new identity is detected. This flag can be set back to true via API. As per tofu implementation client should ensure that this flag is only updated to true when the identity change notice has been shown to the user.

  • Public API changes documented in changelogs (optional)

Signed-off-by:

@BillCarsonFr BillCarsonFr requested a review from poljar June 26, 2024 07:43
@BillCarsonFr BillCarsonFr force-pushed the valere/invisible_crypto/identity_local_tofu branch from 371c257 to 77d05a4 Compare June 27, 2024 07:50
serialize_with = "atomic_bool_serializer",
deserialize_with = "atomic_bool_deserializer"
)]
tofu_trusted: Arc<AtomicBool>,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tofu_trusted doesn't seem like a great name for for a flag that means either "the first identity we saw for this user" or "not the first identity, but the user acknowledged it". TBH, I'm wondering if we should actually split it into two different flags.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or an enum, given that the two flags would be mutually exclusive?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or an enum, given that the two flags would be mutually exclusive?

I did think about that, but we still have the problem of what to call the damn thing

Copy link
Member

@dkasak dkasak Jun 28, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I discussed this with @BillCarsonFr and the semantics of the flag are roughly whether the identity is pinned or not, so perhaps the name could be pinned.

However, the way it's currently implemented—where we immediately replace the stored identity as soon as a new one is returned from the server, but with this flag set to false—means that a server can delete your pin by simply presenting a new identity and then switching back to the old one, resulting in the flag switching from true to false.

Valere is going to experiment with an alternative approach, where we

  • Remember the old pinned identity as long as a new identity doesn't become pinned, replacing the old one
  • Using the logic current != pinned to control whether the user should be notified / prompted to confirm

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dkasak Alternative for MSK pinning #3639

@@ -447,6 +474,21 @@ impl ReadOnlyUserIdentity {
&self.self_signing_key
}

/// Check if our identity is verified.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This certainly doesn't mean that it is "verified", which would imply we have done the cross-signing dance.

@@ -406,19 +425,22 @@ impl ReadOnlyUserIdentity {
/// * `master_key` - The master key of the user identity.
///
/// * `self signing key` - The self signing key of user identity.
/// * `tofu_trusted` - Is this identity tofu trusted.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we're sticking with a single flag, we will need to explain what "tofu trusted" actually means each time we reference it.

}

// The tofu_trusted field introduced a new field in the database
// schema, for backwards compatibility we assume that if the identity is
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// schema, for backwards compatibility we assume that if the identity is
// schema. For backwards compatibility, we assume that if the identity is

@BillCarsonFr BillCarsonFr removed the request for review from poljar July 1, 2024 09:12
@BillCarsonFr
Copy link
Member Author

Here is the alternative proposal #3639

@poljar poljar deleted the valere/invisible_crypto/identity_local_tofu branch November 5, 2024 11:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants