Skip to content

[pull] main from dfinity:main#546

Merged
pull[bot] merged 3 commits intomikeyhodl:mainfrom
dfinity:main
Apr 21, 2026
Merged

[pull] main from dfinity:main#546
pull[bot] merged 3 commits intomikeyhodl:mainfrom
dfinity:main

Conversation

@pull
Copy link
Copy Markdown

@pull pull Bot commented Apr 21, 2026

See Commits and Changes for more details.


Created by pull[bot] (v2.0.0-alpha.4)

Can you help keep this open source service alive? 💖 Please sponsor : )

timothyaterton and others added 3 commits April 20, 2026 13:26
…#3778)

## Summary

- Introduces `DiscoverableOidcConfig` type and `oidc_configs` init field
(mutually exclusive with existing `openid_configs`) that relies on OIDC
discovery (`.well-known/openid-configuration`) instead of requiring all
provider details in the static config
- Adds `DiscoverableProvider` that periodically fetches discovery
metadata to obtain `issuer` and `jwks_uri` for JWT verification
- Adds `discovered_oidc_configs` query endpoint returning `OidcConfig`
with resolved provider state
- Validates that discovered `issuer` domain matches the `discovery_url`
domain (prevents impersonation)
- When both `openid_configs` and `oidc_configs` are provided, falls back
to `openid_configs` as the proven path

## Test plan

- [x] 7 new integration tests in `config/oidc_configs.rs` (init,
upgrade, retain, XOR, query)
- [x] Existing `openid_configs` tests pass unchanged (backward compat)
- [ ] Manual E2E with deployed canister using `oidc_configs`

🤖 Generated with [Claude Code](https://claude.com/claude-code)

---
[Next PR >](#3784)

---------

Co-authored-by: Arshavir Ter-Gabrielyan <arshavir.ter.gabrielyan@dfinity.org>
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-authored-by: timothyaterton <timothyaterton@users.noreply.github.com>
Apps using the new `AuthClient.requestAttributes()` method send an
`ii-icrc3-attributes` JSON-RPC request with a different message format
than the existing `ii_attributes` method. Internet Identity needs to
handle this new method while still supporting the legacy flow.

# Changes

**Frontend**
- Added `Icrc3AttributesParamsSchema` for validating the new `{ keys,
nonce }` params format.
- Added `handleIcrc3Attributes` handler that calls the ICRC-3 canister
methods and responds with `{ data, signature }` as base64.
- Regenerated candid bindings to include `prepare_icrc3_attributes` and
`get_icrc3_attributes`.

**Test app**
- Added ICRC-3 attribute request support with a "Use ICRC-3 attributes"
checkbox toggle.

# Tests

- Split OpenID e2e tests into `openid.spec.ts` (ICRC-3) and
`openid-legacy.spec.ts` (legacy `ii_attributes`).
- ICRC-3 spec covers: authenticate-only, name+email, unavailable
attributes, and verified_email.

---
<div align="right">Next: #3770 →</div>

---------

Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
…ecurity (#3784)

## Summary

Add the `aud` (audience / client_id) field to `OpenIdCredentialKey`,
changing it from `(iss, sub)` to `(iss, sub, aud)`. This is a security
prerequisite for SSO: since SSO allows anyone to provide a `client_id`
via their `ii-openid-configuration` endpoint, without `aud` in the key
two different OIDC clients at the same provider with the same user `sub`
would collide, enabling impersonation.

## Changes

- **Type update**: `OpenIdCredentialKey` type alias changed from `(Iss,
Sub)` to `(Iss, Sub, Aud)` in both `internet_identity_interface` and the
`openid` module
- **CBOR encoding**: `StorableOpenIdCredentialKey` rewritten with manual
`Encode`/`Decode` impls — new entries use CBOR map format `{0:iss,
1:sub, 2:aud}`; the decoder also handles legacy CBOR array format `[iss,
sub]` for backward compatibility
- **Migration**: `post_upgrade` drains the credential key index via
`pop_first`, resolves `aud` from each anchor's
`StorableOpenIdCredential` (which already stores `aud` at CBOR index
`#[n(2)]`), and re-inserts with the complete `(iss, sub, aud)` key.
Unresolvable entries are preserved with empty `aud` for retry on next
upgrade.
- **Key construction**: Updated `OpenIdCredential::key()`,
`StorableOpenIdCredential::key()`, `calculate_delegation_seed()`, and
all call sites
- **Candid interface**: Updated `.did` file and generated JS/TS
declarations
- **Frontend**: Updated credential removal call to pass `aud`
- **Tests**: Added unit tests for new CBOR map encoding, legacy array
decoding, and round-trip serialization. Updated existing test assertions
to use 3-tuple keys.

## Delegation seed backward compatibility

The `calculate_delegation_seed` function already receives `client_id`
(which equals `aud`) as a separate parameter. The seed calculation is
unchanged — `aud` from the key tuple is ignored (`_aud`) in the
destructuring, preserving identical `Principal` derivation for existing
credentials.

## Migration safety

- Uses `pop_first()` to drain the BTreeMap, avoiding byte-level encoding
mismatches between legacy array-encoded keys and new map-encoded keys
- Resolves `aud` from the anchor's stored `StorableOpenIdCredential`
which already has `aud` at CBOR index 2
- Falls back to re-inserting with empty `aud` if resolution fails, with
a logged warning — the entry is preserved for retry on next upgrade
- Idempotent: safe to run on every upgrade; entries already in the new
format are preserved unchanged

## Test plan

- [x] All 209 unit tests pass (including Candid interface compatibility)
- [ ] Integration tests (require canister WASM build — pass in CI)
- [ ] Deploy to testnet and verify migration of existing credentials
- [ ] Verify credential lookup works after migration
- [ ] Verify new credential registration includes `aud` in key

---
[< Previous PR](#3778)
| [Next PR >](#3785)

---------

Co-authored-by: Claude Agent <noreply@anthropic.com>
Co-authored-by: Arshavir Ter-Gabrielyan <arshavir.ter.gabrielyan@dfinity.org>
@pull pull Bot locked and limited conversation to collaborators Apr 21, 2026
@pull pull Bot added the ⤵️ pull label Apr 21, 2026
@pull pull Bot merged commit e68167f into mikeyhodl:main Apr 21, 2026
11 of 12 checks passed
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants