Skip to content

check extensions in GroupContextExtensionProposals for validity - #1834

Closed
tbehner wants to merge 22 commits into
openmls:mainfrom
tbehner:feature/1830-filter-group-context-extensions
Closed

tbehner wants to merge 22 commits into
openmls:mainfrom
tbehner:feature/1830-filter-group-context-extensions

Conversation

@tbehner

@tbehner tbehner commented Aug 28, 2025

Copy link
Copy Markdown
Contributor

Some tests are failing and have to be adapted.

Comment thread openmls/src/extensions/mod.rs Outdated
Comment on lines +134 to +143
pub(crate) fn is_valid_group_context_extension_proposal(self) -> Option<bool> {
match self {
ExtensionType::RequiredCapabilities | ExtensionType::ExternalSenders => Some(true),
ExtensionType::ApplicationId
| ExtensionType::RatchetTree
| ExtensionType::ExternalPub
| ExtensionType::LastResort => Some(false),
ExtensionType::Unknown(_) => Some(true),
}
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

One general question about these extension type validation functions is whether they should return None for Unknown extensions, or whether they should simply return true. For example, for leaf nodes, we currently always accept Unknown extensions.

@franziskuskiefer Do you have thoughts on this?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Yes, we always have to accept unknown extensions. They are usually application defined and OpenMLS shouldn't interfere. Really, that should be only in the private space. But I think we can be a little more lenient.

@wysiwys wysiwys left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks @tbehner! I took a look at this ahead of time, while it is still marked as draft. I think this PR takes a good approach to addressing this issue. I added some general thoughts and a comment about a method name.

One overarching point is that due to the added error handling, several functions now need to return Result<T, E>, instead of just T, because the Extensions list passed in needs to be validated inside the function. The main functionality affected here is proposal creation. It may be better to decouple the ExtensionType validation from the proposal creation, instead, by passing in an already-validated Extensions list first, which could look something like an Extensions<GroupContext>, or another type that indicates the extension types have been pre-validated.

Comment thread openmls/src/extensions/mod.rs Outdated
}
}

pub(crate) fn is_valid_group_context_extension_proposal(self) -> Option<bool> {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Should the names of these functions match each other, to convey that they serve similar purposes? For example, something like is_valid_in_group_context() could be chosen to match the function is_valid_in_leaf_node().

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Good point 👍

@tbehner

tbehner commented Aug 29, 2025

Copy link
Copy Markdown
Contributor Author

One overarching point is that due to the added error handling, several functions now need to return Result<T, E>, instead of just T, because the Extensions list passed in needs to be validated inside the function. The main functionality affected here is proposal creation. It may be better to decouple the ExtensionType validation from the proposal creation, instead, by passing in an already-validated Extensions list first, which could look something like an Extensions<GroupContext>, or another type that indicates the extension types have been pre-validated.

I really like the idea! Not only does this decouple the validation from the creation, but also communicates the intend and requirements of the extensions more clearly. I will take a look into this.

@franziskuskiefer franziskuskiefer left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

As discussed offline (just the gist here), I think giving early feedback when assembling the proposal here makes sense, but doing that on the extension level is probably better. At the same time do we need to validate the proposals for committing (and should use the same mechanism there) without validating during parsing.

Comment thread openmls/src/extensions/mod.rs Outdated
Comment on lines +134 to +143
pub(crate) fn is_valid_group_context_extension_proposal(self) -> Option<bool> {
match self {
ExtensionType::RequiredCapabilities | ExtensionType::ExternalSenders => Some(true),
ExtensionType::ApplicationId
| ExtensionType::RatchetTree
| ExtensionType::ExternalPub
| ExtensionType::LastResort => Some(false),
ExtensionType::Unknown(_) => Some(true),
}
}

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Yes, we always have to accept unknown extensions. They are usually application defined and OpenMLS shouldn't interfere. Really, that should be only in the private space. But I think we can be a little more lenient.

@tbehner
tbehner force-pushed the feature/1830-filter-group-context-extensions branch 2 times, most recently from 15101a4 to 5f7c0c6 Compare September 7, 2025 07:25
@tbehner
tbehner force-pushed the feature/1830-filter-group-context-extensions branch from 7dcbf87 to cfb0bad Compare September 7, 2025 08:21
@tbehner
tbehner marked this pull request as ready for review September 7, 2025 09:28
@tbehner
tbehner requested a review from a team as a code owner September 7, 2025 09:28
Comment thread openmls/src/extensions/mod.rs Outdated
}

/// TypedExtension is implemented by all types that can be used as a Extension.
pub trait TypedExtension:

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I am not happy with this traits name, but could not come up with something better.

