Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 16 additions & 2 deletions .github/workflows/dependency-audit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,17 @@ on:
pull_request:
paths:
- .github/workflows/dependency-audit.yml
- scripts/audit-shipped-dependencies.mjs
- scripts/third-party-closure.mjs
- package.json
- package-lock.json
- 'apps/*/package.json'
- 'packages/*/package.json'
push:
branches: [main]
paths:
- scripts/audit-shipped-dependencies.mjs
- scripts/third-party-closure.mjs
- package.json
- package-lock.json
- 'apps/*/package.json'
Expand Down Expand Up @@ -44,10 +48,20 @@ jobs:
cache: npm

- name: Install dependencies
run: npm ci --ignore-scripts --omit=dev
# The full tree, not --omit=dev: the shipped-closure audit below walks
# the renderer roots, which npm labels dev even though they ship.
run: npm ci --ignore-scripts

- name: Audit production dependencies
run: npm audit --omit=dev --audit-level=moderate

- name: Audit shipped desktop closure
run: node scripts/audit-shipped-dependencies.mjs

- name: Verify registry signatures
run: npm audit signatures --omit=dev
# The full tree, not `--omit=dev`. Two reasons it has to be both:
# the renderer roots live in devDependencies while their code ships
# inside `dist-renderer`, and signature verification also protects
# everything that *executes* during the build — a tampered vite or
# biome can pollute the artifact without ever being packaged.
run: npm audit signatures
3 changes: 3 additions & 0 deletions .github/workflows/release-desktop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,9 @@ jobs:
- name: Audit production dependencies
run: npm audit --omit=dev --audit-level=moderate

- name: Audit shipped desktop closure
run: node scripts/audit-shipped-dependencies.mjs

