Skip to content

Enforce app_data_dictionary immutability for bare GroupContextExtensions proposals - #2125

Merged
franziskuskiefer merged 1 commit into
openmls:mainfrom
xmtp:tyler/gce-dict-immutability-upstream
Jul 23, 2026
Merged

franziskuskiefer merged 1 commit into
openmls:mainfrom
xmtp:tyler/gce-dict-immutability-upstream

Conversation

@tylerhawkes

Copy link
Copy Markdown
Contributor

What

validate_app_data_update_proposals_and_group_context enforces
draft-ietf-mls-extensions §4.7-6:
once a group's required_capabilities include the AppDataUpdate proposal type,
a GroupContextExtensions proposal MUST NOT add, remove, or modify the
app_data_dictionary extension.

Today that check sits after an early return:

let no_app_data_updates = proposal_queue.app_data_update_proposals().next().is_none();
if no_app_data_updates {
    return Ok(());
}
// ... CannotUpdateDictionaryDirectly check ...

So the rule is only enforced when the commit also carries at least one
AppDataUpdate proposal. A bare GroupContextExtensions proposal — one with
no accompanying AppDataUpdate proposals — skips the check entirely and can
rewrite app_data_dictionary directly, bypassing the AppDataUpdate machinery
(and any application-level validation layered on it). On a group whose members
all support AppDataUpdate, any member can thereby overwrite arbitrary
components of the dictionary.

Fix

Hoist the dictionary-immutability check above the early return, so it binds
every commit that carries a GroupContextExtensions proposal regardless of
whether AppDataUpdate proposals accompany it.

The rule is treated as active when the group requires AppDataUpdate before or
after
the commit:

  • Reading only the proposed required_capabilities would let a sender evade
    the check by dropping AppDataUpdate from required_capabilities in the same
    proposal.
  • Reading only the current required_capabilities would incorrectly flag the
    migrating commit that both introduces the dictionary and adds AppDataUpdate.

The ordering and duplicate-AppDataUpdate checks remain after the early return,
where they belong (they are only meaningful when AppDataUpdate proposals are
present).

Tests

Adds test_group_context_update_dictionary_without_app_data_update: a bare
GroupContextExtensions proposal that touches the dictionary with no
accompanying AppDataUpdate proposal must be rejected with
CannotUpdateDictionaryDirectly. The three existing tests in
app_data_update_proposal_validation.rs (update_dictionary, wrong_order,
after_deactivating) are unaffected — validate_group_context_extensions_proposal
runs first, so the ExtensionNotInRequiredCapabilities path is preserved.

Runs under --features extensions-draft,extensions-draft-test-dependencies.

…tensions proposals

draft-ietf-mls-extensions §4.7-6 requires that, once a group's required_capabilities include the AppDataUpdate proposal type, a GroupContextExtensions proposal MUST NOT add, remove, or modify the app_data_dictionary extension.

The check in validate_app_data_update_proposals_and_group_context was gated behind an early return that fires whenever a commit carries no AppDataUpdate proposals, so a bare GroupContextExtensions proposal could rewrite the app_data_dictionary directly, bypassing the AppDataUpdate machinery entirely.

Hoist the dictionary-immutability check above that early return so it binds every commit carrying a GroupContextExtensions proposal, and evaluate it against the required_capabilities in effect either before or after the commit — a sender cannot evade it by also dropping AppDataUpdate from required_capabilities, and the migrating commit that introduces both the dictionary and AppDataUpdate is unaffected.

Adds a regression test covering a bare GroupContextExtensions proposal that touches the dictionary with no accompanying AppDataUpdate proposal.

@keks keks 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.

Oh, good catch. Thanks!

tylerhawkes added a commit to xmtp/openmls that referenced this pull request Jul 22, 2026
…ons proposals

Replays open upstream PR openmls#2125: the dictionary-immutability
check ran after the no-AppDataUpdate early return, so a commit carrying only
a GroupContextExtensions proposal could rewrite the app_data_dictionary
directly, bypassing the AppDataUpdate machinery. Move the check ahead of the
early return and trigger it when either the current or the proposed
required_capabilities contains AppDataUpdate.

Drop at the upstream merge after openmls#2125 lands.
tylerhawkes added a commit to xmtp/libxmtp that referenced this pull request Jul 22, 2026
…+ GCE dict-immutability fix

