-
Notifications
You must be signed in to change notification settings - Fork 17
feat: integrate MLS with auth #385
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
Conversation
Signed-off-by: Zsolt Kacsándi <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be useful to have error messages not managed inline and instead follow the SLIM pattern where
#[derive(Debug, thiserror::Error)]
pub enum SlimIdentityError {
#[error("Not a basic credential")]
NotBasicCredential,
#[error("Invalid UTF-8 in credential: {0}")]
InvalidUtf8(#[from] std::str::Utf8Error),
#[error("Identity verification failed: {0}")]
VerificationFailed(String),
#[error("External sender validation failed: {0}")]
ExternalSenderFailed(String),
}
fn resolve_slim_identity<V>(
signing_id: &SigningIdentity,
verifier: &V,
) -> Result<String, SlimIdentityError>
where
V: Verifier + Send + Sync + Clone + 'static,
{
let basic_cred = signing_id
.credential
.as_basic()
.ok_or(SlimIdentityError::NotBasicCredential)?;
let credential_data = std::str::from_utf8(&basic_cred.identifier)?;
// Actually use the verifier to validate the credential
verifier
.verify(credential_data)
.map_err(|e| SlimIdentityError::VerificationFailed(e.to_string()))?;
Ok(credential_data.to_string())
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
General comment is that this part of the code would benefit from logging as instrumentation is also available.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as above
#[derive(Debug, thiserror::Error)]
pub enum MlsInterceptorError {
#[error("Not a group member")]
NotGroupMember,
#[error("Encryption failed: {0}")]
EncryptionFailed(String),
#[error("Decryption failed: {0}")]
DecryptionFailed(String),
#[error("Group ID mismatch: expected {expected}, got {actual}")]
GroupIdMismatch { expected: String, actual: String },
#[error("Missing payload")]
MissingPayload,
#[error("Invalid metadata: {0}")]
InvalidMetadata(String),
#[error("Sender not authorized: {0}")]
SenderNotAuthorized(String),
}
@zsoltkacsandi go ahead with rebase and then merge |
Signed-off-by: Zsolt Kacsándi <[email protected]>
Signed-off-by: Zsolt Kacsándi <[email protected]>
Signed-off-by: Zsolt Kacsándi <[email protected]>
Signed-off-by: Zsolt Kacsándi <[email protected]>
Signed-off-by: Zsolt Kacsándi <[email protected]>
Signed-off-by: Zsolt Kacsándi <[email protected]>
Signed-off-by: Zsolt Kacsándi <[email protected]>
Signed-off-by: Zsolt Kacsándi <[email protected]>
Signed-off-by: Zsolt Kacsándi <[email protected]>
Done, I've improved the logging and error handling, and reconciled the changes. |
Signed-off-by: Zsolt Kacsándi <[email protected]>
* main: chore(deps): bump helm.sh/helm/v3 in /internal/tools (#403) chore(deps): bump github.com/go-viper/mapstructure/v2 in /internal/tools (#404) Fix: fix test channel endpoint (#405) feat: do no create session on discovery request (#402) refactor(streaming): remove lock from channel_endpoint (#399) feat: integrate MLS with auth (#385)
Description
Please provide a meaningful description of what this change will do, or is for.
Bonus points for including links to related issues, other PRs, or technical
references.
Note that by not including a description, you are asking reviewers to do extra
work to understand the context of this change, which may lead to your PR taking
much longer to review, or result in it not being reviewed at all.
Type of Change
Checklist