* feat: Re-authorize collaboration connections when access changes
Collaboration connections are authorized once, when the websocket is first
established, so a connection outlives changes to the access it was granted.
Add a processor that publishes access changes to the collaboration servers
over Redis. Each server closes the connections it holds within the scope of
the change and clients reconnect, at which point they are authorized as
normal. Authorization stays in one place, the published scope only has to
cover the connections that may be affected.
The API update subscriber now shares a single Redis connection rather than
opening its own.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
* refactor: Log an access change once rather than per connection
Every closed connection is already logged by LoggerExtension, so record the
reason and the number of connections affected once instead. The count also
makes a scope that matches nothing visible.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
* fix: Headings at the end of a document never highlight in the contents
The highlight was derived only from the scroll position, so a heading in the
final viewport — which can never reach the top of the screen — stayed unhighlighted
even when clicked directly in the contents.
Keep the clicked heading highlighted until the reader scrolls again.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
* Release the selected heading on window scroll only
Listening for wheel, touch and key events dropped the highlight when the reader
typed without scrolling or scrolled the contents panel, and missed scrollbar
drags entirely.
The document has already been scrolled to the heading by the time the effect
runs, so anchor to that position and release once the window moves away from it.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
Every remote change is applied as a full document replacement, which
invalidates the column resize handle while the drag is still active.
Releasing the pointer then resolved position -1 and threw.
Cancel the drag when the handle no longer points at a cell.
Fixes OUTLINE-CLOUD-B3R
The caption is editable DOM outside of the document, so ProseMirror handled
the drag against the document selection instead — moving unrelated content and
throwing a mismatched transaction as the caption commit landed mid-dispatch.
Fixes OUTLINE-CLOUD-AB8
Removing the first node from the pasted slice kept the original open
depths, which are no longer valid for the remaining content. When the
clipboard held a single top-level node the content became empty while
openEnd stayed above zero, and ProseMirror walked into a null child.
Fixes OUTLINE-CLOUD-51V
The parentDocumentId clear in documentPermanentDeleter inherited the Document
default scope, so draft, template, and trial children were never detached and
the foreign key cascade removed them along with the parent.
* fix: Shared pages fail to load on older browsers
Object.hasOwn is unavailable before Chrome 93 and Safari 15.4, and
es-toolkit calls it directly from isEqualWith, which useActionContext
runs on every render. Add a polyfill applied at module scope, ahead of
the other imports, so it covers dependency evaluation and first render.
Fixes OUTLINE-CLOUD-D0W
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
* Define the polyfill as non-enumerable to match the native property
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
Regex lookbehind is unsupported before Safari 16.4, and the table rule
built one at module scope, so the throw took out the whole editor.
Replace it with a manual scan of the preceding character.
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
* Separate logged-in elements on shared page
* fix: Set explicit type on shared header account menu trigger
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
* fix: Shift-click table grips to select a range of rows or columns
Shift or cmd clicking a second row or column grip now extends the
selection to cover every row or column in between.
Track the anchor and head index on RowSelection and ColumnSelection so
every grip in the range highlights, and a cell that spans rows or
columns no longer pulls its neighbours into the selection.
The inline selection menu collapsed the selection on pointerdown, before
the grip handler could read it, so there was nothing left to extend.
Leave the selection alone when the interaction is on a grip.
Hide the insert and move items in the row and column menus when the
selection covers more than one row or column, as they act on a single
row or column.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
* fix: Take the selected row and column range from the selection
selectedRect grows past the selected rows or columns when a cell spans
them, so read the range from the selection where it is known. Keeps the
menus and the commands that act on a selection in step with the range
the grips highlight.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
* feat: Sticky first column in tables with a header column
When a table is wider than the available space, the first column now stays
in place while the table is scrolled horizontally, matching the existing
behaviour of the header row. Only applies when every cell in that column is
a header cell.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
* perf: Cache header column lookup per node
updateClassList runs on every horizontal scroll event, so the first column
check is kept until the table node itself changes.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
* fix: Pasting a table from Google Sheets does not create a table
Spreadsheet cells containing currency amounts caused isMarkdown to
misread the tab-separated plain text flavour of the clipboard as inline
LaTeX, so the paste handler discarded the HTML table and reparsed the
text as Markdown.
Tighten the LaTeX heuristic to require delimiters that hug their content
and a closing delimiter not followed by a digit, and always prefer the
HTML parser when the clipboard HTML contains a table.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
* Remove lookbehind in regex
---------
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
Avatars in a Facepile are clipped on their right edge, so initials
centered on the full box drift into the part that is cut away. Move
them left by half of the removed area, and restore centering on hover
where the clip is lifted.
* fix: Match the base domain on a label boundary
Domain parsing looked for the base domain anywhere in the host, so a host
that merely contained it was classified as a subdomain of the install
rather than as a custom domain. Compare against the end of the host
instead, and reuse the same helper for the custom domain CNAME check.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
* fix: Normalize host case and trailing root label
Hostnames are case-insensitive and may be given in fully qualified form
with a trailing dot, so normalize both before comparing against the base
domain. Without this a host such as MyTeam.Example.Com is classified as a
custom domain and a valid CNAME target is rejected.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
* feat: Normalized filter DSL for documents.list and search
Add a structured filter expression language (field/operator/value leaves
composed with AND/OR groups) shared by documents.list, documents.search and
documents.searchTitles. Values are validated against each field's column type
and per-field operator allowlists at the input layer, and translated to
Sequelize where-clauses server-side.
Supersedes the ad-hoc statusFilter/dateFilter/collectionId/userId parameters,
adds ISO 8601 duration matching for date fields, documentId subtree expansion
for search, and preserves draft visibility and collection authorization.
* chore: Fix flaky Encrypted "different key" test
AES-256-CBC is unauthenticated, so decrypting with the wrong key only
raises "bad decrypt" when the garbage plaintext has invalid PKCS#7 padding
(~255/256 of the time). Roughly 1 in 245 runs it decrypts to a non-matching
value instead of throwing, failing the strict toThrow assertion. Accept
either outcome, mirroring the adjacent tampered-data test.
* Hardening
The APIUpdateExtension subscriber connects to REDIS_COLLABORATION_URL when
set, but notifyUpdate always published on the default client, which is bound
to REDIS_URL. With a separate collaboration instance the notification never
reached the collaboration processes, so connected editors did not see API
edits until reload.
Publish on RedisAdapter.collaborationClient, which falls back to the default
client when no collaboration URL is configured.
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
The wrong-key test asserted a throw, but AES-256-CBC is unauthenticated so
decryption only fails when the resulting plaintext has invalid padding —
around 0.4% of runs returned garbage instead. Accept either outcome, matching
the pattern already used by the sibling tamper test.
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
* feat: Highlight trigger text while suggestion menu is open
Adds an inline decoration around the trigger character and search term
while the block, emoji, or mention menu is open.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
* fix: Multiplayer edits
---------
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
Suggested users that share a group with the mentioning user are ranked
above the rest, both in the query so they fit inside the limit, and in
the menu itself.
The server returns a familiarity score per model id, which the client
applies as a multiplier on the relevance score of a suggestion. This
leaves room for other signals, and for other model types, without a
change to the response shape.
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
* fix: Heading anchor widget breaking IME composition
The heading anchor was passed to Decoration.widget as an already-mounted
element. Prosemirror can only reuse a widget when the decoration is the same
object or the previous toDOM has no parent, so neither held once the button was
in the document. Every doc change therefore rebuilt the widget desc and set
updater.changed, forcing a rewrite of the heading contents on each keystroke.
Rewriting the DOM around an active composition drops text an IME is still
composing, which paragraphs never hit as they have no widget.
The decoration key was also derived from the node position, so reuse broke
whenever content before a heading changed length, including remote edits from
another collaborator.
Pass a factory and use a position independent key. Keys are only compared
against the desc at the same index in the same parent nodeview, so a constant
key is scoped per heading, matching the "space" widget alongside it.
* Remove excessive tests
* fix: Align CSRF cookie resolution between attach and verify paths
The middleware that attaches the token picked one cookie name based on
whether the request was secure, while the verifier accepted either name.
Resolve the name through a single helper so both paths always agree, and
warn at startup when proxy headers are untrusted on an https install.
* Remove excessive tests
* fix: Describe the request scheme on the MCP-derived API context
Helpers shared between the MCP tools and the HTTP routes read the scheme
from the context, which the MCP stub did not provide.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
* fix: Do not warn about proxy headers when the app terminates TLS itself
The socket is already encrypted in that case, so the request scheme is
known without X-Forwarded-Proto. Extract the certificate check that main
was doing inline so both call sites stay in step.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
* simplify
---------
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
* fix: Skip revision diff when too expensive to compute
Recreating steps from a JSON patch copies and validates the full document
once per operation, so a structure collapse on a very large document could
block the worker event loop for minutes. Skip the changeset when the
product of operation count and document size exceeds a bound, and send
notification emails without the inline preview in that case.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
* perf: Apply complexity guard to every patch computation
Centralize patch creation and the maxComplexity check in recalculateOps
so the recomputed patch in addSetNodeMarkup is bounded as well.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
- Serialize code fences longer than any backtick run in the content, so
content lines cannot terminate the fence early on reparse
- Reduce the fence info string and language attribute to a single safe
token when parsing and serializing
- Share the markdown parser and serializer through the editor test helper
* fix: Consume OAuth authorization codes and refresh tokens atomically
The exchange of an authorization code, and the rotation of a refresh
token, read the credential and deleted it in two steps. Concurrent
requests with the same credential could both pass the read and each
receive a token.
Claim the credential with a single conditional statement instead, so
that only one of a set of concurrent requests continues to token
issuance.
* fix: Move OAuthAuthentications delete to predicate-scoped destroy.
The unfurl response for a share link included the name of the document's
last editor and a relative timestamp. That information is intentionally
withheld from the share document presenter, so drop it here too.
Include the file name in the Content-Disposition header set on S3 objects
at upload time, so browsers keep the uploaded extension instead of
deriving one from the content type.
* fix: Apply MCP preference to dynamically registered OAuth clients
Dynamically registered clients exist only to serve MCP, but the preference
was only consulted at registration time. They are now unreadable once the
preference is off, and their outstanding grants are revoked at the point it
changes.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
* fix: Keep default retry options on revocation task
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
* refactor: Rename MCPDisabledProcessor to TeamUpdatedProcessor
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
The home branch of pins.list returned every team pin regardless of whether
the linked document was visible to the requesting user, while the document
query was membership-scoped. Filter the pin list to match.
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
The view activity included in a mention preview was not subject to the
document's insights setting, nor to the ability check that guards the same
data on the other endpoints that expose it. Both are now applied, and the
preview falls back to online status alone when they do not pass.
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
* fix: Unhandled socket error during websocket upgrade crashes server
Node removes its own socket error handling before emitting the "upgrade"
event, so any socket detached from the HTTP server without a listener of
its own will terminate the process when the client goes away.
Handle errors for every upgraded socket in one place, and destroy sockets
we reject rather than leaving them half-open to be reset at any point in
the future.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
* fix: Flush rejection response before destroying the socket
Destroying immediately after the write can truncate the response if the
socket's write buffer has not drained, leaving the client with a reset in
place of the rejection.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
* noisy comment
---------
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
Session tokens were accepted from the request body and query string, unlike
the other credential types parsed by the same middleware. They are now only
read from the cookie or the Authorization header.
Short-lived single-use transfer tokens are unaffected, so the subdomain and
desktop sign-in hand-offs continue to work.
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
* fix: Tighten credential handling in OAuth client and batch endpoints
- Include an OAuth client secret in responses only when the presented
credential is itself scoped to manage clients, rather than deciding from
the user's abilities alone.
- Require an interactive session at the authorization endpoint, matching the
batch endpoint, so consent cannot be answered programmatically.
- Resolve a batched sub-request's scope against the dispatched method rather
than the parent path, and always run sub-requests as the parent's
credential.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
* fix: Address review feedback on naming and documentation
- Name the batch test for what it asserts, as API keys do support per-method
scopes and the rejection comes from the session pin on the route.
- Add the missing @returns tag and terminal punctuation to the presenter's
JSDoc, matching the sibling presenter in the same file.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
* fix: Apply all content transforms in DocumentHelper.toJSON
replaceInternalUrls was declared async although it does no async work, so the
promise it returned was passed into removeMarks, which returned it untouched
rather than walking it. Made the method synchronous, and typed the local in
toJSON so the compiler reports a promise flowing through the transform chain.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
* chore: JSDoc punctuation and explicit return type on replaceInternalUrls
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
Allows API clients to detect concurrent edits by rejecting the update
with a 409 when the document revision no longer matches. Collaborative
persists now also increment revisionCount so the check is reliable.
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
* feat: Add [[ trigger for mentioning or creating a document
Opens a suggestions menu filtered to documents, backed by a title search,
with options to create a new or nested document from the search term.
Generalizes the suggestion machinery to support multi-character triggers,
and extracts the mention menu item builders into app/editor/menus/mention.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
* fix: Trim the mention search term
Spaces are allowed in the search term, so a whitespace-only query rendered
create-document items with an empty title and issued a title search that the
server rejects.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
* fix: Close suggestion menus on a space directly after the trigger
Spaces remain allowed within a search term, they are only rejected as its
first character.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
* fix: Return models from fetchNamedPage
The raw API payload was returned rather than the models added to the store,
so callers that render the result are missing computed properties.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
* refactor: Render the document menu from the store
Matches the mention menu and paginated lists, where the request populates the
store and the list is rendered from observables.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
* feat: Order people above documents in the mention menu
Uses a mention specific section so the command bar, where the section holds
user management actions, is unaffected.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
* fix: Hide create document options without a create handler
Editors that do not pass onCreateLink, such as comments, inserted a mention
pointing at a document that was never created.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
Listing revisions loads the document with paranoid disabled so that history
remains available for a document in the trash, but the accompanying policy
check does not consider deletedAt. Apply the same gate documentLoader uses,
so trashed history follows the same access rules as the document itself.
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
Proxies commonly forward a Host header without the port the installation is
publicly reachable on, so redirects derived from the incoming request pointed at
the wrong address – most visibly breaking the email magic sign-in link.
Resource timing spans made up ~84% of all spans sent, driven by the number
of code-split chunks loaded per pageload. Filter them out along with pageload
connection phases and performance mark/measure entries, and halve the traces
sample rate.