@tbehner

tbehner commented Sep 9, 2025 •

Copy link
Copy Markdown
Contributor Author

With the current approach, I followed the pattern of other parsed and validated proposals. The parsed but not yet validated GroupContextExtensionProposalIn can be validated by calling validate(), which returns a GroupContextExtensionProposal.

To represent parsed and validated extensions, the Extensions type now takes a type parameter that implements TypedExtension. (See my comment about that name.) Currently, this can be either Extension or GroupContextExtension. GroupContextExtension is the more specific extension type required in a GroupContext. An Extension can be cast to a GroupContextExtension by calling try_into(). Since not every type of Extension can be used in a GroupContext, this method might return an error. As all methods expecting extensions valid for a GroupContext only accept Extensions<GroupContextExtension> as arguments, no further validation or checks are needed.

In a next step, we could implement more specific extension types for GroupInfo, LeafNodes, and KeyPackages.

@franziskuskiefer franziskuskiefer left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

some preliminary comments

// Inspect extensions...
let extensions: &Extensions = group_context.extensions();
// TODO TIM ich bin mir noch nicht sicher was ich hiermit mache
let extensions: Extensions<Extension> = group_context.extensions().clone().into();

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The idea is, as below, to get the extensions and look inside. There could be something in there the client doesn't like. Right now there may not be anything and we have to add something.

Comment thread openmls/src/extensions/mod.rs Outdated
/// See the individual extensions for more details on each extension.
///
/// ```c
/// // draft-ietf-mls-protocol-16

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This is pre-RFC. We can drop these.

Suggested change
/// // draft-ietf-mls-protocol-16

Comment thread openmls/src/extensions/mod.rs Outdated

fn try_from(value: Extensions<Extension>) -> Result<Self, Self::Error> {
let group_extensions: Result<Vec<GroupContextExtension>, Self::Error> =
value.iter().map(|e| e.clone().try_into()).collect();

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

No need to clone here.

Suggested change
value.iter().map(|e| e.clone().try_into()).collect();
value.unique.into_iter().map(|e| e.try_into()).collect();

Comment thread openmls/src/extensions/mod.rs Outdated
}
}

impl Extensions<GroupContextExtension> {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Hm, I don't like this. As long as we have only one that may be fine, but if we have all of the extensions in separate types, this will blow up. Any ideas for something better, without macros?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

After attempting different approaches, the core problem remains that enum variants are not types on their own. This prevents us from defining generic methods across multiple enums with semantically equal variants.

This leaves us with as far as I can tell with two main options.

Option 1: Redefine the Extension Enum

This approach involves redefining the plain Extension enum to contain other extension enums as variants.

enum Extension {
    GroupContext(GroupContextExtension),
    LeafNode(LeafNodeExtension),
    // ...
}

This would eliminate the need to redefine the same methods for accessing internal fields multiple times. However, this only works if the extension variants don't overlap. So far, is this only not true for Unknown? If so, we'd still have duplicate fn unknown instances across all variants.

Option 2: Use Macros

A macro like #[derive(/*...*/ GetterMethods)] could be used to automatically generate getter methods.

#[derive(/*...*/ GetterMethods)]
enum Extension {
    ApplicationId(ApplicationIdExtension),
    RatchetTree(RatchetTreeExtension),
    // ...
}

could then produce the following methods:

pub fn as_application_id_extension(&self) -> Result<&ApplicationIdExtension, ExtensionError> {}
pub fn as_ratchet_tree_extension(&self) -> Result<&RatchetTreeExtension, ExtensionError> {}
// ...

This method would also significantly reduce code duplication within the impl Extension itself, as all these getter methods behave identically, with the only changes being the concrete type and arity.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

The PhantomData solution is another viable option for this problem.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks for detailing a couple more options.

Option 1 is pretty disruptive to consumers and with the extensions draft we have more overlapping extension. So I don't think that will work.

For option 2 we'd need to write and maintain the proc macro. That wouldn't need too much code, but requires a the new crate. I don't think there's a reasonable existing crate we could use here.

Between those three options I think the phantom data version sounds best to me.

Taking a step back to what we want to achieve. We want to make it easier to validate the correctness of the extensions used in a certain context. This could be done just on the plain extension by ensuring the correct validation function is called. That's the least amount of code but the most error prone. Using the type system to make this more robust is good. But then we have to think about what the cost of this added safety is. In this setting, using a marker like @wysiwys suggested sounds like a good middle ground to me.

Comment thread openmls/src/extensions/mod.rs Outdated
}
}

