Skip to content

Faultmark scanned this repo and found 24 verified bugs #2829

Closed
Abzaek/documenso
#1

Description

@R0hit-Sriram

Hey documenso team,

I've been building Faultmark (faultmark.com) — an AI scanner that runs a 3-model debate to verify bugs before surfacing them.
Ran it on this repo as a real-world test. Found 24 confirmed bugs. Sharing before posting anything publicly.

High Severity (6)

1. envelope.recipients.sort() mutates React state in-place
apps/remix/app/components/general/document-signing/envelope-signing-provider.tsx:297

The nextRecipient useMemo calls envelope.recipients.sort(...) directly,
permanently mutating the React state object. After the first render, all
downstream logic — including selectedAssistantRecipient and
assistantRecipients — produces incorrect results. Only manifests with
sequential signing enabled.

Fix: [...envelope.recipients].sort(...)


2. allRecipients.sort() mutates the prop array, breaking signer lookup
apps/remix/app/components/general/document-signing/document-signing-page-view-v1.tsx:145

Same mutation pattern. After the first render, the parent's array is permanently
reordered, breaking selectedSigner = allRecipients?.find(r => r.id === selectedSignerId)
and any field filtering that depends on original recipient order.

Fix: [...allRecipients].sort(...)


3. handleInitialsFieldClick always submits null — user's typed initials are never saved
apps/remix/app/utils/field-signing/initial-field.ts:43

When a user types initials into the dialog, the input is stored in initialsToInsert.
But the return statement returns value: initials (the original null) instead of
value: initialsToInsert. Every initials field submission silently sends null
regardless of what the user typed.

Fix: Change line 43 from value: initials to value: initialsToInsert


4. loadingSpinnerGroup.destroy() called twice on every DROPDOWN sign
apps/remix/app/components/general/envelope-signing/envelope-signer-page-renderer.tsx:338,341

destroy() is called inside .then() at line 338 and again inside .finally()
at line 341. Since .finally() always runs after .then(), the Konva group is
destroyed twice on every successful dropdown sign. The second call either throws
or corrupts canvas state.

Fix: Remove the destroy() at line 338, keep only the .finally() one.


5. Admin organisations table pagination is permanently hidden
apps/remix/app/components/tables/admin-organisations-table.tsx:241

The visibility condition is !hidePaginationUntilOverflow || 1 > table.getPageCount().
The literal 1 and getPageCount() are reversed — 1 > getPageCount() is only
true when there are zero pages, which never happens. Pagination is never shown.

Fix: table.getPageCount() > 1


6. removeValue crashes when removing the last item
apps/remix/app/components/forms/editor/editor-field-dropdown-form.tsx:123

After splice(index, 1), the code checks newValues[index].value — but after
the splice, newValues[index] is the element that shifted into that position.
If the removed item was last, newValues[index] is undefined → runtime crash.
The defaultValue is also never correctly cleared.

Fix: Capture const removedValue = currentValues[index].value before the splice.


Medium Severity (17)

7. localStorage cleanup skips every other key

Iterating with an index-based for loop while calling removeItem inside it shifts
subsequent keys down, causing every other matching key to be skipped.

apps/remix/app/components/general/document/document-edit-form.tsx:300

Fix: Collect all keys to remove first, then remove in a separate pass.

8. Loading spinner destroyed before re-authentication completes

executeActionAuthProcedure is called with void (fire-and-forget). The outer
.finally() executes immediately, destroying the spinner before auth resolves.

apps/remix/app/components/general/envelope-signing/envelope-signer-page-renderer.tsx:374

Fix: Await the call or restructure .finally() to run after the auth path resolves.

9. columns useMemo has empty deps — stale session marks wrong row as "Current"

The columns array captures t, session, and refetch but has [] deps.
row.original.id === session?.id always uses the session from first render.

apps/remix/app/routes/_authenticated+/settings+/security.sessions.tsx:93

Fix: Add t, session, refetch to the dependency array.

10. Module-level UAParser causes race condition in concurrent rendering

One shared instance is used across all table cells. Under React concurrent mode,
interleaved setUA() / getResult() calls produce incorrect browser/OS labels.

apps/remix/app/routes/_authenticated+/settings+/security.sessions.tsx:25

Fix: new UAParser(userAgent).getResult() per cell.

11. dangerouslySetInnerHTML renders unsanitized banner content

banner.data.content is rendered with no sanitization. If content is ever
set by a non-superadmin or via a compromised API, arbitrary JS executes for all users.

apps/remix/app/components/general/app-banner.tsx:19

Fix: Sanitize with DOMPurify before rendering.

12 & 13. handleSigningOrderChange and onDragEnd close over stale signingOrder

Both callbacks capture signingOrder but don't include it in their useCallback
deps. Toggling signing mode then reordering assigns incorrect ordinal values.

apps/remix/app/components/embed/authoring/configure-document-recipients.tsx

Fix: Add signingOrder to both useCallback dependency arrays.

14. Field duplication assigns to currently selected recipient, not the field's owner

Duplicate and duplicateAll use selectedRecipient from outer scope. If a different
recipient is selected in the sidebar, duplicated fields are assigned to the wrong person.

apps/remix/app/components/embed/authoring/configure-fields-view.tsx

Fix: Use lastActiveField.signerEmail and lastActiveField.recipientId unconditionally.

15. fieldBounds MutationObserver: Math.max() called with one arg — PDF dimensions never read

Math.max(DEFAULT_HEIGHT_PX) with a single argument is a no-op. The actual $page
element dimensions are never used, so field sizing always uses fixed defaults.

apps/remix/app/components/embed/authoring/configure-fields-view.tsx

Fix: Math.max($page.offsetHeight, DEFAULT_HEIGHT_PX)

16 & 17. Division by zero → width: 'Infinity%' in progress bars (mobile + V2)

When a recipient has zero required fields, 100 / requiredRecipientFields.length
produces Infinity, breaking progress bar rendering.

  • apps/remix/app/components/general/document-signing/document-signing-mobile-widget.tsx
  • apps/remix/app/components/general/document-signing/document-signing-page-view-v2.tsx

Fix: Guard: requiredRecipientFields.length > 0 ? <calculation> : '100%'

18. toggleOpen sends stale isOpen to onOpenChange — parent state always desynchronised

setIsOpen((isOpen) => !isOpen) is async, but onOpenChange?.(!isOpen) reads
the pre-toggle value. Parent's open/closed state is always the wrong value.

apps/remix/app/components/general/app-command-menu.tsx

Fix: const newOpen = !isOpen; setIsOpen(newOpen); onOpenChange?.(newOpen)

19. goToDocuments and goToTemplates throw when teamUrl is null

Both functions return empty arrays when teamUrl is null. Calling push(links[0].path)
on an empty array throws for any user without a valid team URL.

apps/remix/app/components/general/app-command-menu.tsx

Fix: Guard with array length check before calling push.

20. Step calculation reads stale selectedTemplateId when initialTemplateId changes

When initialTemplateId changes to null, the useEffect calls
setSelectedTemplateId(null) but the step calculation immediately reads the
still-stale state value, setting step to 'MANAGE' instead of 'SELECT_TEMPLATE'.

apps/remix/app/components/dialogs/public-profile-template-manage-dialog.tsx

Fix: Compute const newSelectedId = initialTemplate?.id ?? null and use that
in the step calculation instead of reading state.

21. Radio form: sequential RHF writes may leave previous option checked

Two sequential setValue calls to the same field may not resolve in expected order
under RHF batching, leaving the newly selected option unchecked.

apps/remix/app/components/forms/editor/editor-field-radio-form.tsx

Fix: Compute the full final state in a single form.setValue call.

22. Team delete sends -1 as transferTeamId instead of undefined

parseInt('-1', 10) returns -1. -1 || undefined evaluates to -1 because
-1 is truthy. The backend receives an invalid team ID instead of undefined.

apps/remix/app/components/dialogs/team-delete-dialog.tsx

Fix: Validate transferTeamId > 0 before passing to the API.

23. Number field auto-sign useEffect has empty deps — onSign is permanently stale

The useEffect captures onSign from mount and never updates. If any state
onSign closes over changes before auto-sign triggers, it uses outdated values.

apps/remix/app/components/general/document-signing/document-signing-number-field.tsx

Fix: Add onSign to the dependency array.

24. searchParams in useEffect deps + setSearchParams inside = infinite re-render loop

Each setSearchParams call produces a new searchParams object, re-triggering
the effect. Sibling pages have an early-return guard — this page doesn't.

apps/remix/app/routes/_authenticated+/o.$orgUrl.settings.teams.tsx

Fix: Add early return: if (params.toString() === searchParams?.toString()) return;

Happy to share full code snippets and proposed fixes for any of these.
No strings attached, just wanted to be useful and get real-world feedback on the tool.

  • Rohit
    faultmark.com

Activity

  1. added
    status: triage
    on May 18, 2026
  2. github-actions commented on May 18, 2026

    @github-actions
    Contributor

    Thank you for opening your first issue and for being a part of the open signing revolution!

    One of our team members will review it and get back to you as soon as it possible 💚

    Meanwhile, please feel free to hop into our community in Discord

  3. added a commit that references this issue on Jun 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    status: triage

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions