8000 fix(iiif): give access tokens only to viewers the person confirmed by adeelahmad · Pull Request #160 · adeelahmad/lense · GitHub
[go: up one dir, main page]

Skip to content

fix(iiif): give access tokens only to viewers the person confirmed - #160

Merged
adeelahmad merged 3 commits into
mainfrom
claude/project-thread-qt650x-iiif-origins
Oct 5, 2026
Merged

adeelahmad merged 3 commits into
mainfrom
claude/project-thread-qt650x-iiif-origins

Conversation

@adeelahmad
Copy link
Copy Markdown
Owner

Requested by Adeel · project thread

Description

Before: iiif.allowed_origins defaults to * and the IIIF access cookie is SameSite=None. Once someone signed in on the IIIF access page for one viewer, any website they visited could load /iiif/auth/token in a hidden iframe and receive an access token for their account. With that token it could probe and play every restricted recording the person could open.

After: the access cookie remembers which viewer sites the person signed in for, or confirmed with Continue on the access page (the page already names the site that is asking). The token service gives tokens only to those sites. Any other site gets the spec's missingAspect error, so a compliant viewer opens the access page and the person decides. The allowed_origins setting and its default are unchanged.

Motivation and Context

This came from the threat model's surface pass. Users will see one difference: a second viewer site now needs one Continue click before it can play restricted recordings. IIIF cookies issued before this change carry no confirmed sites, so the first token request after upgrading asks for Continue once.

Steps to reproduce (if appropriate):

test_tokens_go_only_to_viewers_the_person_signed_in_for signs in for https://viewer.example and then asks for a token as https://evil.example. On main, the second site got a token. With this change it gets missingAspect until Continue is pressed. One line of the existing flow test now passes the viewer's origin when signing in, as IIIF viewers do.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change; ! in the title)

Checklist:

  • The title is a Conventional Commit.
  • My code follows the code style of this project (make hooks checks it on commit).
  • I added or updated tests.
  • My change requires documentation updates, and I have updated docs/ accordingly.
  • Users need more than the title to understand it, so I wrote it under ## Unreleased in CHANGELOG.md.

🤖 Generated with Claude Code

https://claude.ai/code/session_01W42z4FbekWr33b6791svQQ


Generated by Claude Code

With iiif.allowed_origins at its default (*), any site could load the
token service in a hidden iframe and get an access token for whoever was
signed in to the IIIF access page. The access cookie now remembers the
viewers the person signed in for or confirmed with Continue, and the
token service answers only those.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01W42z4FbekWr33b6791svQQ
@adeelahmad adeelahmad self-assigned this Oct 5, 2026
Copy link
Copy Markdown
Owner Author

Local CI: green. The self-hosted runner is down, so I replayed every PR job from .github/workflows (ci.yml, pre-commit.yml, pr-title.yml) with ci/local-ci.sh --pr 160 (#181). It tests the head merged into the latest main, which is what GitHub's pull_request event tests.

Local CI on PR #160 head 5ab1751 merged into main f69d6af, 2026-10-05 07:27 UTC

Job Result Time
FastAPI (embedded SurrealDB) pass 382s
FastAPI (SurrealDB server) pass 219s
Next.js pass 186s
pre-commit pass 72s
PR title pass 0s

Generated by Claude Code

@adeelahmad
adeelahmad merged commit afe6139 into main Oct 5, 2026
7 checks passed
@adeelahmad
adeelahmad deleted the claude/project-thread-qt650x-iiif-origins branch October 5, 2026 12:51
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.

2 participants

0