impl GroupContextExtension {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Same here, this is duplicating a lot of code for any extension that can show up in multiple places.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

To add on to this comment, one possible option for avoiding code duplication could be:

#[derive(Default, Debug, Clone, PartialEq, Eq, Serialize, Deserialize, TlsSize)]
pub struct ExtensionsForObject<T> {
    unique: Vec<Extension>,
    #[serde(skip)]
    _object: core::marker::PhantomData<T>,
}

#[derive(Clone, Copy, PartialEq, Eq, Debug, Default)]
/// Any extensions
pub struct AnyObject;
/// Type alias for AnyObject extensions
pub type Extensions = ExtensionsForObject<AnyObject>;

This approach (or a similar one) would mean that the plain Extensions can still be called Extensions, so that not so much code needs to be replaced immediately, and we only specify a validated version when needed.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This solution works well. I believe it's a solid option, provided we don't need to add more functionality to the context-specific extensions down the line.

pub fn propose_group_context_extensions(mut self, extensions: Extensions) -> Self {
pub fn propose_group_context_extensions(
mut self,
extensions: Extensions<Extension>,

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The question here for the API is whether the caller should use the correct extension type already, or if we do this in here and then return an error.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yes, absolutely! I am also in favor of asking for Extension<GroupContextExtension> to enforce validity.

Comment on lines +515 to +537
// Proposal::GroupContextExtensions(gce_proposal) => gce_proposal
// .extensions()
// .iter()
// .flat_map(|extension| {
// match extension {
// GroupContextExtension::ExternalSenders(external_senders) => {
// external_senders
// .iter()
// .map(|external_sender| external_sender.credential())
// .collect()
// }
// _ => vec![],
// }
// .into_iter()
// })
// // TODO: ideally we wouldn't collect in between here, but the match arms
// // have to all return the same type. We solve this by having them all
// // be vec::IntoIter, but it would be nice if we just didn't have to
// // do this.
// // It might be possible to solve this by letting all match arms
// // evaluate to a dyn Iterator.
// .collect::<Vec<_>>()
// .into_iter(),

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This should go back in?

return Err(StageCommitError::RequiredPathNotFound);
};

// TODO we should probably not unwrap here

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Obsolete comment?

Comment thread openmls/src/messages/proposals_in.rs Outdated
pub(crate) fn validate(self) -> Result<GroupContextExtensionProposal, ValidationError> {
let group_context_extensions = self
.extensions_tbv
.clone()

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

No need to clone here.

Comment thread openmls/src/messages/proposals_in.rs Outdated
.extensions_tbv
.clone()
.try_into()
.map_err(|_| ValidationError::InvalidExtension)?;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Giving some more information here which extension was bad may be nice?

@wysiwys wysiwys left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks! I think this goes in the right direction, although I'd agree it would be good to reduce some of the overlap in enums and method implementations. I added some specific feedback about types and serialization/deserialization.

Comment thread openmls/src/extensions/mod.rs Outdated
}
}

impl GroupContextExtension {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

To add on to this comment, one possible option for avoiding code duplication could be:

#[derive(Default, Debug, Clone, PartialEq, Eq, Serialize, Deserialize, TlsSize)]
pub struct ExtensionsForObject<T> {
    unique: Vec<Extension>,
    #[serde(skip)]
    _object: core::marker::PhantomData<T>,
}

#[derive(Clone, Copy, PartialEq, Eq, Debug, Default)]
/// Any extensions
pub struct AnyObject;
/// Type alias for AnyObject extensions
pub type Extensions = ExtensionsForObject<AnyObject>;

This approach (or a similar one) would mean that the plain Extensions can still be called Extensions, so that not so much code needs to be replaced immediately, and we only specify a validated version when needed.

Comment thread openmls/src/extensions/mod.rs Outdated
}
}

impl<T: TypedExtension> TlsSerializeTrait for Extensions<T> {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

One thing to check here is whether these serialization implementations should produce identical results for each T: TypedExtension. This could be done by converting to a plain Extension first, for example, or by ensuring that the enum variants have the same discriminants and layouts.

Comment thread openmls/src/extensions/mod.rs Outdated
}

