The settings screen stores the installation url nested under the service
name, while the embed matcher read a flat url, so a configured instance
never matched. The server-side embeddability check also had no knowledge
of team integrations and fell back to inspecting the instance headers.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Shared links return markdown when the client asks for it, but there was no
way to discover this short of guessing the .md suffix.
- Vary on Accept so shared caches key the two representations correctly
- Send a Link rel="alternate" header, discoverable with a HEAD request
- Emit a matching link tag alongside the canonical in the head
- Apply the same cache directives to markdown as the HTML response
* feat: Record who deleted a document
The trash inferred the deleting user from lastModifiedById, so a nested page
kept whoever last edited it and deleting a document rewrote its edit history.
Add a dedicated deletedById column and set it from the base model.
- Migration adds the column, backfills from lastModifiedById, and validates the
foreign key without holding an exclusive lock. The backfill runs in batches
against a temporary index covering only the rows still to write, so it stays
linear on a large table, and every statement is idempotent because the
migration cannot run in a transaction.
- ParanoidModel records the acting user on destroy and clears it on restore,
for any model that has the column. Sequelize soft deletes with the same UPDATE
that stamps deletedAt, so the value costs no extra query.
- Deleting a document no longer touches lastModifiedById on its descendants.
- Present the deleting user, batched in presentDocuments, and use it for the
trash notice and the document meta line rather than the last editor.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
* fix: Do not overwrite an eager loaded deleting user when batching
The batch lookup in presentDocuments skipped documents that already carried the
association, but the assignment loop ran for all of them, so a document that
arrived with deletedBy loaded was reset to null and fell back to a per-document
query. Assign only where the association is missing, and deduplicate the ids so
a page deleted by one person asks for one row rather than one per document.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
The client serializes all @Field properties on save, so documents created
before the preferences column existed post `preferences: null`, which the
update and create schemas rejected.
raw-body throws a 500 'stream is not readable' when the request stream is
already destroyed at parse time, which means the client went away. Map it to
ClientClosedRequestError so it reports 499 and is not sent to the bug tracker.
* feat: Filter DSL for users.list
Add the structured filter expression language already used by documents.list
and documents.search to users.list, over an allowlist of id, name, email,
role, createdAt, updatedAt, lastActiveAt and suspendedAt.
Supersedes the ad-hoc ids, emails, role and filter parameters, which are now
deprecated and translated into the DSL so a single path builds the query. The
same translation backs the list_users MCP tool, which held a duplicate copy of
the status handling.
Field specs gain an optional value allowlist, so an unknown role is rejected
at the input layer rather than reaching the enum column. Suspended users
remain invisible to non-admins and excluded by default, unless the expression
references suspendedAt.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
* refactor: Collapse the duplicate suspended user predicate
The non-admin invariant and the default exclusion pushed the same clause for
non-admins in the default case. Both rules are now one predicate: suspended
users are visible to admins only, and then only on request.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
* refactor: Drop the legacy parameters from the list_users MCP tool
The MCP surface has no backwards compatibility burden, so it takes the filter
DSL directly instead of the deprecated role and status parameters. This gives
the model date ranges, OR groups and name matching, which the old enum pair
could not express.
The field allowlist moves next to the other user filter helpers so the REST
schema and the tool share one definition rather than the tools directory
reaching into the routes.
Drops the unreachable Date member of FilterValue. Dates cross the wire as ISO
8601 strings, a Date instance fails every field kind, and zod cannot represent
it in the JSON Schema the MCP tool list is built from.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
* revert: Retain legacy role/filter params in the list_users MCP tool for now
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
* Revert MCP changes
---------
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
* Add heading numbering display preference for documents
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
* Fix isRemoteTransaction call for new signature on main
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
* Fix inTable detection for headings after a nested table
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
* Move from deco to pseudoclass
---------
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
* wip
* Center reorder cursors between sections, detect empty sections with CSS
* Deduplicate persisted sidebar section order
* fix: Stricter zod type
* Remove DraggableSection unit tests
* fix: Normalize path when keying rate limiters
The router matches paths case-insensitively and with an optional trailing
slash, so those variants each received their own quota. Collapse them onto
a single key at both registration and consumption.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
* feedback
---------
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
* fix: Rate limit response headers and first-request accounting
Retry-After and RateLimit-Reset are both defined as a whole number of
seconds. Retry-After was sent as a fraction and RateLimit-Reset as a full
date string, neither of which a client can act on.
A route limiter is registered by middleware that runs after the point where
quota is consumed, so the first request to reach a path in each process was
never charged against it. Charge it at registration time instead.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
* test: Cover rate limit headers and first request accounting
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
* perf: Cache JS chunks on first use instead of precaching entire build
The service worker precached every JS chunk (~590 files) in the
background for every visitor. Chunks are content-hashed and immutable,
so a CacheFirst runtime route provides the same repeat-visit behavior
while only fetching chunks that are actually used.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
* perf: Do not register service worker on public share views
Anonymous share visitors gain nothing from the worker or the PWA
cache, shares always require the API. The server now exposes an
isShare flag in window.env and the client skips registration when
it is set.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
---------
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
jsdom does not implement ResizeObserver, so a PDF attachment preview in a
publicly shared document threw from a React passive effect during HTML
rendering. Effect errors are not caught by the node view fallback, so the
uncaught exception took down the process.
Fixes OUTLINE-CLOUD-D14
The file name added to Content-Disposition was written into the header
unencoded whenever it fell inside Latin-1, so é, ü and ñ survived as raw
high bytes. Request signing hashes header values as UTF-8 while Node
writes them as Latin-1, giving the storage provider different bytes to
those that were signed, and the upload was rejected.
Pass an ASCII-only fallback so any such name is carried in the RFC 5987
filename* parameter instead. Browsers still read the original name from
there, so the extension is preserved.
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
Viewing the trash showed everything the whole workspace had deleted, which
is noisy for anyone looking for their own document. Default the view to the
items the current user deleted, and add user and date filters — matching the
shape of the search filters — to widen it again.
- Attribute a deleted subtree to the acting user. Deleting a document only
recorded the actor against the document itself, so nested pages kept
whoever last edited them and would have been hidden from their deleter.
- Move documents.deleted onto the filter DSL, exposing deletedById and
deletedAt. deletedById is mapped to the column that currently records the
deleting user, so adding a dedicated column later leaves the API unchanged.
- Lift the date filter duration map into shared, where search and the trash
both read it rather than keeping a copy each.
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
* fix: Stabilize signed attachment urls so caches can be reused
Every call to getSignedUrl produced a unique signature, so the same
attachment was downloaded again for each URL. On a public share the
first image was fetched twice at full size: once by the preload scanner
from the server-rendered HTML, and again when the client rendered the
document from the API response.
- Round the signing timestamp down to a window so repeated signatures of
the same key are identical. The window is capped at half the requested
lifetime, so a URL is always valid for at least half of expiresIn and
never outlives the lifetime it had before.
- Apply to all three signing paths: the S3 presigner, CloudFront, and
the JWT used by local storage.
- Sign the share page HTML with the same lifetime the API presenter
uses, so the two agree.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
* test: Freeze time in signed url tests
The suites read the wall clock, so two calls could straddle a signing
window boundary and fail intermittently. Freeze the clock at a time
offset from a boundary, then advance it explicitly to cover both cases:
within a window the signature holds, across a boundary it rotates.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
* Render React node views in server-side HTML export
Passes nodeViews to the headless EditorView used for export so that nodes
with a React component render with it, matching the editor, and falling
back to toDOM when a component cannot render server-side.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
* Let nodes opt out of component rendering in static HTML
Replaces the hardcoded set of node names in the server nodeViews factory with
an allowComponentInStaticHTML getter on Extension, so a node declares the
behavior alongside its own definition rather than in a server file that does
not know about it.
Mention opts out: its component requires stores and a router, so it always
threw and fell back to toDOM, at the cost of a React render, an exception and
a log line per node. A document with 100 mentions now exports in ~12ms rather
than ~25ms and emits no warnings.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
* Yield one less macrotask turn when flushing React effects
Only two turns are needed: the first flushes passive effects, the second fires
Frame's own setTimeout(0) whose setState commits the iframe. The third turn
absorbed nothing that the components produce.
Each turn is roughly a millisecond of idle time held inside the render lock, on
every export — including plain documents, share page SSR and notification
emails — so dropping it takes a small export from ~6ms to ~4ms.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
* fix: Serialize external mentions as links in exported markdown
GitHub issue, pull request and project mentions carry the real URL in
`href`, but always serialized to a mention:// reference that cannot be
resolved outside of Outline. Write a plain link instead when the
commonMark serializer option is set, and set that option on the paths
where markdown leaves the platform – document and revision export, zip
exports, and the public share markdown response.
* Sanitize external mention url before navigation
* 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>
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: 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>
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: 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>
* 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>
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.
* fix: Warn before discarding unsaved template changes
Template content is only persisted when the form is explicitly submitted,
so navigating away or closing the tab silently lost everything typed.
Adds a navigation Prompt and a beforeunload handler to both template
scenes, and reverts the model on unmount so abandoned edits no longer
leak into other views rendering the same record.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
* fix: Persist templates from the first keystroke
New templates were held only in browser memory until Save was pressed, so
a refresh, crash, or stray navigation lost everything written.
Templates are now created up front as an unpublished draft and autosaved,
mirroring how documents behave. Drafts are visible only to their author
until published, and are cleaned up if abandoned while empty.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
* fix: Preserve icon edits made during an in-flight template save
applyEdits only restored title and content, so an icon or color changed
while a save was in flight was overwritten by the response and never
re-saved.
Pending edits are now tracked as a single record covering every field the
form can change, rather than one ref per field.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
* feedback
---------
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
Template content is nullable, but the presenter passed it through raw so
a template without content reached the client with no data at all.
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
* fix: Build canonical redirect url from team, not request host
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
* test: Cover canonical host redirects
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>