Skip to content

Sync upstream and patch critical server and mobile dependencies - #1

Merged
matthewhand merged 89 commits into
mainfrom
security/nov19-upstream-dependencies
Nov 18, 2026
Merged

matthewhand merged 89 commits into
mainfrom
security/nov19-upstream-dependencies

Conversation

@matthewhand

Copy link
Copy Markdown
Owner

Synchronize this fork with CopilotKit/openfuse at 67580f1 and refresh the server, mobile and transitive dependencies flagged by Dependabot. The fork had no main-branch commits ahead of that upstream.

The candidate lockfile clears the published ranges for all three previously reported critical alerts. The registry audit still flags Zod 3 pulled by dependencies that require its older API. The direct server and mobile dependencies use Zod 4.6.7.

jerelvelarde and others added 30 commits October 1, 2026 06:37
* docs: add Trendshift badge to README

* docs: simplify README header and organize demos

* docs: place navigation above framework attribution

* docs: position badges directly below section links

* docs: revert layout changes intended for OpenDots

* docs: embed playable mobile and web demo videos

* docs: use GitHub-uploaded demo video attachments

* Update README.md
Updated link for meeting with the CopilotKit team.
* Add Parallel as the built-in web search provider

* Retain valid search sources alongside malformed results

* Simplify web search calls and clarify session coverage

* Show web search progress and omit unconfigured browser tools

* Enable Parallel web search by default
* Run the agent computer on an E2B Desktop sandbox

Add COMPUTER_PROVIDER=e2b-desktop as an opt-in alternative to the Docker
computer. Each owner gets one E2B Desktop VM, matched by deployment and
owner metadata, with a graphical Xfce desktop, outbound internet, and
/workspace persisted across Stop (filesystem-only pause).

- Terminal and file tools reuse the existing lease, receipts, and
  files.py contract; commands keep the 30 second limit and output caps.
- New use_desktop agent tool (screenshot, click, type, key, scroll, wait)
  returns a screenshot to the model each step; chat history keeps text only.
- Desktop tab and a live desktop chat card stream the VM over noVNC.
- The E2B API key stays on the server; config requires a unique
  COMPUTER_DEPLOYMENT_ID for this provider.
- Docker remains the default; its code paths are unchanged.

* fix(computer): serialize first desktop connection with startup

Addresses review request 4166743396.

* fix(desktop): sandbox VM-controlled iframe content

Addresses review request 4166744178.

* docs(computer): disclose public VM ports and server exposure

Addresses review request 4166744714.

* fix(computer): budget PDF export timeout for response size

Addresses review request 4166745424.

* fix(chat): preserve desktop viewer across agent steps

Addresses review request 4166745927.

* fix(desktop): open native streams only on user request

Addresses review request 4166746392.

* fix(computer): keep desktop actions out of terminal receipts

Addresses review request 4166746967.

* fix(computer): preserve transient provider failure status

Addresses review request 4166747484.

* fix(computer): propagate file attachment errors

Addresses review request 4166747947.

* fix(desktop): retain success after screenshot or storage failures

Addresses review request 4166748434.

* perf(computer): limit polling and reuse verified sandbox info

Addresses review request 4166749058.

* perf(desktop): store screenshot bytes outside the record database

Addresses review request 4166749583.

* refactor(computer): share service behavior through provider backends

Addresses review request 4166750015.

* refactor(computer): share bounded output capture between providers

Addresses review request 4166750313.

* fix(desktop): preserve uncertain input outcomes after transport loss

Addresses follow-up review comment 5956520610. Persist uncertain intent before dispatch and never replay input after a lost response.

* fix(desktop): preserve uncertainty after partial input failure
…ilotKit#119)

* fix(actions): fence provider execution against task cancel

* test(actions): cover cancel after approval claim

* style(test): satisfy biome

* style(test): trim trailing blank line
TaskWorker.tick() awaited every run it claimed before releasing its lock,
so one slow task held up all queued work, scheduled watch checks and
approved tasks until it finished. Start the claimed runs and release the
tick right away, tracking started tasks in an inFlight set so a worker
still runs at most three at once and never starts the same task twice.
CopilotKit#135)

Accepting an idea always created a new task, even when a task for the
same email was already in progress, for example one started from chat.
The person then had two identical tasks, two "Your details are needed"
notifications, and two replies to review.

