Repository navigation
Reconcile registration-delegation with merged II contract; restyle callback page - #50
Merged
Merged
Conversation
…llback page
Two related changes to the Phase-2 registration-delegation flow, both verified
against the beta II canister's live .did (fgte5-ciaaa-aaaad-aaatq-cai).
Merged mcp_register_v2 contract (correctness)
---------------------------------------------
II's merged frontend/canister no longer echo consent through the server:
mcp_register_v2 now takes a SINGLE argument, session_key. The user's chosen
permissions/max_ttl are captured earlier at prepare_mcp_registration_delegation
(stored server-side keyed by P_reg) and mcp_register_v2 recovers both them and
the anchor from caller() == P_reg. Our code was still on the older 3-arg echo;
it kept working only because Candid silently drops the two extra trailing args.
- Fragment/redeem: the pinned page forwards only {delegation, state}; RedeemBody
drops permissions/ttl; parse_consent and the fragment reads are removed.
- Redemption: redeem_registration_delegation drops the consent argument and
encodes Encode!(&session_der) (one arg). The reply (record { expiration;
permissions }) is unchanged and still feeds the read-only guard.
- Removed RegistrationConsent and IiPermissions::from_text (now dead). The
IiPermissions variant stays for decoding the reply; a test locks its on-wire
queries/all labels (the #40 shape-drift lesson, moved to where it now lives).
- Docs (module headers, README Phase-2 section) rewritten for the merged shape.
Callback page rendering (UX)
----------------------------
The pinned callback page shipped a strict CSP (default-src 'none') with no
style-src, so the browser silently dropped the page's inline style attribute and
rendered "Finishing sign-in…" as unstyled top-left serif text. Fixed by moving
styling into a nonce'd <style> block and adding style-src 'nonce-…' to the CSP
(no 'unsafe-inline'). The shared stylesheet gives a centered card, system font,
a CSS-only spinner (disabled under prefers-reduced-motion), light/dark theming,
lang=en, and an accessible role=status/aria-live region; errors hide the spinner.
The sibling finishing_page and connect_error pages reuse the same look.
cargo test: 87 passing; no new build/clippy warnings.
Co-Authored-By: Claude Opus 4.8 <[email protected]>
Claude-Session: https://claude.ai/code/session_014T9N8USDfNK5yzznPGg7Ym
There was a problem hiding this comment.
Pull request overview
Updates the Phase-2 registration-delegation flow to match Internet Identity’s merged mcp_register_v2 Candid contract (single session_key arg, consent recovered server-side by II) and fixes the /oauth/connect/callback UX regression caused by a strict CSP blocking inline styling.
Changes:
- Reconciles Phase-2 redemption with the merged II contract by removing the echoed consent tuple from the callback fragment, redeem body, and
mcp_register_v2call site (now encodes exactly one argument). - Adds contract-shape tests to lock the one-argument
mcp_register_v2wire shape and to pin the on-wirePermissionsvariant labels (queries/all). - Restyles the connect interstitial/error pages using a shared CSS block and updates the pinned callback page CSP to allow nonce’d inline styles via
style-src 'nonce-…'(nounsafe-inline).
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
src/identities.rs |
Updates Phase-2 registration delegation redemption to call mcp_register_v2(session_key) only; removes consent-echo plumbing; adds/updates tests to pin argument shape and permissions variant labels. |
src/auth.rs |
Updates pinned callback fragment/redeem payload to {delegation,state} only; removes consent parsing; adds shared CSS and nonce’d <style> plus CSP style-src for the pinned page; restyles related pages. |
README.md |
Updates Phase-2 protocol documentation to describe the merged II contract and the new fragment/redeem shapes (no consent echo). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Restyle the OAuth connect interstitial/error pages (pinned callback, v1 finishing page, connect error) to the DFINITY brand system, and add the official DFINITY logo. - Palette: Parchment #faf9f5 / Ink #1a1a1a / Rust #a8482b, hairline surfaces, grid-paper texture; dark theme uses the brand's Bark #14110d / Bone #f0ebe0 / Ember #c25a37 via prefers-color-scheme with a data-theme override. - Typography: editorial serif (Newsreader-style) for the status line, UI sans (Inter-style) for the eyebrow/hint, both from CSP-safe system-font stacks. - Logo: the official gradient-infinity mark + DFINITY wordmark, taken from dfinity.org and inlined as SVG so it loads under the pinned page's strict default-src 'none' CSP (no external fetch). The wordmark uses currentColor so it follows the Ink/Bone text color across themes; the infinity keeps its brand gradients. - Layout: centered card with hairline border and soft shadow, DFINITY logo, an "Internet Identity" eyebrow, the rust/ember spinner, and the status line. Everything stays self-contained (no external fonts/images/stylesheets), so the pinned callback page still renders under its strict CSP. cargo test: 87 passing. Co-Authored-By: Claude Opus 4.8 <[email protected]> Claude-Session: https://claude.ai/code/session_014T9N8USDfNK5yzznPGg7Ym
aterga
commented
Jul 11, 2026
…docs Review feedback on PR #50: - Move the inlined connect-page stylesheet and DFINITY logo out of auth.rs into real asset files (src/assets/connect.css, src/assets/dfinity-logo.svg) and embed them with include_str!. Content is still compiled into the binary (no runtime file I/O, still self-contained under the strict CSP); the served HTML is byte-identical. Authoring them as .css/.svg keeps auth.rs readable. - connect_error: escape `&` first (then `<` and `>`) before interpolating the message into HTML, so a message containing `&` or entities can't be misread as markup. - Docs: the README and auth.rs module doc described mcp_register_v2 as returning `record { expiration; permissions }`; it actually returns `variant { Ok : record { ... }; Err : text }` (a candid Result). Corrected both to the full variant shape (the Ok payload carries expiry + access level). cargo test: 87 passing; no new build warnings. Co-Authored-By: Claude Opus 4.8 <[email protected]> Claude-Session: https://claude.ai/code/session_014T9N8USDfNK5yzznPGg7Ym
…hape doc
- Accessibility (Copilot): move role=status / aria-live=polite off the whole
<main> card and onto just the status <p> on both the pinned callback page and
the v1 finishing page, so updating the message no longer risks re-announcing
the logo's aria-label or the eyebrow.
- Docs (Copilot): the identities.rs redeem note still described the
mcp_register_v2 reply as `record { expiration; permissions }`; correct it to
the full `variant { Ok : record { ... }; Err : text }` (decoded as
McpRegisterV2Reply; McpRegisterV2Ok is the Ok payload).
cargo test: 87 passing.
Co-Authored-By: Claude Opus 4.8 <[email protected]>
Claude-Session: https://claude.ai/code/session_014T9N8USDfNK5yzznPGg7Ym
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Two related changes to the Phase-2 registration-delegation flow, both verified against the beta II canister's live
.did(fgte5-ciaaa-aaaad-aaatq-cai).1. Merged
mcp_register_v2contract (correctness)II's merged frontend and canister no longer echo consent through the server.
mcp_register_v2now takes a single argument,session_key; the user's chosenpermissions/max_ttlare captured earlier atprepare_mcp_registration_delegation(stored server-side on an index keyed byP_reg), andmcp_register_v2recovers both them and the anchor fromcaller() == P_reg. Our code was still on the older three-argument echo; it kept working only because Candid silently drops the two extra trailing args.{delegation, state}.RedeemBodydropspermissions/ttl;parse_consentandIiPermissions::from_textare removed.redeem_registration_delegationdrops the consent argument and encodesEncode!(&session_der)(one arg). The reply (record { expiration; permissions }) is unchanged and still feeds the read-only guard.queries/allvariant labels (the Fix read-only sessions: decode II delegation permissions as opt text #40 shape-drift lesson, moved to where the variant now lives).2. Callback page rendering (UX)
GET /oauth/connect/callbackshipped a strict CSP (default-src 'none') with nostyle-src, so the browser silently dropped the page's inlinestyleattribute and rendered "Finishing sign-in..." as unstyled top-left serif text. Fixed by moving styling into a nonce'd<style>block and addingstyle-src 'nonce-...'to the CSP (no'unsafe-inline'). The shared stylesheet gives a centered card, a system font, a CSS-only spinner (disabled underprefers-reduced-motion), light/dark theming,lang=en, and an accessiblerole=status/aria-liveregion; the error state hides the spinner. The siblingfinishing_pageandconnect_errorreuse the same look.Testing
cargo test: 87 passing. No new build or clippy warnings. The registration-delegation shapes are verified against the beta II canister's live.did.Notes
main(the prior working branch's remote tip was a closed-PR commit).🤖 Generated with Claude Code
https://claude.ai/code/session_014T9N8USDfNK5yzznPGg7Ym
Generated by Claude Code