impl TlsDeserializeTrait for Extensions {
impl<T: TypedExtension> TlsDeserializeTrait for Extensions<T> {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I haven't looked into this deeply yet, but it could be better to always deserialize plain Extensions lists for incoming messages, and then validate them afterwards, to avoid validation during deserialization. This would mean that the tls_codec::Deserialize/DeserializeTrait implementation would only be needed for the Extensions<Extension>.

@tbehner tbehner Sep 11, 2025 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I tried this out, and it works well, but only if the extensions in GroupContext are of type Extensions<Extension>. Otherwise, the TlsSerialize and TlsDeserialize traits can't be derived and must be implemented manually, though that's also an option.

But isn't it counterintuitive that the extensions in GroupContext are not of type Extensions<GroupContextExtension>? This feels more like a workaround to me, so I'm not entirely convinced.

An alternative would be to implement TlsSerialize, TlsDeserialize, and Size for GroupContextExtension by first converting it to an Extension, for example:

impl Size for GroupContextExtension {
    #[inline]
    fn tls_serialized_len(&self) -> usize {
        Into::<Extension>::into(self.clone()).tls_serialized_len()
    }
}

pub(crate) fn with_group_context_extensions(
mut self,
extensions: Extensions,
extensions: Extensions<Extension>,

@wysiwys wysiwys Sep 9, 2025 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

An Extensions<GroupContextExtension> could be passed in as an argument here instead

Comment thread openmls/src/group/group_context.rs Outdated
tree_hash: VLBytes,
confirmed_transcript_hash: VLBytes,
extensions: Extensions,
extensions: Extensions<GroupContextExtension>,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Since the group context is deserialized using TlsDeserialize, keeping this field as a plain extensions list would avoid validation during deserialization

Comment thread openmls/src/extensions/mod.rs Outdated
/// } Extension;
/// ```
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
pub enum GroupContextExtension {

@wysiwys wysiwys Sep 9, 2025 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think the main question here is whether to define a separate extension kind for each object, or whether to use the same extension kind everywhere and make the Extensions generic over the object types instead (GroupContext, LeafNode, etc.).

One strong advantage of separate kinds is that the extension type validity is enforced from the ground up. However, the different extension enums could add complexity from the public API perspective.

I think this is something it could be good to come back and revisit when using the Extensions<GroupContextExtension> as an input parameter in other places in the public API, such as MlsGroupBuilder::with_group_context_extensions() and CommitBuilder::propose_group_context_extensions().

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I would also prefer separate enums to enforce the validity of extensions early. From a user's perspective, this might be even better since the intent of the API method is expressed more clearly.

@tbehner
tbehner marked this pull request as draft September 12, 2025 09:08
@tbehner
tbehner force-pushed the feature/1830-filter-group-context-extensions branch from ac5ea8a to c8bdb33 Compare September 12, 2025 09:19
@tbehner

tbehner commented Sep 12, 2025 •

Copy link
Copy Markdown
Contributor Author

I've now implemented the version with PhantomData. Types that should receive Extensions can now implement ExtensionValidator to define which Extensions are valid. The validation is then used directly in the conversion.

We can't directly implement

impl<T: ExtensionValidator> TryFrom<ExtensionForObject<AnyObject>> ExtensionForObject<T> {
    //...
}

because AnyObject also already implements ExtensionValidator, and that gives us an overlapping implementation of TryFrom. As long as there's no autoref-specialization, it's necessary to implement TryFrom for each type. (Or do it with a macro cough)

Also, I haven't yet adapted MlsGroupBuilder::with_group_context_extensions() and CommitBuilder::propose_group_context_extensions() to accept ExtensionForObject<GroupContext>, but I'll do that if you think it's already a good idea. (This creates currently some weird back-and-forth conversion in the code.)

@tbehner
tbehner marked this pull request as ready for review September 17, 2025 12:36

@wysiwys wysiwys left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks, this looks good to me, with a few comments.

About the MlsGroupBuilder::with_group_context_extensions() API:

Indeed, adapting this API to accept a list with validated extension types would currently result in a conversion to a plain Extensions list internally. This could be done, for example, when building the GroupContext using the GroupContext::new() method, since the GroupContext struct represents its extensions as a plain Extensions list.

If an internal conversion is acceptable, it could make sense to already adapt the MlsGroupBuilder::with_group_context_extensions() API, in order to still provide a public API that enforces extension type validity, even though the validated list type isn't used throughout the internal handling. I definitely can see pros and cons to adapting this method at this stage, though!

Comment thread openmls/src/messages/proposals_in.rs Resolved
Comment thread openmls/src/extensions/mod.rs Outdated
/// Can be implemented by a type to validate extensions.
pub trait ExtensionValidator {
/// Check if the extension is valid.
fn valid_extension(ext: &Extension) -> bool;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

A nit on this method name - the name could indicate that only the extension type is being checked, and not other aspects of the extension. E.g. fn validate_extension_type()

Comment thread openmls/src/extensions/mod.rs Outdated
Comment on lines +607 to +612
// TODO get rid of this
impl From<ExtensionsForObject<GroupContext>> for Extensions {
fn from(value: ExtensionsForObject<GroupContext>) -> Self {
(&value).into()
}
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This method could also instead move the value.unique member directly into a new Extensions (if the method is still needed)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

That's better! (yes, the method is still needed)

Comment thread openmls/src/extensions/errors.rs Outdated
#[error("The specified extension could not be found.")]
NotFound,
/// The provided extension list contains an extension that is not allowed in group contexts
/// The provided extension list contains an extension that is not allowed

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
/// The provided extension list contains an extension that is not allowed
/// The provided extension list contains an extension type that is not allowed

Comment thread openmls/src/extensions/errors.rs Resolved
Comment thread openmls/src/extensions/mod.rs Outdated
/// Validate if the extensions are valid for this context
pub fn validate<'a>(
extensions: impl Iterator<Item = &'a Extension>,
) -> Option<InvalidExtensionError> {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

One stylistic comment about this function: instead of returning an Option<_> from this method, a Result<(), _> could be returned here instead, to match the style in other parts of the codebase

@tbehner
tbehner force-pushed the feature/1830-filter-group-context-extensions branch from cf0906d to d163252 Compare November 13, 2025 13:21
@tbehner
tbehner force-pushed the feature/1830-filter-group-context-extensions branch from d163252 to 69cb1ba Compare November 13, 2025 13:23
@tbehner
tbehner requested a review from wysiwys November 13, 2025 15:38
kkohbrok pushed a commit that referenced this pull request Jan 27, 2026
Closes #1830 

Extends PR #1834 by integrating @keks’s work on extension validation.
@tbehner tbehner closed this Jan 30, 2026
kkohbrok added a commit that referenced this pull request Apr 9, 2026
* chore: prepare v0.7.1 release (#1850)

* prepare v0.7.1 release

* Improve changelogs

* Use -rc. instead of -pre.

---------

Co-authored-by: Konrad Kohbrok <[email protected]>

* follow up on v0.7.1 (#1852)

* release v0.7.1 (#1853)

* doc: Book corrections and fixes, prettier fmt *.md files (#1817)

* Add Swap Members API (#1855)

* readd api

A simple re-add API that allows removing and adding the same members.
This may help with recovering from bad group states.

* address PR feedback

* readd fixes

* clippy

* clippy tests

* rename to swap_members

* Apply suggestions from code review

Co-authored-by: raphaelrobert <[email protected]>

* fmt

---------

Co-authored-by: Jan Winkelmann (keks) <[email protected]>
Co-authored-by: Jan Winkelmann <[email protected]>
Co-authored-by: raphaelrobert <[email protected]>

* extend changelog from #1855 (#1857)

* chore: allow deprecated warnings in rustcrypto for now (#1858)

* Update validation for extension types of leaf node extensions (#1831)

* test adding an ApplicationIdExtension to the leaf node extensions

* check leaf node extensions with `is_valid_in_leaf_node()`

* improve comments

* update doc comment

* update comment

* validate extensions on `LeafNodeParametersBuilder`

* validate leaf node extension types

* update test

* add tests

* move validation logic to method

* add note to `LeafNode::validate_locally()` about extension type validation

* improve comment

* remove unneeded flag

* improve comment

* improve comment

* fix link

* add validation check references and update comment

* update note about extension type validation

* improve comment

* Fix references to validation dashboard for some tests (#1861)

* update test names

* add references to validation checks

* chore: psk validation when processing welcome messages (#1862)

Fixes parts of #1122.

- Only reinit and branch resumption PSKs in Welcomes
- Only one reinit or branch resumption PSK in Welcomes
- Check PSK nonce length in Welcomes

* feat: add sqlx based storage provider (#1854)

* chore: update PSK validation id comments (#1863)

* feat: add from_components method to avoid allocations in TreeNode (#1864)

* doc: correct RFC section reference in key schedule documentation (#1865)

* fix: store application export tree after group creation (#1871)

* chore: fix PPRF tests (#1870)

* feat: add `extensions-draft-08` support to sqlx storage provider (#1872)

* Implement AppEphemeral proposal and update AppAck implementation (#1868)

* docs: add docsrs cfg feature and document features

* update dependabot

* For `extensions-draft-08` flag, selectively enable optional storage provider dependencies (#1876)

* in `extensions-draft-08` feature, selectively enable optional dependency features
* add `extensions-draft-08` feature to libcrux crypto provider

* chore(deps): update criterion requirement from ^0.5 to ^0.7

Updates the requirements on [criterion](https://github.com/bheisler/criterion.rs) to permit the latest version.
- [Changelog](https://github.com/bheisler/criterion.rs/blob/master/CHANGELOG.md)
- [Commits](bheisler/criterion.rs@0.5.0...0.7.0)

---
updated-dependencies:
- dependency-name: criterion
  dependency-version: 0.7.0
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <[email protected]>

* chore(deps): update rstest requirement from 0.24 to 0.26

Updates the requirements on [rstest](https://github.com/la10736/rstest) to permit the latest version.
- [Release notes](https://github.com/la10736/rstest/releases)
- [Changelog](https://github.com/la10736/rstest/blob/master/CHANGELOG.md)
- [Commits](la10736/rstest@v0.24.0...v0.26.1)

---
updated-dependencies:
- dependency-name: rstest
  dependency-version: 0.26.1
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <[email protected]>

* chore(deps): update refinery requirement from 0.8 to 0.9

Updates the requirements on [refinery](https://github.com/rust-db/refinery) to permit the latest version.
- [Release notes](https://github.com/rust-db/refinery/releases)
- [Changelog](https://github.com/rust-db/refinery/blob/main/CHANGELOG.md)
- [Commits](rust-db/refinery@0.8.4...v0.9.0)

---
updated-dependencies:
- dependency-name: refinery
  dependency-version: 0.9.0
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <[email protected]>

* [CI] Build workspace with `extensions-draft-08` feature flag, and simplify `openmls` crate feature build combinations (#1894)

* group all developer options in `cargo hack` command

* test `extensions-draft-08` feature in workspace

* chore(deps): bump actions/checkout from 4 to 5

Bumps [actions/checkout](https://github.com/actions/checkout) from 4 to 5.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](actions/checkout@v4...v5)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-version: '5'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <[email protected]>

* Add AES-GCM support to libcrux provider, and update libcrux dependencies (#1874)

* update libcrux dependencies
* use `libcrux-aead` APIs for chacha20poly1305
* add AES-GCM support
* update changelogs
* add provider aead test
* use git dependency for `hpke-rs`

* chore(deps): update indicatif requirement from 0.17.8 to 0.18.3

Updates the requirements on [indicatif](https://github.com/console-rs/indicatif) to permit the latest version.
- [Release notes](https://github.com/console-rs/indicatif/releases)
- [Commits](console-rs/indicatif@0.17.8...0.18.3)

---
updated-dependencies:
- dependency-name: indicatif
  dependency-version: 0.18.3
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <[email protected]>

* chore(deps): bump actions/checkout from 5 to 6

Bumps [actions/checkout](https://github.com/actions/checkout) from 5 to 6.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](actions/checkout@v5...v6)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-version: '6'
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <[email protected]>

* feat: optimize Signable to reuse serialized payload

* chore(deps): update thiserror requirement from 1.0 to 2.0

---
updated-dependencies:
- dependency-name: thiserror
  dependency-version: 2.0.17
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <[email protected]>

* book: remove multilingual config

* ci: remove crypto-subtle feature from cargo hack

* Implement HPKE safe encrypt/decrypt with label (MLS Extensions Draft) (#1898)

* implement safe encrypt and decrypt
* add component module

* fixup: rustdoc links

* Remove nightly-only cargo fmt config settings

* correction in tree operations KAT

* bump hpke to 0.4 (#1911)

* Improve the error return types in TreeSync

* chore: update hpke-rs to 0.5.0

* add from_bytes wasm bindings for KeyPackage/RatchetTree

* ci: update tests

* Add injection and handling for GREASE values

* Always add grease

* Enhance GREASE support by adding convenience methods for injecting random GREASE values into capabilities. Update documentation to clarify GREASE handling and ensure users opt-in for GREASE value inclusion. Adjust tests to reflect changes in GREASE injection behavior.

* Formatting fix

* Update CHANGELOG and user manual to reflect GREASE enhancements and clarify usage. Added details on RFC-defined vs. custom GREASE values, and emphasized the purpose of GREASE in implementation.

* Fix typo in test comment for own messages (#1917)

Co-authored-by: raphaelrobert <[email protected]>

* chore(deps): update reqwest requirement from 0.12 to 0.13 (#1922)

Updates the requirements on [reqwest](https://github.com/seanmonstar/reqwest) to permit the latest version.
- [Release notes](https://github.com/seanmonstar/reqwest/releases)
- [Changelog](https://github.com/seanmonstar/reqwest/blob/master/CHANGELOG.md)
- [Commits](seanmonstar/reqwest@v0.12.0...v0.13.1)

---
updated-dependencies:
- dependency-name: reqwest
  dependency-version: 0.13.1
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: raphaelrobert <[email protected]>

* Update openmls-wasm/src/lib.rs

Co-authored-by: Jan Winkelmann <[email protected]>

* Update openmls-wasm/src/lib.rs

Co-authored-by: Jan Winkelmann <[email protected]>

* add comments for RatchetTree wasm functions

* chore(deps): update criterion requirement from ^0.7 to ^0.8 (#1912)

Updates the requirements on [criterion](https://github.com/criterion-rs/criterion.rs) to permit the latest version.
- [Release notes](https://github.com/criterion-rs/criterion.rs/releases)
- [Changelog](https://github.com/criterion-rs/criterion.rs/blob/master/CHANGELOG.md)
- [Commits](criterion-rs/criterion.rs@criterion-plot-v0.7.0...criterion-v0.8.0)

---
updated-dependencies:
- dependency-name: criterion
  dependency-version: 0.8.0
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Franziskus Kiefer <[email protected]>
Co-authored-by: raphaelrobert <[email protected]>

* feat: make JoinBuilder::new API public (#1924)

This allows to create JoinBuilder from a processed welcome exposing a
more flexible API when converting it into a staged welcome.

* update `rand` dependency for tests

* update `rand` dependency in `ds-lib`

* update rustflags and getrandom dependency for tests

* reorganize flags for getrandom backend and update workflows

* update `getrandom` and remove `RUSTFLAGS` that are no longer required as of that version

* remove `libcrux-provider-js` feature flag

* update changelog

* feat: store pending proposals
feat: expand example to show how to send messages and handling adding 3rd person

* fix: check for duplicate PSK IDs in commits (#1928)

* Add AppData mechanisms from the extensions draft (#1930)

This commit adds an implementation of the AppDataDictionary (and
related) structs, as well as the AppDataUpdate proposal (and handling)
as defined in the extensions draft.

Since the proposals contain diffs in an appplication-defined format,
processing of these proposals requires extra work from the application.

While working on this we also found a missing validation check that we added.

Co-authored-by: wysiwys <[email protected]>
Co-authored-by: Konrad Kohbrok <[email protected]>

* add AAD getter to `PrivateMessageIn` (#1934)

* Enforce allowed extension types using Rust types (#1927)

Closes #1830 

Extends PR #1834 by integrating @keks’s work on extension validation.

* Don't use git dependencies for hpke-rs, update tonic in interop_client (#1941)

* don't use git dependencies for hpke-rs

* update tonic in interop client

* fix: skip removed members in capabilities check (#1943)

* fix: correctly access credentials from past epochs (#1944)

* update libcrux and hpke deps (#1945)

* feat: don't replace groups by default (#1929)

This PR changes `MlsGroup` constructors (both for fresh groups, as well as groups created from a `Welcome`) s.t. they don't replace pre-existing groups with the same `GroupId`. If the application would like to replace an existing group, it can either just delete the group manually before recreating it, or call the `replace_old_group` on the `MlsGroupBuilder` or the `JoinBuilder`.

This PR also changes the semantics on the `store` functions of the `sqlx_storage` and the `sqlite_storage` from `INSERT` to `INSERT OR REPLACE`.

* Add APIs to access information about the next epoch from a StagedCommit (#1936)

* Allow accessing info about next epoch from StagedCommit

* add tests

* fix clippy

* fmt

* add better error handling

* update changelog (#1948)

* Add and document more validation checks (#1933)

Co-authored-by: Konrad Kohbrok <[email protected]>

* feat: derive serde Serialize and Deserialize for MlsMessageOut (#1950)

* Merge commit from fork

* prep release

* chore: bump memory provider version to 0.5.0 (#1953)

* relax wasm size limit (#1949)

* update ciphersuites in book (#1954)

* TreeSync: expose full_leaves/parents; make full_leaves provide LeafNodeIndex (#1955)

* update libcrux and hpke-rs depdencenies (#1962)

* update libcrux and hpke-rs depdencenies
* drop unused wasm ci job

* chore: prepare 0.8.1 release (#1964)

* Expose TreeSync for MlsGroup and PublicGroup (#1959)

* expose TreeSync for MlsGroup and PublicGroup

* expose TreeSync struct

* add missing import

* clippy

* add integration test

* publish ParentNodeIndex::32 and add check to test

* expose API to get blank nodes and a test that accesses it

* expose ParentNodeIndex

* Derive TlsSerializeBytes for SignatureScheme (#1965)

* Add API to export secret from staged welcome (#1961)

* Expose epoch in private and public messages and public group getter (#1970)

* update hpke and libcrux dependencies (#1975)

* feat(basic_credential): zeroize SignatureKeyPair private key on drop (#1973)

## Summary

Replaces `private: Vec<u8>` with `private: SecretVLBytes` in `SignatureKeyPair`, ensuring Ed25519/P-256 private key bytes are automatically zeroed when the struct is dropped.

This follows the same pattern established in #1369 for `HpkePrivateKey` and `ExporterSecret`.

## Changes

- `basic_credential/src/lib.rs`: `private` field type changed from `Vec<u8>` to `SecretVLBytes`
- Construction sites updated to use `From<&[u8]>` / `From<Vec<u8>>` conversions
- `private()` test-utils accessor updated to use `as_slice()`
- No API changes — `from_raw()` still accepts `Vec<u8>` (converted internally)

## Testing

- `cargo check -p openmls -p openmls_basic_credential -p openmls_rust_crypto --features test-utils` — clean
- `cargo test -p openmls --lib --features test-utils` — 1732 passed, 0 failed

Closes #1969

* Add APIs for time-based deletion of past epoch secrets (#1972)

* add new APIs

* improve documentation

* Minor refactor and add optional `max_past_epochs` to new APIs

Includes a small refactor of how the `MessageSecrets` struct is stored
alongside its timestamp.

* add new tests and update existing tests

* improve documentation

* update documentation

* update tests to ensure start time is always before epoch timestamps

* make timestamp optional

* implement compatible deserialization and add tests

* use policies for past epoch deletion

* documentation

* alias for previous name of storage field

* add test data

* remove unused API and make timestamp optional

* reorganize tests

* ensure compatible deserialization of policy

* fix documentation

* fix argument

* use correct argument name

* wip

* simplify past epoch secret deletion APIs

* add book page and update book text

* add book code anchors and reorganize test

* simplify past epoch deletion policy enum

* update all new APIs to take policy as argument

* update documentation

* update tests and documentation

* more info on the epoch secret deletion APIs and policy

* remove duplicate markdown file

* clean up tests and documentation

* documentation

* update docs and add documentation TODOs

* formatting

* reorganize tests

* clear the past secrets if no time filter provided

* clean up tests and documentation

* clean up comments/TODOs

* configure test methods for `test` only

* simplify `cfg`

* use past epoch deletion policy in group builder in `MlsGroup::reboot()`

* fix lints

* use RustCrypto provider in storage compat test

* disable sqlite storage test for wasm32

* fix typo

Co-authored-by: Franziskus Kiefer <[email protected]>

* remove out of date docs

* add note about deprecation

* update docs

Co-authored-by: Franziskus Kiefer <[email protected]>

* move `max_past_epochs` logic to `if` clause

* delete past epoch secrets from storage

* handle a mixture of `Some` and `None` timestamps and add initial tests

* check persistence of deletion in tests

* check loaded group

* add API to group for setting policy, and add test

* documentation updates

* add doc comments

* load testing SQL statements from file at runtime

* more documentation of `PastEpochDeletionPolicy`

* address doc TODOs

* cleaner retrieval of matching index

* API for deleting all past secrets without timestamps

* add comment

* remove TODO

* more documentation

* rename method to resize store

* set and persist the join config

* add API to get a group's past epoch deletion policy

* update tests to ensure policy is updated

* update phrasing

* update changelog

* add test for policy persistence on group

---------

Co-authored-by: Franziskus Kiefer <[email protected]>

* feat: allow app data dictionary extension in key packages (#1979)

According to [draft-ietf-mls-extensions-09], section 4.6, key packages
can contain an application data dictionary extension.

Also fix missing error handling in `apply_app_data_update_proposals`.

* feat: clean up lifetime validation and errors (#1980)

* update the `rusqlite` version used in `openmls_sqlite_storage` (#1982)

---------

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: raphaelrobert <[email protected]>
Co-authored-by: Konrad Kohbrok <[email protected]>
Co-authored-by: Nuke 🌄 <[email protected]>
Co-authored-by: Franziskus Kiefer <[email protected]>
Co-authored-by: Jan Winkelmann (keks) <[email protected]>
Co-authored-by: Jan Winkelmann <[email protected]>
Co-authored-by: clara <[email protected]>
Co-authored-by: WaterWhisperer <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Jeff Gardner <[email protected]>
Co-authored-by: raphaelrobert <[email protected]>
Co-authored-by: Mayel de Borniol <[email protected]>
Co-authored-by: Stanley Sebastian <[email protected]>
Co-authored-by: Mayel de Borniol <[email protected]>
Co-authored-by: wysiwys <[email protected]>
Co-authored-by: Adam Sparks <[email protected]>
Co-authored-by: tbehner <[email protected]>
Co-authored-by: Alec Marcus <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

GroupContextExtensions proposal with invalid extension types can be applied

3 participants