Repository navigation
Conversation
…eed recent authentication Backup codes, sessions, grants, and trusted devices are the reads that need recent authentication, and they only checked for a valid verification record. An application that is not first-party could therefore read them while holding one. Each route now asserts a first-party client next to the identity check: a caller without proof keeps the existing 401, and a third-party caller with proof gets 403 instead of the data. A third-party application cannot mint the record itself, since the Verification API refuses it; this closes the path where a record minted by another client is presented. The guard status lists accept the new status, and the unit test, the integration coverage, and the OpenAPI supplements describe it. Amp-Thread-ID: https://ampcode.com/threads/T-01a14383-fded-744a-b90a-56f48926c865
This branch has not been deployed
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.
Summary
The Account API reads that need recent authentication —
GET /my-account/mfa-verifications/backup-codes,GET /my-account/sessions,GET /my-account/grants, andGET /my-account/trusted-devices— only assertedidentityVerified, so any caller holding a valid verification record could read them. Every account mutation has required a first-party application since #9430; these four reads did not, which is the one path left where a third-party application could reach account data.Each route now asserts a first-party client right after the identity check, the same placement the mutation routes use:
401 verification_record.permission_denied.403 auth.third_party_application_forbiddeninstead of the data.A third-party application cannot mint the record itself, since the Verification API refuses a third-party caller (also from #9430); the record is owned by the user, so this closes the path where a record minted by another client is presented.
The
koaGuardstatus lists accept the new status — without that, any status outside the list becomes a500outside production — and the OpenAPI supplements document the new403.Part of LOG-14124.
Testing
Unit tests, integration tests.
@logto/core:trusted-device.test.tsgains the third-partyGETcase, which also holds the route's status list to the new status.third-party-guard.test.tsgains the case that fails without the fix: a third-party caller presenting a valid verification record gets403from all four reads. The record is minted through a first-party client, and left to CI along with the rest of the suite.Checklist
.changeset