Skip to content

Increase maximum number of alternative origins to 100 - #4261

Merged
aterga merged 2 commits into
mainfrom
claude/increase-alternative-origins-limit-3e6kxx
Aug 20, 2026
Merged

aterga merged 2 commits into
mainfrom
claude/increase-alternative-origins-limit-3e6kxx

Conversation

@aterga

@aterga aterga commented Aug 20, 2026 •

Copy link
Copy Markdown
Collaborator

Motivation

The /.well-known/ii-alternative-origins file was capped at 10 entries, which is
restrictive for services that legitimately run many frontends under a single
derivation origin. This raises the cap to 100.

Changes

  • src/frontend/src/lib/utils/validateDerivationOrigin.ts: MAX_ALTERNATIVE_ORIGINS
    raised from 10 to 100. The user-facing error message interpolates the constant,
    so it now reports the new limit automatically.
  • docs/ii-spec.mdx: updated the three places stating the limit — the requirements
    list, the JSON schema's maxItems, and the "to prevent misuse" note.
  • src/frontend/tests/e2e-playwright/routes/authorize/alternativeOrigins.spec.ts:
    the "too many entries" test now lists 101 origins. The requesting origin is one
    of them, so the entry limit is the only thing that can reject the sign-in —
    previously the fixture listed only unrelated origins, meaning the test failed at
    the "origin not allowed" check and would have kept passing with the limit removed.
  • src/frontend/src/lib/utils/validateDerivationOrigin.test.ts: new unit cases for
    both sides of the boundary — exactly 100 entries validates, 101 is rejected with
    the "has too many entries" message. The expected maximum is spelled out in the
    test rather than imported from the implementation, so lowering the limit fails
    the test instead of silently following along.

No backend/Rust change was needed — the limit is enforced only in the frontend
validation of the fetched ii-alternative-origins document.

Tests

  • validateDerivationOrigin.test.ts: 25/25 pass, including the two new boundary cases.
  • Mutation-checked the boundary coverage: temporarily setting the constant back to
    10 fails the 100-entry case; restoring 100 makes the file green again.
  • prettier --check, eslint --max-warnings 0, and
    tsc --project tsconfig.all.json --noEmit are clean on the changed files.
  • The Playwright e2e suite was not run locally (it needs a replica and the built
    canisters); CI covers it.
  • Unrelated pre-existing local failures in findWebAuthnFlows, iiConnection, and
    appMetadata reproduce identically without these changes — they are environment
    gaps in the sandbox, not regressions.

Raise the limit on entries in `/.well-known/ii-alternative-origins` from
10 to 100 in the frontend validation, update the specification (including
the JSON schema `maxItems`), and adjust the e2e test to list 101 origins
so it still exceeds the limit.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Xb4gLgdkcBhNJdByGQhiLc
@aterga
aterga requested a balanced review from Copilot August 20, 2026 14:23
@aterga
aterga marked this pull request as ready for review August 20, 2026 14:24
@aterga
aterga requested a review from a team as a code owner August 20, 2026 14:24
@zeropath-ai

zeropath-ai Bot commented Aug 20, 2026 •

Copy link
Copy Markdown

✅ No security or compliance issues detected. Reviewed everything up to ceead54.

Security Overview
Detected Code Changes
Change Type Relevant files
Bug Fix ► docs/ii-spec.mdx
    Increase max alternative origins from 10 to 100 in documentation notes and schema
    Update note to reflect new limit (100)
Enhancement ► src/frontend/src/lib/utils/validateDerivationOrigin.ts
    Raise MAX_ALTERNATIVE_ORIGINS from 10 to 100
Enhancement ► src/frontend/src/lib/utils/validateDerivationOrigin.test.ts
    Add tests for boundary where alternative origins length equals 100 and 101
Enhancement ► src/frontend/tests/e2e-playwright/routes/authorize/alternativeOrigins.spec.ts
    Update test setup to reflect new 100-entry limit (101 entries) for alternative origins

Copilot AI 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.

Pull request overview

Raises the alternative-origin limit from 10 to 100 across validation, documentation, and e2e coverage.

Changes:

  • Increases the frontend validation limit to 100.
  • Updates the specification accordingly.
  • Adjusts the excessive-entry test fixture to 101 origins.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
validateDerivationOrigin.ts Raises the enforced limit.
ii-spec.mdx Documents the new limit.
alternativeOrigins.spec.ts Updates the rejection test to 101 entries.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

The e2e rejection fixture never listed the requesting origin, so the
sign-in it asserts on failed at the "origin not allowed" check and would
have kept passing with the entry limit removed. List the requesting
origin among the 101 entries so only the limit can reject it.

