95 Commits
Author SHA1 Message Date
Tom Moor 620ef924a1 Improve log data sanitization (#14671)
* Improve log data sanitization

Extract the log sanitizer into its own module, match field names regardless of case and separators, extend the filtered fields, sanitize Sentry extras as a whole, keep serializable values such as dates, and apply the depth limit only to nested objects.

* Call toJSON once when sanitizing log data
2026-11-19 17:59:44 -05:00
Tom Moor fbb78cd2b0 chore: Tighten error reporting payloads (#14568) 2026-11-12 18:45:47 -05:00
Tom Moor 6d7cd455e9 chore: Decouple core plugins (#14340)
* chore: Move plugin-specific integration code into plugins

Core no longer imports from or names the settings of individual plugins.
Plugins now register mention providers, issue status icons, instance URLs,
settings keys, settings and import schemas, and OAuth clients through hooks.

* fix: Recompute embed instance URLs after plugins load and match legacy issue icons by URL

* fix: Skip logo upload jobs queued without a settings path

* chore: Choose issue status icons from the unfurl state
2026-11-02 19:42:48 -05:00
Tom Moor 6a2f23c023 perf: Keep dotenvx, Sentry and zod compilation off the primary process (#14369)
dotenvx is only loaded when an env file exists, Sentry is only loaded in
forked workers, and zod/compile moves to the worker entry.
2026-10-27 21:05:32 -04:00
Tom Moor ac1c6af8fc fix: Use X-Forwarded-Host for traced request URLs (#14210)
* fix: Use X-Forwarded-Host for traced request URLs

* fix: Validate forwarded host with a URL parser
2026-10-22 18:31:45 -04:00
Tom Moor 2679093af3 chore: Vendorize throng as ClusterManager (#14198)
* chore: Vendorize throng as ClusterManager

* fix: Force kill workers after grace period, skip fork if shutting down

* fix: Give workers their full shutdown timeout before the primary exits

* chore: Use a named export for ShutdownHelper
2026-10-21 18:20:03 -04:00
Tom Moor 7d8269a82e fix: Redact query string values in traces except an allowlist (#14140)
* fix: Redact OAuth authorization codes from traced URLs

* Extend the dd-trace default pattern instead of copying it, add tests

* Redact all query string values except an allowlist
2026-10-19 08:23:17 -04:00
Tom MoorandClaude Opus 5.5 9e2565184e chore: Prune stale comments, TODOs, and type suppressions (#14092)
* chore: Remove unused lint disable directives

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WJegM4QsoYSKrBKb6eB4CH

* chore: Replace TODO type suppressions with typed code

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WJegM4QsoYSKrBKb6eB4CH

* chore: Remove obsolete workaround comments in tests and MediaDimension

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WJegM4QsoYSKrBKb6eB4CH

* chore: Remove Tippy compatibility props from Tooltip

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WJegM4QsoYSKrBKb6eB4CH

* chore: Decouple DropdownMenu props from Tooltip and clarify sharing styles

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WJegM4QsoYSKrBKb6eB4CH

* chore: Remove stale retention TODOs from cleanup tasks

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WJegM4QsoYSKrBKb6eB4CH

* chore: Register relations synchronously and clarify workaround comments

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WJegM4QsoYSKrBKb6eB4CH

* chore: Replace Notion import TODOs with descriptive comments

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01WJegM4QsoYSKrBKb6eB4CH

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-10-15 08:54:37 -04:00
Tom Moor e571208871 fix: Spelling, grammar, punctuation, and translation string errors (#14017)
* fix: Spelling, grammar, punctuation, and translation string errors

* fix: Remove duplicate period and comma splice from review feedback
2026-10-11 09:07:07 -04:00
Tom Moor d63372694b chore: More lint warnings -> errors (#13122) 2026-07-25 07:56:13 -04:00
Tom Moor 0697b0a972 perf: Remove dd-trace in master process (#13119) 2026-07-24 22:39:48 -04:00
Tom Moor d3c085462d fix: Sensitive fields can leak into logging when non-primitive (#12910) 2026-07-06 22:57:43 +02:00
Tom MoorandClaude Opus 4.8 cd4b324f5a chore: Upgrade dd-trace and Sentry (node/react) to v10 (#12759)
Bumps dd-trace to ^5.109.0 and @sentry/node + @sentry/react to ^10.58.0,
migrating off APIs removed in the Sentry v8 major: BrowserTracing /
reactRouterV5Instrumentation, Sentry.Handlers.parseRequest, and
Sentry.configureScope.

Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-19 20:50:45 -04:00
Tom MoorandClaude Opus 4.8 3e4727d67c perf: Server startup time (#12680)
* perf: lazy-load jsdom in DocumentHelper to keep it off startup path

DocumentHelper is imported by the Document and Collection models, so its
eager `import { JSDOM } from "jsdom"` pulled jsdom (~140ms) into every
server process at boot. jsdom is only needed by toEmailDiff for HTML
export, so load it lazily there — matching the existing pattern in the
sibling ProsemirrorHelper.toHTML.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

* perf: defer AWS CRT signer load out of the startup path

S3Storage had a top-level `import "@aws-sdk/signature-v4-crt"` side effect
that loaded the native CRT binding (~140ms) whenever the module was
imported — which happens at boot via the Attachment model in every
process, even for local-storage deployments that never construct S3Storage.

Move the import into the S3Storage constructor so the native binding only
loads when S3 storage is actually instantiated, keeping it off the startup
path for local-storage deployments.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

* perf: load dd-trace only when APM is enabled

tracer.ts imported dd-trace unconditionally, so the library (which patches
Node internals on require, ~35-80ms) loaded at startup in every process —
including the common self-hosted case where DD_API_KEY is unset and APM
does nothing. tracer.ts is the first import in server/index.ts, so this
cost is fully serial on the boot path.

Require dd-trace only when DD_API_KEY is set; otherwise fall back to a
no-op tracer covering the surface used by callers (scope/startSpan and a
no-op span), so tracing.ts and the named helpers work unchanged. The
dd-trace/ext/tags import used by tracing.ts is a standalone constants
module and does not pull in the full tracer.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.8 <noreply@anthropic.com>
2026-06-13 13:50:51 -04:00
Tom Moor 6366859935 chore: Remove Koa middleware span reporting (#12501) 2026-05-27 23:18:37 -04:00
Tom MoorandClaude Opus 4.7 cf488508b7 fix: Ignore "Premature close" stream errors in Sentry (#12424)
Client disconnects mid-response surface as "Premature close" errors from
Node's stream end-of-stream helper. These are expected and add noise to
Sentry, similar to the EPIPE/ECONNRESET errors already filtered.

Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-21 21:26:27 -04:00
Tom Moor 0139b91b5d chore: Replace lodash with es-toolkit (#12281)
* chore: Replace lodash with es-toolkit

Migrate all direct lodash imports to es-toolkit/compat for a smaller,
faster, lodash-compatible utility library. Transitive lodash usage from
other packages remains unchanged.

* fix: Restore isPlainObject semantics in CanCan policy

The lodash migration aliased `isObject` to `lodash/isPlainObject` and
the codemod incorrectly mapped the local name to es-toolkit's `isObject`,
which also returns true for arrays and functions. This caused condition
objects in policy definitions to be skipped, breaking authorization
checks across the codebase.

* fix: Restore unicode-aware length counting in validators

es-toolkit/compat's size() returns string.length, while lodash's _.size()
counts unicode code points. Switch to [...value].length to preserve the
previous behavior so multi-byte characters like emoji count as one.
2026-05-06 21:03:47 -04:00
Tom MoorandClaude Opus 4.7 fca10221b9 chore: promote no-explicit-any from warn to error (#12244)
* chore: promote no-explicit-any from warn to error and resolve violations

Upgrades the oxlint rule severity and removes all 40 existing
`no-explicit-any` warnings across the codebase. Most call sites gained
proper types (SharedEditor refs, JSONNode/JSONMark for ProseMirror JSON
walking, DocumentsStore, dd-trace `Span` parameter inference, prosemirror
Fragment public API in place of internal `(fragment as any).content`).
A few load-bearing `any` uses were preserved with scoped disable
comments where changing the type would cascade widely (Sequelize JSONB
columns on `Event`, the `withTracing` higher-order function generic,
`Extension.options` consumed by many subclasses, dd-trace's `req`
patching).

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-02 12:14:23 -04:00
Tom Moor 4c8a1c89b2 chore: resolve no-explicit-any and no-base-to-string lint warnings (#12217) 2026-04-29 17:45:02 -04:00
Tom MoorandClaude Opus 4.7 57308c46af chore: resolve lint warnings (no-explicit-any, no-redundant-type-constituents, no-base-to-string) (#12209)
* chore: resolve no-redundant-type-constituents and test/mock no-explicit-any warnings

Clears 36 lint warnings: all 5 no-redundant-type-constituents, 6
no-misused-spread (via narrowing getPartitionWhereClause's return type
to WhereAttributeHash), and 25 no-explicit-any in test/mock files.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>

* chore: resolve no-base-to-string warnings in tests

Convert userProvisioner try/catch error assertions to Jest's
.rejects.toThrow() idiom, and cast webhook test body to string.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>

* chore: resolve no-explicit-any warnings in cancan and tracing

Tighten types in the cancan policy framework and tracing decorators.
Constructor / generic-function upper bounds keep `any` where TypeScript
variance requires it, scoped to single-line oxlint-disable comments.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.7 <noreply@anthropic.com>
2026-04-28 22:55:30 -04:00
Tom Moor 87bb79250d chore: enable typescript/restrict-template-expressions lint rule (#12199)
* chore: enable typescript/restrict-template-expressions lint rule

Coerce values of unknown type with explicit String() and tighten typing
for template literal expressions across the codebase.

* fix: restore --line-height on Card for fadeOut ::after gradient
2026-04-28 20:11:15 -04:00
Tom Moor 1b91a295e1 fix: Use verified JWT for rate limiting (#12114)
* fix: Use verified JWT for rate limiting

* PR feedback

* Prefer guards
2026-04-20 06:19:39 -04:00
Tom Moor 831c6f0898 fix: User errors should not be set DD spans (#12035)
* fix: User errors should not be set DD spans

* refactor
2026-04-13 22:18:05 -04:00
Tom Moor 0d8d9a1798 chore: Move warning logs from Sentry to standard logs (#11708) 2026-03-10 23:37:02 +00:00
Tom Moor 3d1c2a8759 chore: Remove datadog-metrics lib (#11665)
* chore: Remove datadog-metrics lib

* Restore Pako transient dep types

* PR feedback
2026-03-05 19:27:11 -05:00
Tom Moor 00fb4d1af7 chore: Update node style imports (#11277)
- crypto → node:crypto
  - fs → node:fs
  - fs/promises → node:fs/promises
  - path → node:path
  - http → node:http
  - https → node:https
  - stream → node:stream
  - buffer → node:buffer
  - url → node:url
  - os → node:os
  - net → node:net
  - dns → node:dns
  - events → node:events
  - readline → node:readline
  - querystring → node:querystring
  - util → node:util
2026-01-26 20:51:50 -05:00
Tom Moor ad513250e5 chore: Remove unneccessary redis warnings (#10985) 2025-12-21 20:52:57 -05:00
Tom Moor bf45e97641 chore: Enforce type import consistency (#10968)
* Update types

* fix circular dep

* type imports

* lint type imports and --fix
2025-12-19 23:07:02 -05:00
Tom Moor f085a30406 fix: Shutdown during migrations does not release mutex lock (#10879)
* fix: Shutdown during migrations does not release mutex lock

* tsc
2025-12-12 22:20:53 -05:00
Tom Moor f4d9b6b257 chore: Remove chalk module (#10700) 2025-11-23 20:01:49 +01:00
Hemachandar 04c3d81b1f chore: Setup missing oxlint configs (#9862)
* shared

* server

* app

* remove vestigial eslintrc files

* update comment directives
2025-08-06 19:54:22 -04:00
Tom Moor 34059ce0ef chore: More missing transactions (#9811)
* fix: Missing transaction in notifications.update_all

* lint
2025-08-03 21:52:10 -04:00
Tom Moor da86f38e6f chore: Include stack traces with warnings and sample at 10% (#9784) 2025-07-31 18:16:46 -04:00
codegen-sh[bot]andTom Moor 879c568a2c Upgrade Prettier to v3.6.2 (#9500)
* Upgrade Prettier to v3.6.2 and eslint-plugin-prettier to v5.5.1

- Upgraded prettier from ^2.8.8 to ^3.6.2 (latest version)
- Upgraded eslint-plugin-prettier from ^4.2.1 to ^5.5.1 for compatibility
- Applied automatic formatting changes from new Prettier version
- All existing ESLint and Prettier configurations remain compatible

* Applied automatic fixes

* Trigger CI

---------

Co-authored-by: codegen-sh[bot] <131295404+codegen-sh[bot]@users.noreply.github.com>
Co-authored-by: Tom Moor <tom@getoutline.com>
2025-06-28 10:22:28 -04:00
Tom Moorandgoogle-labs-jules[bot] 1836d2ef63 chore: Fix various lint warnings (#9362)
* Fix various linting errors

This commit addresses several linting warnings reported by ESLint:

- @typescript-eslint/no-shadow:
  - I renamed variables in inner scopes to avoid conflicts with variables in outer scopes in the following files:
    - server/commands/accountProvisioner.ts
    - server/commands/documentDuplicator.ts
    - server/commands/documentMover.ts
    - server/commands/teamProvisioner.test.ts
    - server/commands/teamProvisioner.ts
    - server/commands/userInviter.ts
    - server/commands/userProvisioner.ts
    - server/emails/templates/BaseEmail.tsx
- @typescript-eslint/no-explicit-any:
  - I replaced `any` with more specific types (Record<string, unknown> or void) in the following files:
    - server/emails/templates/BaseEmail.tsx
    - server/emails/templates/InviteEmail.tsx
    - server/emails/templates/SigninEmail.tsx
    - server/logging/Logger.ts

These changes improve code clarity and type safety without altering functionality.

* Update BaseEmail.tsx

* lint

---------

Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>
2025-06-01 10:59:55 -04:00
dependabot[bot]andTom Moor 84ae9a2c31 chore(deps): bump datadog-metrics from 0.11.2 to 0.12.1 (#8773)
* chore(deps): bump datadog-metrics from 0.11.2 to 0.12.1

Bumps [datadog-metrics](https://github.com/dbader/node-datadog-metrics) from 0.11.2 to 0.12.1.
- [Release notes](https://github.com/dbader/node-datadog-metrics/releases)
- [Commits](https://github.com/dbader/node-datadog-metrics/compare/v0.11.2...v0.12.1)

---
updated-dependencies:
- dependency-name: datadog-metrics
  dependency-type: direct:production
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <support@github.com>

* fix: flush now returns a promise

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Tom Moor <tom.moor@gmail.com>
2025-03-24 21:38:54 +00:00
Tom Moor 9e378899ff Remove string filtering in logger 2024-10-17 22:50:11 -04:00
Tom Moor 9680e57849 chore: Remove suppressImplicitAnyIndexErrors TS rule (#7760) 2024-10-11 12:46:46 -07:00
Tom Moor 6b53755f5a fix: Maximum call stack size exceeded, closes #7642 2024-09-24 23:11:58 -04:00
Tom Moor 7bb7f96008 Add optional logging of all server side requests for self-hosted debugging
related #7221
2024-07-15 21:44:08 -04:00
Tom Moor 1f7620c6f5 chore: Add warning if enabling debug logging while filtering it out, closes #6691 2024-03-21 20:11:15 -04:00
Tom Moor 483ede8a01 fix: bind Logger.sanitize 2023-11-26 20:22:16 -05:00
Tom Moor a1b52e18dd chore: Centralize environment detection 2023-11-09 19:24:16 -05:00
Tom Moor d8d49f6950 fix: Internal server error during import with nested documents 2023-11-09 19:24:16 -05:00
Tom Moor bd06e03b1e Added more debugging logs for #5564 2023-09-28 17:36:10 -04:00
Tom Moor 80ef0a38d6 chore: More flakey test improvements (#5801) 2023-09-09 15:30:19 -07:00
Tom Moor 3eb947e9a5 chore: Improve perf of server tests (#5785) 2023-09-06 04:14:49 -07:00
Tom Moor b7bfc4bb1a chore: Remove optimize imports to allow vite upgrade (#5691) 2023-08-14 11:44:58 -07:00
Tom Moor 5656384cc4 fix: Error logging second parameter used as interpolation parameters 2023-07-08 15:35:06 -04:00
Tom Moor 9a95fa47a0 fix: Error details are not output in development 2023-07-08 10:20:39 -04:00