decideIdea now links the idea to an existing task for the same email and
kind unless that task failed or was cancelled, and the app opens that
task. A repeat accept of a linked idea returns it without creating more
work.
File and browser routes accepted any :id string and file names could
collapse to an empty display name. Validate file and browser session IDs
against the UUID shape the services actually issue (matching the worker's
session check) so malformed IDs return 404 without probing storage or the
worker, resolve file bytes inside the files directory with a containment
check, fall back to document.pdf for empty sanitized names, encode session
IDs in worker request paths, require a JSON object for console input, and
require UUID draft IDs. Adds tests/resource-ids.test.ts regression coverage.

Co-authored-by: Jerel Velarde <85066839+jerelvelarde@users.noreply.github.com>
…tKit#120)

* fix(actions): keep prepared review alive across lease handoff

* test(actions): cover lease handoff during review prep

* test(actions): refresh lease-handoff fixture types

* fix(actions): distinguish task stop from lease abort

* test: cover aborted lease loss versus durable task stop

* style: format lease-loss regression
…otKit#31)

* fix: port cancellation browser.ts

* fix: port cancellation browser.test.ts

* fix: port cancellation model-worker.test.ts

* fix: propagate cancellation through model.ts

* fix: propagate cancellation through service.ts
* fix(monitors): version observe commits by checks

* test(monitors): cover overlapping observe commits

* test(monitors): type frozen task snapshot
* fix(browser): serialize concurrent download imports

* test(browser): dedupe concurrent download imports
…ilotKit#115)

* fix(worker): release browser slot when storage persistence fails

* test(worker): cover close after storageState failure

* style(worker): satisfy biome in close resilience test
…t#110)

* perf(workspace): add section-scoped source reads

* perf(agent): scope read_workspace by requested section

* test(workspace): cover section-scoped reads

* perf(workspace): avoid duplicate connection lookup
…#124)

fix(mobile): keep header menu reachable through identity layout
…ailing the list (CopilotKit#141)

Co-authored-by: Jerel John Velarde <jerel@copilotkit.ai>
…tKit#106)

* perf(api): read notifications without full workspace snapshot

* test(api): keep notification reads scoped
* fix: CVE-2025-71329 security vulnerability

Automated dependency upgrade by OrbisAI Security

* fix: patch Metro to use image-size's buffer API, fixing CVE-2025-71329 override

The workspace-wide image-size override to 2.0.3 broke Metro's asset
bundling: metro@0.83.3 is the only consumer of image-size in the
lockfile, and its getAssetData() passed the raw asset file path
(a string) to image-size's default export for every non-zip asset.
image-size@2.0.3 dropped synchronous file-path support in favor of a
Buffer-only sync API (file paths now require the async fromFile API),
so every normal PNG/JPEG asset would fail to get its dimensions during
expo export.

No non-breaking 1.x image-size release exists, and the only Metro
release that drops the image-size dependency entirely (0.83.8) is only
reachable via an Expo SDK 55 upgrade, out of scope for a security fix.
Instead, patch metro@0.83.3 via pnpm's patchedDependencies so
getAssetData() always reads the asset into a Buffer first, mirroring
the fix Metro itself later shipped upstream in 0.83.8.

Verified with `pnpm install --frozen-lockfile` and a real
`expo export --platform web` run bundling apps/mobile/assets/capybara.png:
the exported bundle now registers correct width/height (1254x1254,
matching the actual PNG) instead of failing.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>

---------

Co-authored-by: OrbisAI Security <mediratta01.pally@gmail.com>
Co-authored-by: Claude Sonnet 5 <noreply@anthropic.com>
…Kit#83)

Co-authored-by: wangtao <328929485+wangtaotaotao95@users.noreply.github.com>
Co-authored-by: Jerel Velarde <85066839+jerelvelarde@users.noreply.github.com>
…ilotKit#71)

* fix: reject nonexistent calendar dates before review or dispatch

* fix: preserve minute precision when validating calendar dates

---------

Co-authored-by: wangtao <328929485+wangtaotaotao95@users.noreply.github.com>
Co-authored-by: Jerel Velarde <85066839+jerelvelarde@users.noreply.github.com>
Co-authored-by: wangtao <328929485+wangtaotaotao95@users.noreply.github.com>
Co-authored-by: Jerel Velarde <85066839+jerelvelarde@users.noreply.github.com>
…lotKit#144)

* feat: connect OpenMuse runtime telemetry to signup reporting

* fix: include telemetry identity in Render template setup
nvtoan0201-swe and others added 24 commits October 6, 2026 15:34
A single message could break or distort a mailbox read: an unknown charset label threw from TextDecoder, RFC 2231 language tags blocked header decoding, a quoted display name containing an address was preferred over the real sender, a bare angle-addr From produced an empty sender, and an attached message/rfc822 had its nested text merged into the parent body. Decode bodies with a UTF-8 fallback, strip language tags, ignore addresses inside quoted display names, fall back to the bare address, and stop recursing into attachment parts. Large remote bodies stored behind attachment IDs are still hydrated and read as message text.
* perf(store): list records by status

* perf(server): scope refreshIdeas status queries

* test(store): cover status-scoped listing

* chore: match repository formatting after main reconciliation

---------

Co-authored-by: Jerel John Velarde <jerel@copilotkit.ai>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
…opilotKit#169)

* fix: skip hydration of attached MIME message trees

* Expose unnamed forwarded messages as attachments and cover thread reads
…lotKit#175)

Biome expects LF, but a fresh Windows clone with the default
core.autocrlf=true produced CRLF working trees and ~172 formatter
errors before any code change. eol=lf pins the checkout to LF for
text files; the binary rules are unchanged and Linux/macOS checkouts
are unaffected.
Co-authored-by: sean0407 <22557931+sean0407@users.noreply.github.com>
…t#174)

`AgentService.detail()` read every file, browser, run event and artifact the
owner has ever stored and filtered them in JavaScript, so showing one task cost
the whole workspace. The app calls it once per task card, and a workspace keeps
its run events and artifacts forever.

Measured against PGlite with unrelated rows of each kind (500 of them browsers,
the rest 1:1 with the table size), 15 calls, median:

   200 rows/table: 805 rows read,   6.1 ms -> 5 rows read, 0.8 ms
 2,000 rows/table: 6,505 rows read, 48.8 ms -> 5 rows read, 1.5 ms
10,000 rows/table: 30,505 rows read, 309.2 ms -> 5 rows read, 5.6 ms

The task already names the files (`artifactIds`) and the browsers
(`state.browserId`, `state.sessionId`), so those two become `listByIds`, and the
two kinds that carry a `taskId` become `listByTaskId`, both with the ordering
`list` used. The same rows come back in the same order, and the four queries now
run together instead of one after another. A task row without `artifactIds`,
which the type says cannot exist, reads nothing instead of throwing.

What this does not remove: the `data->>'taskId'` filter still scans the
(owner, kind) prefix in SQL, which is the 5.6 ms left at 10,000 rows. An
expression index would remove that too, as it would for `listByGoalId`.
…lotKit#200)

* feat(server): revoke the current session on DELETE /api/session

* fix(server): delete expired session rows when they are rejected

Auth.owner returned 401 for an expired session but kept its row, so every sign-in that was never revoked left a dead row behind. Remove the row when it is found expired. Also applies biome formatting to the session-logout test.

* fix(server): keep expired-session rejection a clean 401 if cleanup fails

The expiry cleanup delete runs before the 401 is thrown; a failing remove would surface as a 5xx instead of the intended 401. Make the cleanup best-effort so rejection is unaffected.
Each model run starts with only the task prompt, so the reply to an
earlier ask_user question has to come from saved state. Answering
overwrote state.answer, so a task that asked two questions lost the
first reply and the model never saw which question a reply answered.

Keep the replies as a list with their questions and send all of them.
Tasks saved with a single answer still read it.
…om drafts (CopilotKit#206)

* fix(files): limit how much a PDF may decompress while it is loaded

* fix(domain): drop invisible characters from email and event drafts
…s their own computer name (CopilotKit#204)

* fix(server): accept signed links only for the methods their pages use

* fix(computer): give new installs their own Docker deployment name
…l list (CopilotKit#183)

Signed-off-by: Charan Rathore <180254320+charan-rathore@users.noreply.github.com>
…lotKit#224)

* chore: rename OpenMuse to OpenFuse

Rename the product in docs, UI strings, the agent's default name and
prompt, the API root, package names, the Expo app name, slug, scheme
and bundle/package ids, Render services, disks and env names, compose,
Docker image tags, test fixtures and temp prefixes. Rename the demo
video file and its title metadata, and the PDF test fixture text.

github.com URLs to the repository are unchanged; they redirect after
the repository rename.

* fix: keep installs from before the rename working

Existing installs keep what they already created under the old name:

- OPENFUSE_ACCESS_KEY falls back to the previous variable name.
- Without DATA_DIR or WORKER_DATA_DIR, an existing data directory under
  the previous name is still used, and it stays ignored by git and Biome.
- Credentials encrypted under the previous associated data still decrypt.
- Choice messages saved in older threads still parse and display.
- An install that started before the rename keeps its computer's
  container, volume, labels, E2B metadata and files.py path; a new
  install records a computer-name file and uses the new names. Without
  COMPUTER_IMAGE it still accepts its existing containers' default image,
  and the image links the previous files.py path.

* chore(telemetry): tag runtime telemetry as OpenFuse

Runtime telemetry now carries accessibility_title "OpenFuse". The
PostHog queries in docs/TELEMETRY.md filter on the new tag.

* Remove demo media that shows the old name, and rename the Muse client hooks

The demo videos, GIFs and cover images, and the document screenshot, show
the old product name in the picture. They are removed along with every
link to them, as are the two README videos hosted on GitHub. MuseApi and
useMuseThread become FuseApi and useFuseThread.
Point the repository links at CopilotKit/openfuse
@amazon-q-developer

Copy link
Copy Markdown

Warning

Amazon Q Developer for GitHub: end of support

On January 30, 2027, AWS will discontinue support for the Amazon Q Developer for GitHub App. New app installations will no longer be available starting November 18, 2026.

For capabilities similar to the Amazon Q Developer for GitHub App, explore Kiro and the Kiro GitHub App. For more information about the end of support, see Amazon Q Developer end-of-support announcement on the AWS DevOps Blog.

@amazon-q-developer amazon-q-developer Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review Summary

This PR synchronizes the fork with the upstream CopilotKit/openfuse at 67580f1, renames the product from OpenMuse → OpenFuse throughout, and introduces several meaningful security and functional improvements: a new in-memory rate-limiter (rate-limit.ts), a session revocation endpoint (DELETE /api/session), atomic key-file creation using link/unlink to prevent concurrent-write races, HEAD-method normalization for signed URLs, and calendar-range validation moved to a shared schema.

Critical Issues Found

1. DELETE /api/session is guarded by the auth middleware it was meant to bypass (apps/server/src/app.ts lines 150–153)
The logout route is registered after the app.use("/api/*") auth guard. Any client with an expired or missing token receives a 401 instead of being allowed to clear the session, making logout unreachable in that exact state.

2. Rate-limit maxEntries capacity exhaustion returns a 429 to innocent clients (apps/server/src/rate-limit.ts lines 32–34)
When the entry table is full and no entries are expired, take() returns false for a brand-new key, triggering a 429 for a client that has made zero requests. This is indistinguishable from a genuine rate-limit hit.

3. TRUST_PROXY=true with an appending (not overwriting) reverse proxy allows IP spoofing (apps/server/src/rate-limit.ts lines 54–57)
The rate limiter keys on X-Forwarded-For[0], which is client-controlled unless the proxy overwrites the header. The .env.example documents the requirement but nothing enforces it at runtime.

4. In-process login counter is not reset per-window and is per-process only (apps/server/src/app.ts line 79)
The loginAttempts counter is module-level state that is reset only when the first request after a 60-second gap arrives. In any multi-process deployment it provides no protection, and the boundary condition allows one extra attempt per window edge.

5. readOrCreate temporary file uses link() which fails across filesystems (apps/server/src/auth.ts lines 93–103)
A non-EEXIST failure from link (e.g., cross-device) causes the temp file to be deleted in the finally block while the persistent key is never written; on the next start a new key is generated, invalidating all outstanding signed URLs.

No hardcoded secrets or credentials were found. The dependency lockfile changes address the previously reported Dependabot critical alerts. The Zod 3 transitive residual noted in the PR description is acknowledged and expected.


You can now have the agent implement changes and create commits directly on your pull request's source branch. Simply comment with /q followed by your request in natural language to ask the agent to make changes.


⚠️ This PR contains more than 30 files. Amazon Q is better at reviewing smaller PRs, and may miss issues in larger changesets.

Comment thread apps/server/src/app.ts
onError: (c) => c.json({ error: "Request is too large; PDFs must be 10 MB or smaller" }, 413),
}),
);
app.use("/api/*", rateLimit(Boolean(config.trustProxy)));

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛑 Security Vulnerability: The in-process login rate limiter uses module-level mutable state that is reset only on the first request after a window expires. Because the reset (loginAttempts = 0) and the increment (++loginAttempts) happen in the same synchronous block, the very request that resets the window counts as attempt #1 — correct so far. However, loginWindow is set to Date.now() only on that reset request; a 60-second burst that starts mid-window can reach ++loginAttempts > 30 and then a new window opens on the 31st request (not on a fresh 60-second boundary), effectively allowing 31 attempts in slightly less than 60 s without a true reset. More critically, this counter is entirely per-process: in any multi-process or clustered deployment it provides no protection at all. The new /api/* rateLimit middleware is per-IP and applies to all endpoints, but it has a 120-request default and is not specific to the login path, so it cannot substitute.1

Footnotes

  1. CWE-307: Improper Restriction of Excessive Authentication Attempts - https://cwe.mitre.org/data/definitions/307.html ↩

Comment thread apps/server/src/app.ts
Comment on lines +150 to +153
app.delete("/api/session", async (c) => {
await auth.revoke(c.req.header("authorization"));
return c.json({ ok: true });
});

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛑 Security Vulnerability: The DELETE /api/session route is registered after the app.use("/api/*", …) authentication middleware (line 134). In Hono, middleware registered with app.use applies based on registration order. Because the auth middleware is registered at line 134 and DELETE /api/session is registered at line 150, any request to DELETE /api/session will first be passed through the auth guard, which requires a valid Bearer token. This means a user whose token was lost or corrupted cannot log out — the logout endpoint itself demands a valid session. The revoke call inside the handler is a no-op for an invalid token anyway, but the route should bypass the auth middleware (similar to how POST /api/session does) so that the handler is always reachable.

Comment thread apps/server/src/auth.ts
Comment on lines +93 to +103
await writeFile(temporary, value, { mode: 0o600, flag: "wx" });
try {
// Publish only complete bytes, without replacing another process's value.
await link(temporary, path);
} catch (error) {
if (!(error instanceof Error && "code" in error && error.code === "EEXIST")) throw error;
value = await readFile(path, "utf8");
} finally {
await unlink(temporary);
}
return value;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛑 Logic Error: readOrCreate has a resource-leak in the finally block. When link(temporary, path) succeeds (no error), the finally block still calls unlink(temporary). This is intentional and correct. However, if link throws an error that is not EEXIST (e.g., a permissions error on a cross-device link), the throw error at line 98 propagates but the finally block still runs unlink(temporary), which will delete the temp file and then rethrow — that is fine. The real problem is if writeFile(temporary, …) at line 93 succeeds but then link fails with a non-EEXIST error: the temp file is cleaned up in finally, which is correct, but the caller gets an error and the signing key was never persisted. On the next call, a new key is generated, breaking all existing signed URLs. This is an inherent TOCTOU risk on cross-filesystem mounts, but the function should document that path and its parent must be on the same filesystem as temporary.

Comment on lines +54 to +57
if (input.trustProxy) {
const forwarded = input.forwardedFor?.split(",")[0]?.trim();
if (forwarded) return `proxy:${forwarded}`;
if (input.realIp) return `proxy:${input.realIp}`;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛑 Security Vulnerability: When trustProxy is true, resolveClientKey uses the first value from X-Forwarded-For as the rate-limit bucket key. The X-Forwarded-For header is typically a comma-separated list where each upstream proxy appends the previous IP. If the reverse proxy prepends rather than overwrites, the leftmost value is still client-controlled (an attacker can send X-Forwarded-For: 1.2.3.4 and the proxy appends its own). This is only safe when the reverse proxy is configured to replace (overwrite) the X-Forwarded-For header with the socket IP, not append to a client-supplied one. The .env.example comment does say "overwrites X-Forwarded-For", but the code has no runtime enforcement. If a user sets TRUST_PROXY=true with a proxy that appends rather than overwrites, every client can enumerate arbitrary IPs to bypass the limit.1

Footnotes

  1. CWE-348: Use of Less Trusted Source for IP Address - https://cwe.mitre.org/data/definitions/348.html ↩

Comment on lines +32 to +34
if (entries.size >= maxEntries) {
cleanupExpired(now);
if (entries.size >= maxEntries) return false;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛑 Logic Error: When all maxEntries slots are occupied and cleanupExpired removes nothing (all entries are still live), take returns false without inserting the new key. This silently drops the rate-limit check for that client — it is treated as "over limit" and returns false, which causes a 429 for a client that may never have made any requests before. Under sustained load from many distinct IPs, an entirely new client will start receiving 429 responses even though it has zero requests in the current window, and this condition is indistinguishable from a genuine rate-limit violation. The 10,000-entry default is generous, but this should return an error that distinguishes capacity exhaustion from a genuine rate limit.

@matthewhand
matthewhand merged commit b803039 into main Nov 18, 2026
7 checks passed
@matthewhand
matthewhand deleted the security/nov19-upstream-dependencies branch November 18, 2026 23:11
matthewhand added a commit that referenced this pull request Nov 18, 2026
Retain the exact file tree tested and merged in #1, which includes upstream through 67580f1.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.