Add unit cases for both sides of the boundary: exactly 100 entries are
accepted and 101 are rejected with the "too many entries" message. The
expected maximum is spelled out in the test rather than imported so that
lowering the limit in the implementation fails the test instead of
silently following along.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Xb4gLgdkcBhNJdByGQhiLc
@aterga
aterga requested a review from sea-snake August 20, 2026 14:42
@aterga
aterga enabled auto-merge (squash) August 20, 2026 14:44
@aterga
aterga merged commit fbdb75f into main Aug 20, 2026
44 checks passed
@aterga
aterga deleted the claude/increase-alternative-origins-limit-3e6kxx branch August 20, 2026 14:56
marc0olo pushed a commit to dfinity/developer-docs that referenced this pull request Aug 24, 2026
## Summary

- Internet Identity raised the cap on entries in
`/.well-known/ii-alternative-origins` from 10 to 100
(dfinity/internet-identity#4261, merged). This updates the docs to
match.
- `docs/guides/authentication/internet-identity.mdx`: the alternative
origins step said "A maximum of 10 alternative origins can be listed";
now 100.
- Supersedes dfinity/portal#6248, which made the equivalent change
before that repo was retired.

## Scope

The limit also appears three times in
`docs/references/internet-identity-spec.md` (requirements list, the JSON
schema `maxItems`, and the "prevent misuse" note). That file is
generated by `scripts/sync-ii-spec.mjs` from the pinned
`.sources/internetidentity` submodule and carries a "do not edit
directly" marker, so it is deliberately untouched here. The upstream
`docs/ii-spec.mdx` already has the new value, so the page picks it up
when that submodule is bumped and the sync is rerun. Happy to do that in
a separate PR if you would like it in the same release.

No other page needed changing: the remaining "at most 10" hits in
`docs/references/execution-errors.md` and
`docs/references/ic-interface-spec/management-canister.md` are about
canister controllers.

## Verification

- `npm run build` passes (210 pages).
- Grepped `docs/` for the limit in every phrasing; only the generated
spec page still says 10, for the reason above.

Co-authored-by: Claude <[email protected]>
raymondk pushed a commit to dfinity/icskills that referenced this pull request Sep 2, 2026
The skill stated a maximum of 10 alternative origins. Internet
Identity's cap is 100.

## Verification

Checked against the II source rather than the reported number alone:

- `MAX_ALTERNATIVE_ORIGINS = 100` in
`src/frontend/src/lib/utils/validateDerivationOrigin.ts`
- `docs/ii-spec.mdx` agrees — "No more than 100…", JSON schema
`"maxItems": 100`
- Raised from 10 in
[dfinity/internet-identity#4261](dfinity/internet-identity#4261),
shipped in `release-2026-08-21`
- Past the cap, the length check returns `{result: "invalid"}` for the
whole document *before* the membership test — so all alternative origins
fail, not just the extras

One claim was drafted and dropped: "entries must be unique." The spec's
JSON schema carries `uniqueItems: true`, but
`validateDerivationOrigin.ts` never enforces it — it only runs
`includes()` on the normalized array. Stating it as a rule would be
guidance the runtime does not back.

Nothing to file upstream — the II docs already say 100.

## Changes

- `skills/internet-identity/SKILL.md` — 10 → 100, plus the "rejects the
entire list" consequence.
- `evaluations/internet-identity.json` — new adversarial case 19
covering the cap and the over-cap behavior.

The skill records the current cap and what happens past it, and no
version history. A developer cannot be running an II release older than
mainnet's, so the previous cap describes a state nobody can reach. The
provenance above is here for review, not in the skill.

## Evals

Case 19 is new, so it is run with baseline. The other 18 cases were not
re-run — none of them assert the origin count.

<details>
<summary>Eval 19 — WITH skill 3/3 · WITHOUT skill 2/3</summary>

```
WITH skill: 3/3 passed
  ✅ States the maximum is 100 alternative origins
  ✅ Says exceeding the cap invalidates the ENTIRE list — every alternative origin
     stops authenticating, not just the entries past the limit
  ✅ Does NOT describe the over-cap behavior as truncation, ignoring the extras,
     or only the excess entries failing

WITHOUT skill: 2/3 passed
  ❌ States the maximum is 100 alternative origins
     → The output states the maximum is 10 entries, not 100.
  ✅ Says exceeding the cap invalidates the ENTIRE list — …
  ✅ Does NOT describe the over-cap behavior as truncation — …
```
</details>

Read that delta honestly: **the number is the only thing that
discriminates.** Baseline already knows that exceeding the cap
invalidates the whole list — it just applies that correct behavior to
the wrong limit. The over-cap sentence stays in the skill because it is
accurate and cheap, not because it was measured as differentiating.

An earlier version of this case reported 0/3 → 3/3, which flattered the
change. It counted one fact three times: "confirms ~40 domains fit" was
derived from the prompt's own "about 40" rather than from the skill, and
both it and "does NOT claim 10" are entailed by stating the cap is 100.
Rewritten to probe two distinct facts, and the weaker number above is
the real one.

`npm run validate` passes — 30 skills, warnings only.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants