docs: describe the magic link redirect allowlist that already ships - #298
Merged
Conversation
docs/api-contract.md said a destination that cannot be expressed as a WebAuthn origin "needs a magic_link_redirect_uris system config key" living in @seamless-auth/types, and that adding it would take a coordinated release. The key landed with types 0.19.0 in #268: it has a default, an env mapping, a parse case, and resolveMagicLinkUrl passes it to allowedRedirect, with tests covering a custom scheme, exact match and the empty-list fallback. The section now describes what the key does, including that a non-empty list becomes the whole allowlist rather than widening the origin comparison, and the system_config table in docs/configuration.md gains the row it was missing. It was the only env-mapped key absent from that table. Closes #242
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.
Closes #242.
The issue is already implemented
#242 asks for a
magic_link_redirect_urissystem config key, and describes it as blocked on cross-repo work: adding it toSystemConfigSchemain@seamless-auth/types, a version bump, and a coordinated release.That happened. The key came in with
@seamless-auth/types0.19.0, adopted here in #268, and everything the issue's scope list asks for is in place:SystemConfigSchemadeclaresmagic_link_redirect_uris: z.array(RedirectTargetSchema).default([]), and the patch schema accepts itSYSTEM_CONFIG_DEFAULTSsets[],SYSTEM_CONFIG_ENV_MAPmapsMAGIC_LINK_REDIRECT_URIS, andparseSystemConfigEnvValuehandles it as a string arrayresolveMagicLinkUrlpasses it toallowedRedirect, so a non-empty list is matched exactly and an empty one falls back to comparing againstoriginstests/unit/services/magicLinkRedirect.spec.tscovers the custom scheme, the exact match refusing an unlisted target on a configured origin, and the empty-list fallbackSo there is no code to write. What is left is the last line of the issue: the documentation still describes it as a missing prerequisite.
What changed
docs/api-contract.md, under Magic link destination, said the key "needs a version bump and a coordinated release across this API and both SDKs". It now describes what the key does, why the match is exact (a custom scheme has no origin to compare, so only an operator-listed literal is safe), and the part that is easy to get wrong: once the list is non-empty it is the whole allowlist, so a destination on a configured origin that is not listed is refused. That is the point, since the alternative is wideningorigins, which gates passkey ceremonies.docs/configuration.mdgains thesystem_configtable row it was missing. Checked againstsystemConfig.envMap.ts, it was the only env-mapped key absent from that table.Checks
Documentation only, no source changed.
npm run format:check: cleantests/unit/services/magicLinkRedirect.spec.tsandtests/unit/config/systemConfigEnvMap.spec.ts: 17 passed, confirming the behavior the docs now describe