Moves the openmls pin from e125674 (the pre-merge fork line) to fork
main 3fabbf2, which carries the merged upstream (openmls/openmls
65396d8), the replayed fork storage format (xmtp/openmls#56), and the
GCE dict-immutability security fix (upstream openmls/openmls#2125,
replayed as #56's fifth commit).

Ripple effects absorbed here:

- extensions-draft-08 -> extensions-draft (upstream #2060 rename), and
  the 0x004D XWing ciphersuite is now behind
  draft-ietf-mls-pq-ciphersuites, so that feature is enabled.
- tls_codec 0.4.2 -> 0.5 to match openmls: trait impls on openmls types
  are version-specific. Encode side is byte-identical; the decode side
  gains strict length-boundary enforcement (rejects non-canonical
  encodings no conforming encoder produces) plus allocation hardening.
- xmtp/hpke-rs fork bumped to the libcrux series hpke-rs 0.7.0 uses so
  hax-lib unifies at 0.3.7 with the new openmls chain; libxmtp's direct
  hpke usage stays on the forked 0.6.1 API (0x004D welcome codepoint).
- App-data processing ported to upstream's redesigned flow:
  process_message now returns commits covering AppDataUpdate proposals
  as UnresolvedAppDataCommit; the wrapper interprets the (already
  reference-resolved) proposals and resumes staging via
  resolve_app_data_commit. The PAUSE-BEFORE-PARSE floor check moves to
  a pre-processing content_type() check (pause-only, so the
  unauthenticated signal is safe) with a staged-commit backstop.
- New ProcessedMessageContent variants handled: OwnPrivateMessage is a
  clean skip (replaces the opaque decryption error own fanned-back
  messages used to produce), OwnPendingCommit and
  UnresolvedAppDataCommit are defensive errors (unreachable under the
  pure-ciphertext wire policy / the resolving wrapper).
- Proposal::_AppAck arms dropped (variant removed upstream).
- cargo-deny: all seven openmls/libcrux advisory allowances removed
  (RUSTSEC-2026-0124, -0207..-0212) — this bump is the fix they were
  waiting on — plus stale RUSTSEC-2021-0139 (ansi_term left the graph).
tylerhawkes added a commit to xmtp/libxmtp that referenced this pull request Jul 22, 2026
…+ GCE dict-immutability fix

Moves the openmls pin from e125674 (the pre-merge fork line) to fork
main 3fabbf2, which carries the merged upstream (openmls/openmls
65396d8), the replayed fork storage format (xmtp/openmls#56), and the
GCE dict-immutability security fix (upstream openmls/openmls#2125,
replayed as #56's fifth commit).

Ripple effects absorbed here:

- extensions-draft-08 -> extensions-draft (upstream #2060 rename), and
  the 0x004D XWing ciphersuite is now behind
  draft-ietf-mls-pq-ciphersuites, so that feature is enabled.
- tls_codec 0.4.2 -> 0.5 to match openmls: trait impls on openmls types
  are version-specific. Encode side is byte-identical; the decode side
  gains strict length-boundary enforcement (rejects non-canonical
  encodings no conforming encoder produces) plus allocation hardening.
- xmtp/hpke-rs fork bumped to the libcrux series hpke-rs 0.7.0 uses so
  hax-lib unifies at 0.3.7 with the new openmls chain; libxmtp's direct
  hpke usage stays on the forked 0.6.1 API (0x004D welcome codepoint).
- App-data processing ported to upstream's redesigned flow:
  process_message now returns commits covering AppDataUpdate proposals
  as UnresolvedAppDataCommit; the wrapper interprets the (already
  reference-resolved) proposals and resumes staging via
  resolve_app_data_commit. The PAUSE-BEFORE-PARSE floor check moves to
  a pre-processing content_type() check (pause-only, so the
  unauthenticated signal is safe) with a staged-commit backstop.
- New ProcessedMessageContent variants handled: OwnPrivateMessage is a
  clean skip (replaces the opaque decryption error own fanned-back
  messages used to produce), OwnPendingCommit and
  UnresolvedAppDataCommit are defensive errors (unreachable under the
  pure-ciphertext wire policy / the resolving wrapper).
- Proposal::_AppAck arms dropped (variant removed upstream).
- cargo-deny: all seven openmls/libcrux advisory allowances removed
  (RUSTSEC-2026-0124, -0207..-0212) — this bump is the fix they were
  waiting on — plus stale RUSTSEC-2021-0139 (ansi_term left the graph).
@franziskuskiefer

franziskuskiefer commented Jul 23, 2026 •

Copy link
Copy Markdown
Member

@tylerhawkes did you mean to close this? @keks I guess we should still merge this here?

@keks keks reopened this Jul 23, 2026
@keks

keks commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

Yeah, let's merge this

@franziskuskiefer
franziskuskiefer merged commit 34222ef into openmls:main Jul 23, 2026
82 checks passed
tylerhawkes added a commit to xmtp/libxmtp that referenced this pull request Jul 23, 2026
…+ GCE dict-immutability fix

Moves the openmls pin from e125674 (the pre-merge fork line) to fork
main 3fabbf2, which carries the merged upstream (openmls/openmls
65396d8), the replayed fork storage format (xmtp/openmls#56), and the
GCE dict-immutability security fix (upstream openmls/openmls#2125,
replayed as #56's fifth commit).

Ripple effects absorbed here:

- extensions-draft-08 -> extensions-draft (upstream #2060 rename), and
  the 0x004D XWing ciphersuite is now behind
  draft-ietf-mls-pq-ciphersuites, so that feature is enabled.
- tls_codec 0.4.2 -> 0.5 to match openmls: trait impls on openmls types
  are version-specific. Encode side is byte-identical; the decode side
  gains strict length-boundary enforcement (rejects non-canonical
  encodings no conforming encoder produces) plus allocation hardening.
- xmtp/hpke-rs fork bumped to the libcrux series hpke-rs 0.7.0 uses so
  hax-lib unifies at 0.3.7 with the new openmls chain; libxmtp's direct
  hpke usage stays on the forked 0.6.1 API (0x004D welcome codepoint).
- App-data processing ported to upstream's redesigned flow:
  process_message now returns commits covering AppDataUpdate proposals
  as UnresolvedAppDataCommit; the wrapper interprets the (already
  reference-resolved) proposals and resumes staging via
  resolve_app_data_commit. The PAUSE-BEFORE-PARSE floor check moves to
  a pre-processing content_type() check (pause-only, so the
  unauthenticated signal is safe) with a staged-commit backstop.
- New ProcessedMessageContent variants handled: OwnPrivateMessage is a
  clean skip (replaces the opaque decryption error own fanned-back
  messages used to produce), OwnPendingCommit and
  UnresolvedAppDataCommit are defensive errors (unreachable under the
  pure-ciphertext wire policy / the resolving wrapper).
- Proposal::_AppAck arms dropped (variant removed upstream).
- cargo-deny: all seven openmls/libcrux advisory allowances removed
  (RUSTSEC-2026-0124, -0207..-0212) — this bump is the fix they were
  waiting on — plus stale RUSTSEC-2021-0139 (ansi_term left the graph).
tylerhawkes added a commit to xmtp/libxmtp that referenced this pull request Jul 23, 2026
…+ GCE dict-immutability fix

Moves the openmls pin from e125674 (the pre-merge fork line) to fork
main 3fabbf2, which carries the merged upstream (openmls/openmls
65396d8), the replayed fork storage format (xmtp/openmls#56), and the
GCE dict-immutability security fix (upstream openmls/openmls#2125,
replayed as #56's fifth commit).

Ripple effects absorbed here:

- extensions-draft-08 -> extensions-draft (upstream #2060 rename), and
  the 0x004D XWing ciphersuite is now behind
  draft-ietf-mls-pq-ciphersuites, so that feature is enabled.
- tls_codec 0.4.2 -> 0.5 to match openmls: trait impls on openmls types
  are version-specific. Encode side is byte-identical; the decode side
  gains strict length-boundary enforcement (rejects non-canonical
  encodings no conforming encoder produces) plus allocation hardening.
- xmtp/hpke-rs fork bumped to the libcrux series hpke-rs 0.7.0 uses so
  hax-lib unifies at 0.3.7 with the new openmls chain; libxmtp's direct
  hpke usage stays on the forked 0.6.1 API (0x004D welcome codepoint).
- App-data processing ported to upstream's redesigned flow:
  process_message now returns commits covering AppDataUpdate proposals
  as UnresolvedAppDataCommit; the wrapper interprets the (already
  reference-resolved) proposals and resumes staging via
  resolve_app_data_commit. The PAUSE-BEFORE-PARSE floor check moves to
  a pre-processing content_type() check (pause-only, so the
  unauthenticated signal is safe) with a staged-commit backstop.
- New ProcessedMessageContent variants handled: OwnPrivateMessage is a
  clean skip (replaces the opaque decryption error own fanned-back
  messages used to produce), OwnPendingCommit and
  UnresolvedAppDataCommit are defensive errors (unreachable under the
  pure-ciphertext wire policy / the resolving wrapper).
- Proposal::_AppAck arms dropped (variant removed upstream).
- cargo-deny: all seven openmls/libcrux advisory allowances removed
  (RUSTSEC-2026-0124, -0207..-0212) — this bump is the fix they were
  waiting on — plus stale RUSTSEC-2021-0139 (ansi_term left the graph).
tylerhawkes added a commit to xmtp/libxmtp that referenced this pull request Jul 24, 2026
…+ GCE dict-immutability fix

Moves the openmls pin from e125674 (the pre-merge fork line) to fork
main 3fabbf2, which carries the merged upstream (openmls/openmls
65396d8), the replayed fork storage format (xmtp/openmls#56), and the
GCE dict-immutability security fix (upstream openmls/openmls#2125,
replayed as #56's fifth commit).

Ripple effects absorbed here:

- extensions-draft-08 -> extensions-draft (upstream #2060 rename), and
  the 0x004D XWing ciphersuite is now behind
  draft-ietf-mls-pq-ciphersuites, so that feature is enabled.
- tls_codec 0.4.2 -> 0.5 to match openmls: trait impls on openmls types
  are version-specific. Encode side is byte-identical; the decode side
  gains strict length-boundary enforcement (rejects non-canonical
  encodings no conforming encoder produces) plus allocation hardening.
- xmtp/hpke-rs fork bumped to the libcrux series hpke-rs 0.7.0 uses so
  hax-lib unifies at 0.3.7 with the new openmls chain; libxmtp's direct
  hpke usage stays on the forked 0.6.1 API (0x004D welcome codepoint).
- App-data processing ported to upstream's redesigned flow:
  process_message now returns commits covering AppDataUpdate proposals
  as UnresolvedAppDataCommit; the wrapper interprets the (already
  reference-resolved) proposals and resumes staging via
  resolve_app_data_commit. The PAUSE-BEFORE-PARSE floor check moves to
  a pre-processing content_type() check (pause-only, so the
  unauthenticated signal is safe) with a staged-commit backstop.
- New ProcessedMessageContent variants handled: OwnPrivateMessage is a
  clean skip (replaces the opaque decryption error own fanned-back
  messages used to produce), OwnPendingCommit and
  UnresolvedAppDataCommit are defensive errors (unreachable under the
  pure-ciphertext wire policy / the resolving wrapper).
- Proposal::_AppAck arms dropped (variant removed upstream).
- cargo-deny: all seven openmls/libcrux advisory allowances removed
  (RUSTSEC-2026-0124, -0207..-0212) — this bump is the fix they were
  waiting on — plus stale RUSTSEC-2021-0139 (ansi_term left the graph).
tylerhawkes added a commit to xmtp/libxmtp that referenced this pull request Jul 25, 2026
…+ GCE dict-immutability fix

Moves the openmls pin from e125674 (the pre-merge fork line) to fork
main 3fabbf2, which carries the merged upstream (openmls/openmls
65396d8), the replayed fork storage format (xmtp/openmls#56), and the
GCE dict-immutability security fix (upstream openmls/openmls#2125,
replayed as #56's fifth commit).

Ripple effects absorbed here:

- extensions-draft-08 -> extensions-draft (upstream #2060 rename), and
  the 0x004D XWing ciphersuite is now behind
  draft-ietf-mls-pq-ciphersuites, so that feature is enabled.
- tls_codec 0.4.2 -> 0.5 to match openmls: trait impls on openmls types
  are version-specific. Encode side is byte-identical; the decode side
  gains strict length-boundary enforcement (rejects non-canonical
  encodings no conforming encoder produces) plus allocation hardening.
- xmtp/hpke-rs fork bumped to the libcrux series hpke-rs 0.7.0 uses so
  hax-lib unifies at 0.3.7 with the new openmls chain; libxmtp's direct
  hpke usage stays on the forked 0.6.1 API (0x004D welcome codepoint).
- App-data processing ported to upstream's redesigned flow:
  process_message now returns commits covering AppDataUpdate proposals
  as UnresolvedAppDataCommit; the wrapper interprets the (already
  reference-resolved) proposals and resumes staging via
  resolve_app_data_commit. The PAUSE-BEFORE-PARSE floor check moves to
  a pre-processing content_type() check (pause-only, so the
  unauthenticated signal is safe) with a staged-commit backstop.
- New ProcessedMessageContent variants handled: OwnPrivateMessage is a
  clean skip (replaces the opaque decryption error own fanned-back
  messages used to produce), OwnPendingCommit and
  UnresolvedAppDataCommit are defensive errors (unreachable under the
  pure-ciphertext wire policy / the resolving wrapper).
- Proposal::_AppAck arms dropped (variant removed upstream).
- cargo-deny: all seven openmls/libcrux advisory allowances removed
  (RUSTSEC-2026-0124, -0207..-0212) — this bump is the fix they were
  waiting on — plus stale RUSTSEC-2021-0139 (ansi_term left the graph).
tylerhawkes added a commit to xmtp/libxmtp that referenced this pull request Jul 25, 2026
…+ GCE dict-immutability fix (#3872)

Repins openmls from `e125674` (the pre-merge fork line) to fork main
`3fabbf2`: the merged upstream (openmls/openmls `65396d8`), the replayed
fork storage format (xmtp/openmls#56), and the GCE dict-immutability
security fix (upstream openmls/openmls#2125, carried as #56's fifth
commit). This supersedes the earlier revision of this PR, which pinned a
pre-merge branch carrying only the GCE fix.

## What the new pin buys

- **Persisted storage format restored on fork main** (xmtp/openmls#56):
storage tags, the bincode-safe `PastEpochDeletionPolicy` encoding, and
tolerant trailing-field deserialization — data written by libxmtp
1.9/1.10 (pre-`added_at`, `max_past_epochs`) and 1.11-dev loads
unchanged. Guarded by bincode round-trip and EOF-tolerance tests
fork-side.
- **GCE dict-immutability**: a bare `GroupContextExtensions` proposal
can no longer rewrite `app_data_dictionary` directly.
- **cargo-deny cleanup**: all seven openmls/libcrux advisory allowances
removed (RUSTSEC-2026-0124, -0207 through -0212 — this bump is the fix
they were waiting on), plus stale RUSTSEC-2021-0139 (`ansi_term` left
the dependency graph). `cargo deny check advisories` passes.

## Ripple effects absorbed

- **Feature renames**: `extensions-draft-08` → `extensions-draft`
(upstream #2060); the 0x004D XWing ciphersuite moved behind
`draft-ietf-mls-pq-ciphersuites`, now enabled.
- **tls_codec 0.4.2 → 0.5** to match openmls (trait impls on openmls
types are version-specific). Encode side is byte-identical; decode side
gains strict length-boundary enforcement — it rejects only non-canonical
encodings that no conforming encoder produces — plus allocation/overflow
hardening. The hpke-rs 0.6.1 fork keeps its own 0.4.2 internally; the
versions never exchange types.
- **xmtp/hpke-rs fork libcrux bump**: the fork's libcrux deps move to
the series upstream hpke-rs 0.7.0 uses, so `hax-lib` unifies at 0.3.7
with the new openmls chain. The forked 0.6.1 API (and the 0x004D
obsolete-XWing welcome codepoint for 1.9/1.10 wire compat) is unchanged;
all 9 XWing draft-06 suites pass fork-side.
- **App-data processing ported to upstream's redesigned flow**:
`unprotect_message` + `process_unverified_message_with_app_data_updates`
are gone; `process_message` now returns commits covering `AppDataUpdate`
proposals as `UnresolvedAppDataCommit`, and the wrapper interprets the
(already reference-resolved) proposals and resumes staging via
`resolve_app_data_commit`. The PAUSE-BEFORE-PARSE floor check moves
ahead of processing, keyed off the framing `content_type()` — safe
because the check only ever pauses a group whose committed floor already
exceeds this client — with a staged-commit backstop. The manual
by-reference proposal resolution block is deleted (upstream resolves
references itself).
- **New `ProcessedMessageContent` variants**: `OwnPrivateMessage` (own
fanned-back message with no matching intent) is a clean skip that still
advances the cursor — replacing the opaque decryption error it used to
produce; `OwnPendingCommit` and `UnresolvedAppDataCommit` are defensive
errors (the former is unreachable under our pure-ciphertext wire policy,
the latter never escapes the wrapper).
- `Proposal::_AppAck` match arms dropped (variant removed upstream);
`non_retryable_error_increments_cursor` renamed to
`own_message_without_intent_skips_and_increments_cursor` to match the
typed skip it now exercises.

🤖 Generated with [Claude Code](https://claude.com/claude-code)
@tylerhawkes
tylerhawkes deleted the tyler/gce-dict-immutability-upstream branch July 27, 2026 02:47
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.

3 participants