- name: Write App Store Connect API key
if: matrix.platform == 'macos'
env:
Expand Down
17 changes: 17 additions & 0 deletions apps/desktop/electron-builder.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,15 @@ export default {
directories: {
output: 'release',
},
// `files` names what to include; the production dependency closure of
// `package.json` comes along automatically. Renderer-only packages are kept
// out of that closure by living in `devDependencies` — vite bundles them into
// `dist-renderer`, so a second copy of their sources in `app.asar` is never
// loaded. A hand-written exclude list was tried first and could not hold: it
// has to name every transitive package too, and it silently went stale.
//
// `@xterm/headless` stays a dependency on purpose — `@maka/runtime` imports
// it for the PTY stack, so only the renderer-side xterm packages moved.
files: [
'dist/**/*',
'dist-renderer/**/*',
Expand All @@ -25,6 +34,14 @@ export default {
// FakeBackend and the Desktop E2E candidate bootstrap live under
// `test-only/`; they must not reach a packaged app.
'!**/test-only/**',
// `build:main` emits renderer sources as tsc side-files so main's tests can
// import a few helpers. The main process reaches exactly one of them at
// runtime — the cursor overlay engine — while the rest import `react`,
// `@maka/ui` and `@astryxdesign/core`, which the renderer now bundles
// instead of shipping under `node_modules`. Shipping those files would put
// ESM in the archive whose static imports cannot resolve.
'!dist/renderer/**',
'dist/renderer/computer-use-overlay/**',
],
extraResources: [
{
Expand Down
35 changes: 26 additions & 9 deletions apps/desktop/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,44 +41,61 @@
"smoke:browser": "npm run build:workspace-deps && npm run build:main && electron scripts/browser-observe-act-smoke.mjs"
},
"dependencies": {
"@astryxdesign/core": "0.4.0",
"@astryxdesign/theme-neutral": "0.4.0",
"@dnd-kit/core": "^6.3.1",
"@dnd-kit/sortable": "^10.0.0",
"@jackwener/opencli": "1.8.6",
"@maka/computer-use": "0.1.0",
"@maka/core": "0.1.0",
"@maka/mcp": "0.1.0",
"@maka/runtime": "0.1.0",
"@maka/runtime-host": "0.1.0",
"@maka/storage": "0.1.0",
"@maka/ui": "0.1.0",
"@xterm/addon-fit": "^0.11.0",
"@xterm/xterm": "^6.0.0",
"electron-updater": "^6.8.9",
"node-pty": "^1.2.0-beta.15",
"qrcode": "^1.5.4",
"react": "^19.2.1",
"react-dom": "^19.2.1",
"ws": "^8.21.0",
"zod": "^4.4.3"
},
"devDependencies": {
"@ant-design/icons-svg": "4.5.0",
"@astryxdesign/core": "0.4.0",
"@astryxdesign/theme-neutral": "0.4.0",
"@dnd-kit/core": "^6.3.1",
"@dnd-kit/sortable": "^10.0.0",
"@fontsource-variable/geist": "^5.3.0",
"@fontsource-variable/geist-mono": "^5.3.0",
"@maka/ui": "0.1.0",
"@playwright/test": "^1.62.1",
"@storybook/react-vite": "^10.5.5",
"@types/react": "^19.2.18",
"@types/react-dom": "^19.2.4",
"@types/ws": "^8.18.1",
"@vitejs/plugin-react": "^6.0.5",
"@xterm/addon-fit": "^0.11.0",
"@xterm/xterm": "^6.0.0",
"electron": "43.2.0",
"electron-builder": "26.15.3",
"esbuild": "^0.28.1",
"linkedom": "^0.18.13",
"react": "^19.2.1",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

P2 — Shipped renderer code falls out of the release vulnerability audit. The workflows still use npm audit --omit=dev; after this move, React and the other declared renderer roots remain in dist-renderer but are excluded from that audit solely because npm calls them dev dependencies. Extend the existing shipped-artifact graph to an auditable renderer closure (or run an equivalent dedicated bundled-graph audit) so the security boundary matches what is released.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Rechecked on exact head 9e74bcc95. The dedicated audit is a good step, but this P2 remains: it still derives the renderer closure from the hand-maintained maka.rendererBundledDependencies list, while the dependency-audit workflow does not build/read Vite's actual dist-renderer/bundled-npm-packages.json. A newly imported renderer package omitted from the list can therefore ship without this security lane auditing it; only the later release artifact verifier detects the drift. Please make the audit consume the actual bundled graph, or build and validate that graph in the audit workflow.

中文说明

当前 head 已新增专用 audit,但它仍以手工 rendererBundledDependencies 为权威,而 dependency-audit workflow 不生成或读取 Vite 的真实 bundled graph。新增但漏列的 renderer import 仍会绕过安全审计,只在更晚的 release verifier 才被发现,因此这个 P2 仍有效。

"react-dom": "^19.2.1",
"simple-icons": "16.28.0",
Comment thread
coderabbitai[bot] marked this conversation as resolved.
"storybook": "^10.4.6",
"vite": "^8.1.5"
},
"maka": {
"rendererBundledDependencies": [
Comment thread
Astro-Han marked this conversation as resolved.
"@ant-design/icons-svg",
"@astryxdesign/core",
"@astryxdesign/theme-neutral",
Comment thread
qodo-code-review[bot] marked this conversation as resolved.
"@dnd-kit/core",
"@dnd-kit/sortable",
"@fontsource-variable/geist",
"@fontsource-variable/geist-mono",
"@maka/ui",
"@xterm/addon-fit",
"@xterm/xterm",
"react",
"react-dom",
"simple-icons"
]
}
}
72 changes: 71 additions & 1 deletion apps/desktop/resources/licenses/npm/THIRD_PARTY_NOTICES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ Maka Desktop — Production npm Third-Party Notices
====================================================

Generated by scripts/generate-third-party-notices.mjs from the exact
@maka/desktop production dependency closure and package-lock.json.
@maka/desktop shipped dependency closure (Node production plus the
bundled renderer) and package-lock.json.
Do not edit this file by hand.

Policy: every package must resolve to an ASF-compatible SPDX license. Compound
Expand Down Expand Up @@ -557,6 +558,36 @@ OTHER DEALINGS IN THE FONT SOFTWARE.

================================================================================

Package: @ant-design/icons-svg@4.5.0
Declared license: MIT
Selected license: MIT
Repository: git+https://github.com/ant-design/ant-design-icons.git

--- VERSION-PINNED LICENSE TEXT OVERRIDE ---
MIT License

Copyright (c) 2018-present Ant UED, https://xtech.antfin.com/

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

================================================================================

Package: @antfu/install-pkg@1.1.0
Declared license: MIT
Selected license: MIT
Expand Down Expand Up @@ -13916,6 +13947,45 @@ SOFTWARE.

================================================================================

Package: simple-icons@16.28.0
Declared license: CC0-1.0
Selected license: CC0-1.0
Repository: git+ssh://git@github.com/simple-icons/simple-icons.git

--- LICENSE.md ---
# CC0 1.0 Universal

## Statement of Purpose

The laws of most jurisdictions throughout the world automatically confer exclusive Copyright and Related Rights (defined below) upon the creator and subsequent owner(s) (each and all, an “owner”) of an original work of authorship and/or a database (each, a “Work”).

Certain owners wish to permanently relinquish those rights to a Work for the purpose of contributing to a commons of creative, cultural and scientific works (“Commons”) that the public can reliably and without fear of later claims of infringement build upon, modify, incorporate in other works, reuse and redistribute as freely as possible in any form whatsoever and for any purposes, including without limitation commercial purposes. These owners may contribute to the Commons to promote the ideal of a free culture and the further production of creative, cultural and scientific works, or to gain reputation or greater distribution for their Work in part through the use and efforts of others.

For these and/or other purposes and motivations, and without any expectation of additional consideration or compensation, the person associating CC0 with a Work (the “Affirmer”), to the extent that he or she is an owner of Copyright and Related Rights in the Work, voluntarily elects to apply CC0 to the Work and publicly distribute the Work under its terms, with knowledge of his or her Copyright and Related Rights in the Work and the meaning and intended legal effect of CC0 on those rights.

1. Copyright and Related Rights. A Work made available under CC0 may be protected by copyright and related or neighboring rights (“Copyright and Related Rights”). Copyright and Related Rights include, but are not limited to, the following:
1. the right to reproduce, adapt, distribute, perform, display, communicate, and translate a Work;
2. moral rights retained by the original author(s) and/or performer(s);
3. publicity and privacy rights pertaining to a person’s image or likeness depicted in a Work;
4. rights protecting against unfair competition in regards to a Work, subject to the limitations in paragraph 4(i), below;
5. rights protecting the extraction, dissemination, use and reuse of data in a Work;
6. database rights (such as those arising under Directive 96/9/EC of the European Parliament and of the Council of 11 March 1996 on the legal protection of databases, and under any national implementation thereof, including any amended or successor version of such directive); and
7. other similar, equivalent or corresponding rights throughout the world based on applicable law or treaty, and any national implementations thereof.

2. Waiver. To the greatest extent permitted by, but not in contravention of, applicable law, Affirmer hereby overtly, fully, permanently, irrevocably and unconditionally waives, abandons, and surrenders all of Affirmer’s Copyright and Related Rights and associated claims and causes of action, whether now known or unknown (including existing as well as future claims and causes of action), in the Work (i) in all territories worldwide, (ii) for the maximum duration provided by applicable law or treaty (including future time extensions), (iii) in any current or future medium and for any number of copies, and (iv) for any purpose whatsoever, including without limitation commercial, advertising or promotional purposes (the “Waiver”). Affirmer makes the Waiver for the benefit of each member of the public at large and to the detriment of Affirmer’s heirs and successors, fully intending that such Waiver shall not be subject to revocation, rescission, cancellation, termination, or any other legal or equitable action to disrupt the quiet enjoyment of the Work by the public as contemplated by Affirmer’s express Statement of Purpose.

3. Public License Fallback. Should any part of the Waiver for any reason be judged legally invalid or ineffective under applicable law, then the Waiver shall be preserved to the maximum extent permitted taking into account Affirmer’s express Statement of Purpose. In addition, to the extent the Waiver is so judged Affirmer hereby grants to each affected person a royalty-free, non transferable, non sublicensable, non exclusive, irrevocable and unconditional license to exercise Affirmer’s Copyright and Related Rights in the Work (i) in all territories worldwide, (ii) for the maximum duration provided by applicable law or treaty (including future time extensions), (iii) in any current or future medium and for any number of copies, and (iv) for any purpose whatsoever, including without limitation commercial, advertising or promotional purposes (the “License”). The License shall be deemed effective as of the date CC0 was applied by Affirmer to the Work. Should any part of the License for any reason be judged legally invalid or ineffective under applicable law, such partial invalidity or ineffectiveness shall not invalidate the remainder of the License, and in such case Affirmer hereby affirms that he or she will not (i) exercise any of his or her remaining Copyright and Related Rights in the Work or (ii) assert any associated claims and causes of action with respect to the Work, in either case contrary to Affirmer’s express Statement of Purpose.

4. Limitations and Disclaimers.
1. No trademark or patent rights held by Affirmer are waived, abandoned, surrendered, licensed or otherwise affected by this document.
2. Affirmer offers the Work as-is and makes no representations or warranties of any kind concerning the Work, express, implied, statutory or otherwise, including without limitation warranties of title, merchantability, fitness for a particular purpose, non infringement, or the absence of latent or other defects, accuracy, or the present or absence of errors, whether or not discoverable, all to the greatest extent permissible under applicable law.
3. Affirmer disclaims responsibility for clearing rights of other persons that may apply to the Work or any use thereof, including without limitation any person’s Copyright and Related Rights in the Work. Further, Affirmer disclaims responsibility for obtaining any necessary consents, permissions or other rights required for any use of the Work.
4. Affirmer understands and acknowledges that Creative Commons is not a party to this document and has no duty or obligation with respect to this CC0 or use of the Work.

For more information, please see <https://creativecommons.org/publicdomain/zero/1.0>.

================================================================================

Package: smart-buffer@4.2.0
Declared license: MIT
Selected license: MIT
Expand Down
16 changes: 11 additions & 5 deletions apps/desktop/src/renderer/public/THIRD_PARTY_LICENSES.txt
Original file line number Diff line number Diff line change
Expand Up @@ -175,12 +175,18 @@ SOFTWARE.
## Simple Icons brand marks

- Repository: https://github.com/simple-icons/simple-icons
- Package: `simple-icons` version `15.22.0`
- License: CC0-1.0
- Covered source assets:
- `packages/ui/src/bot-brand-logo.tsx`: Telegram, Discord, WeChat, QQ and Slack paths
- `apps/desktop/src/renderer/mcp-brand-marks.tsx`: Slack, LINE, Google Calendar, Figma, Vercel, Supabase, Notion and Apple paths
- `apps/desktop/src/renderer/settings/provider-brand-marks.tsx`: MiniMax path
- Covered source assets, by how the path data reaches the build:
- Vendored from `simple-icons` version `15.22.0` as pinned path constants
(upstream later removed some of these marks, so the pins stay at the
version they were copied from):
- `packages/ui/src/bot-brand-logo.tsx`: Telegram, Discord, WeChat, QQ and Slack paths
- `apps/desktop/src/renderer/mcp-brand-marks.tsx`: Slack paths
- Imported at build time from the installed `simple-icons` package, so the
bundled version is the one package-lock.json pins; that copy is licensed
through the generated `licenses/npm/THIRD_PARTY_NOTICES.txt`:
- `apps/desktop/src/renderer/mcp-brand-marks.tsx`: LINE, Google Calendar, Figma, Vercel, Supabase, Notion and Apple paths
- `apps/desktop/src/renderer/settings/provider-brand-marks.tsx`: MiniMax path
- Full license text: packaged as `licenses/renderer/SIMPLE_ICONS_LICENSE.md`.
- Trademark boundary: CC0 does not grant trademark rights. The marks are used only to identify the corresponding services.

Expand Down
3 changes: 2 additions & 1 deletion apps/desktop/src/renderer/settings/provider-brand-marks.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,8 @@ function ZAI(): ReactElement {
return <ProviderAssetMask src={zaiMarkUrl} />;
}

// MiniMax mark from simple-icons@15.22.0 (CC0-1.0).
// MiniMax mark from the simple-icons package (CC0-1.0); the bundled version
// is whatever package-lock.json pins, so no version is repeated here.
function MiniMaxMark(): ReactElement {
return (
<svg viewBox="0 0 24 24" role="img" aria-hidden="true">
Expand Down
48 changes: 48 additions & 0 deletions apps/desktop/vite-bundled-packages.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
// Records which npm packages the renderer bundle actually contains.
//
// The module graph sees direct and deep JS imports; the emitted assets carry
// the rest of the chain, which is how a package reached only through CSS
// (Fontsource, via its `.woff2` files) still lands here. What neither sees is
// a stylesheet that imports a package of pure rules: Vite inlines a CSS
// `@import` at transform time, so the imported file never becomes a module,
// and a package whose CSS emits no `url()` asset leaves no trace in this
// record. `validateFirstPartyCssImports` in the notice generator covers that
// case by reading the stylesheets themselves — stated here because the gap is
// invisible from this file, and the check that closes it lives elsewhere.
//
// The JSON ships inside `dist-renderer`, which lets the release verifier judge
// the packaged artifact by the artifact's own record.
export function bundledNpmPackagesPlugin() {
return {
name: 'maka-bundled-npm-packages',
apply: 'build',
generateBundle(_options, bundle) {
const packages = new Set();
const collect = (id) => {
// Virtual modules (\0-prefixed) are build-tool internals, not packages.
if (typeof id !== 'string' || id.startsWith('\0')) return;
// The last node_modules segment names the package that owns the file,
// even for nested installs (node_modules/a/node_modules/b/...).
const matches = [...id.matchAll(/[\\/]node_modules[\\/]((?:@[^\\/]+[\\/])?[^\\/]+)(?=[\\/])/g)];
if (matches.length === 0) return;
const name = matches[matches.length - 1][1].replaceAll('\\', '/');
if (name === '.vite') return;
packages.add(name);
};
for (const id of this.getModuleIds()) collect(id);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

[P2] Collect the CSS pipeline's dependencies too, or weaken the claim in this file's header. getModuleIds() is described here as "the one authority that sees every way a package can enter the bundle", but a package reached only through a bare CSS @import never becomes a rollup module: Vite registers postcss @import dependencies with this.addWatchFile(file) and inlines them at transform time (confirmed in the installed vite@8.1.5 source). The asset fallback below rescues such a package only if its CSS emits a url() asset. Because validateBundledPackageRecord asserts only record ⊆ closure and never the reverse, a miss is silent. Concretely: adding a pure-rules CSS dependency — normalize.css, or an icon-font CSS using data: URIs — to apps/desktop/src/renderer/styles.css would ship its rules inside dist-renderer/assets/*.css in app.asar with no entry in THIRD_PARTY_NOTICES.txt and no failing check. That is an ASF licensing miss in a released artifact, and this PR creates the exposure: before it, such a package was a production dependency and the notice generator picked it up from the npm closure. Today's four bare CSS imports are all covered — @astryxdesign/core is also a JS import and both Fontsource packages emit .woff2 assets I confirmed are present. Vite behaviour confirmed by reading the installed source; current coverage confirmed by grep plus the emitted assets. Record the postcss dependency set from a transform hook, or scan the emitted CSS text. Regression test: a bare CSS @import of a package with no url() assets must appear in bundled-npm-packages.json.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks for adding the first-party stylesheet scan — that covers the current production imports. One small P3 parser/test blind spot remains: bareCssImportSpecifiers() does not recognize the valid unquoted form @import url(normalize.css), although Vite accepts it. There is no current use of that spelling, so this is non-blocking, but it would be helpful to include it in the existing @import spelling regression coverage.

// CSS `@import` chains are inlined by the CSS pipeline and never become
// rollup modules, but the files they pull in (fonts, images) are emitted
// as assets that remember their source paths — that is how a package
// reachable only through CSS (Fontsource) still lands in this record.
for (const output of Object.values(bundle)) {
if (output.type !== 'asset') continue;
for (const original of output.originalFileNames ?? []) collect(original);
}
this.emitFile({
type: 'asset',
fileName: 'bundled-npm-packages.json',
source: `${JSON.stringify([...packages].sort(), null, 2)}\n`,
});
},
};
}
3 changes: 2 additions & 1 deletion apps/desktop/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { fileURLToPath } from 'node:url';
import { dirname, resolve } from 'node:path';
import react from '@vitejs/plugin-react';
import { dependencyPatchesCachePlugin } from './vite-dependency-patches.js';
import { bundledNpmPackagesPlugin } from './vite-bundled-packages.js';

/**
* PR-ICONS-FULL-REPLACE-0 (WAWQAQ msg `60064e2d` 2026-06-24): point the
Expand All @@ -22,7 +23,7 @@ export default defineConfig({
// Vite hashes plugin names into its dependency-cache key. patch-package does
// not change package-lock.json, so carry the patch contents in that key while
// keeping every Astryx entry in one optimized module graph.
plugins: [react(), dependencyPatchesCachePlugin(REPO_ROOT)],
plugins: [react(), dependencyPatchesCachePlugin(REPO_ROOT), bundledNpmPackagesPlugin()],
resolve: {
dedupe: ['react', 'react-dom'],
alias: [
Expand Down
Loading