Conversation
Two bugs allow IMS OAuth redirect fragments to pass through as an org
name in admin API calls (e.g. /config/ccess_token=.../ or /config/ld_hash=/).
1. prose/index.js: hash.slice(2) strips '#a' instead of '#/' when the
hash is '#access_token=...', writing 'ccess_token=...' into the URL.
Guard with startsWith('#/') before slicing.
2. pathDetails.js: the IMS fragment guard was dead code — fullpath always
starts with '/' so startsWith('old_hash') could never match. Also,
'ld_hash' (used by the IMS PKCE flow) was not covered at all.
Strip the leading '/' before the prefix checks and add 'ld_hash'.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
Hello, I'm the AEM Code Sync Bot and I will run some actions to deploy your branch.
Commits
|
chrischrischris
approved these changes
Apr 30, 2026
chrischrischris
pushed a commit
that referenced
this pull request
May 1, 2026
Two bugs allow IMS OAuth redirect fragments to pass through as an org
name in admin API calls (e.g. /config/ccess_token=.../ or /config/ld_hash=/).
1. prose/index.js: hash.slice(2) strips '#a' instead of '#/' when the
hash is '#access_token=...', writing 'ccess_token=...' into the URL.
Guard with startsWith('#/') before slicing.
2. pathDetails.js: the IMS fragment guard was dead code — fullpath always
starts with '/' so startsWith('old_hash') could never match. Also,
'ld_hash' (used by the IMS PKCE flow) was not covered at all.
Strip the leading '/' before the prefix checks and add 'ld_hash'.
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
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.
Problem
Two bugs allow IMS OAuth redirect fragments to leak into admin API calls as an org name, producing requests like
GET /config/ccess_token=<jwt>&state=.../andGET /config/ld_hash=/. These caused 500 errors in da-admin (KV 414 key-too-long) and high-volume spurious 404s. See the worker-side fix in adobe/da-admin#270.Bug 1 —
blocks/edit/prose/index.js:263: unsafehash.slice(2)When a collab WebSocket connection closes and the document returns 404, the code navigates to the parent folder:
.slice(2)is meant to strip the#/prefix. But when IMS has set the hash to#access_token=<jwt>&state=...(redirect still in progress), there is no/after#..slice(2)removes#ainstead, producingccess_token=<jwt>&state=.... The code then navigates to/#/ccess_token=<jwt>&state=..., writing the mangled token into the URL as a path segment.getPathDetails()picks up/ccess_token=...as the hash path and extractsccess_token=<jwt>...as the org name. The resulting config API call sends a ~1986-byte key to Cloudflare KV (512-byte limit) → 500.Fix: guard on
hash.startsWith('#/')before slicing.Bug 2 —
blocks/shared/pathDetails.js:127: guard is dead code +ld_hashmissingfullpathis derived fromhashPath, which is found byparts.find(part => part.startsWith('/'))— so it always starts with/. The prefix checks against'old_hash'and'access_token'(no leading/) can therefore never match. The guard is dead code.Additionally,
ld_hash— the IMS PKCE redirect marker — is not covered at all. When IMS sets the hash to#/ld_hash=,hashPath = '/ld_hash='passes thestartsWith('/')check, the dead guard ignores it, andorg = 'ld_hash='flows into the config API call → high-volume 404s (/config/ld_hash=/, ~500 requests/12h in production).Fix: strip the leading
/before the prefix checks, and addld_hash.Changes
blocks/edit/prose/index.jsstartsWith('#/')guard beforehash.slice(2)inconnection-closehandlerblocks/shared/pathDetails.js/before prefix check), addld_hashRelated
Worker-side defensive fix: adobe/da-admin#270 (catches any remaining cases where an oversized key reaches the KV call, returning 403 instead of 500).
🤖 Generated with Claude Code