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
5 changes: 5 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,11 @@ jobs:
- name: Build service
run: bun run build

- name: Verify patched dependency compatibility under Node and Bun
run: |
node --test scripts/dependency-compat.test.cjs
bun test scripts/dependency-compat.test.cjs

- name: Bun tests
run: bun run test

Expand Down
2 changes: 2 additions & 0 deletions docker/Dockerfile.worker-sandbox
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ RUN chmod +x /package-init.sh && FORCE_REBUILD=true /package-init.sh
FROM oven/bun:1.4.4 AS worker-builder
WORKDIR /app
COPY service/package.json service/bun.lock ./
COPY service/patches ./patches
RUN bun install --frozen-lockfile
COPY service/src ./src
COPY packages/code/src /packages/code/src
Expand Down Expand Up @@ -263,6 +264,7 @@ RUN chmod +x /usr/local/bin/launcher-entrypoint.sh /usr/local/bin/start-direct-s
# --- Worker ---
WORKDIR /worker
COPY service/package.json service/bun.lock ./
COPY service/patches ./patches
RUN bun install --frozen-lockfile --production
COPY --from=worker-builder /app/.build ./.build
COPY --from=worker-builder /app/src ./src
Expand Down
2 changes: 2 additions & 0 deletions service/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,12 @@ WORKDIR /app
FROM base AS install
RUN mkdir -p /temp/dev
COPY service/package.json service/bun.lock /temp/dev/
COPY service/patches /temp/dev/patches
RUN cd /temp/dev && bun install --frozen-lockfile

RUN mkdir -p /temp/prod
COPY service/package.json service/bun.lock /temp/prod/
COPY service/patches /temp/prod/patches
RUN cd /temp/prod && bun install --frozen-lockfile --production

# Build all entry points
Expand Down
2 changes: 2 additions & 0 deletions service/Dockerfile.api
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,12 @@ WORKDIR /app
FROM base AS install
RUN mkdir -p /temp/dev
COPY service/package.json service/bun.lock /temp/dev/
COPY service/patches /temp/dev/patches
RUN cd /temp/dev && bun install --frozen-lockfile

RUN mkdir -p /temp/prod
COPY service/package.json service/bun.lock /temp/prod/
COPY service/patches /temp/prod/patches
RUN cd /temp/prod && bun install --frozen-lockfile --production

# Build the API server
Expand Down
6 changes: 4 additions & 2 deletions service/Dockerfile.bun
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,14 @@ WORKDIR /usr/src/app
# Install dependencies
FROM base AS install
RUN mkdir -p /temp/dev
COPY service/package.json /temp/dev/
COPY service/package.json service/bun.lock /temp/dev/
COPY service/patches /temp/dev/patches
RUN cd /temp/dev && bun install --frozen-lockfile

# Install production dependencies
RUN mkdir -p /temp/prod
COPY service/package.json /temp/prod/
COPY service/package.json service/bun.lock /temp/prod/
COPY service/patches /temp/prod/patches
RUN cd /temp/prod && bun install --frozen-lockfile --production

# Build stage
Expand Down
2 changes: 2 additions & 0 deletions service/Dockerfile.egress-gateway
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,12 @@ WORKDIR /app
FROM base AS install
RUN mkdir -p /temp/dev
COPY service/package.json service/bun.lock /temp/dev/
COPY service/patches /temp/dev/patches
RUN cd /temp/dev && bun install --frozen-lockfile

RUN mkdir -p /temp/prod
COPY service/package.json service/bun.lock /temp/prod/
COPY service/patches /temp/prod/patches
RUN cd /temp/prod && bun install --frozen-lockfile --production

FROM oven/bun:1.4.4 AS production
Expand Down
2 changes: 2 additions & 0 deletions service/Dockerfile.local
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,12 @@ WORKDIR /app
FROM base AS install
RUN mkdir -p /temp/dev
COPY service/package.json service/bun.lock /temp/dev/
COPY service/patches /temp/dev/patches
RUN cd /temp/dev && bun install --frozen-lockfile

RUN mkdir -p /temp/prod
COPY service/package.json service/bun.lock /temp/prod/
COPY service/patches /temp/prod/patches
RUN cd /temp/prod && bun install --frozen-lockfile --production

# Build the local API
Expand Down
13 changes: 9 additions & 4 deletions service/Dockerfile.node
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
# Base stage for shared steps
FROM oven/bun:1.4.4 AS dependency-tool
FROM node:22.23.4-slim AS base
COPY --from=dependency-tool /usr/local/bin/bun /usr/local/bin/bun
WORKDIR /app
COPY service/package*.json ./
RUN npm ci
COPY service/package.json service/bun.lock ./
COPY service/patches ./patches
RUN bun install --frozen-lockfile

# Build stage
FROM base AS builder
Expand All @@ -14,10 +17,12 @@ RUN npx tsc -p tsconfig.json

# Production stage
FROM node:22.23.4-slim AS production
COPY --from=dependency-tool /usr/local/bin/bun /usr/local/bin/bun
ENV NODE_ENV=production
WORKDIR /app
COPY service/package*.json ./
RUN npm ci --only=production
COPY service/package.json service/bun.lock ./
COPY service/patches ./patches
RUN bun install --frozen-lockfile --production
COPY --from=builder /app/.build ./.build
EXPOSE 3000
CMD ["node", ".build/file-server.js"]
Expand Down
2 changes: 2 additions & 0 deletions service/Dockerfile.service
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,12 @@ WORKDIR /usr/src/app
FROM base AS install
RUN mkdir -p /temp/dev
COPY service/package.json service/bun.lock /temp/dev/
COPY service/patches /temp/dev/patches
RUN cd /temp/dev && bun install --frozen-lockfile

RUN mkdir -p /temp/prod
COPY service/package.json service/bun.lock /temp/prod/
COPY service/patches /temp/prod/patches
RUN cd /temp/prod && bun install --frozen-lockfile --production

# Build stage
Expand Down
2 changes: 2 additions & 0 deletions service/Dockerfile.tool-call-server
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,12 @@ WORKDIR /app
FROM base AS install
RUN mkdir -p /temp/dev
COPY service/package.json service/bun.lock /temp/dev/
COPY service/patches /temp/dev/patches
RUN cd /temp/dev && bun install --frozen-lockfile

RUN mkdir -p /temp/prod
COPY service/package.json service/bun.lock /temp/prod/
COPY service/patches /temp/prod/patches
RUN cd /temp/prod && bun install --frozen-lockfile --production

# Production stage
Expand Down
2 changes: 2 additions & 0 deletions service/Dockerfile.worker
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,12 @@ WORKDIR /app
FROM base AS install
RUN mkdir -p /temp/dev
COPY service/package.json service/bun.lock /temp/dev/
COPY service/patches /temp/dev/patches
RUN cd /temp/dev && bun install --frozen-lockfile

RUN mkdir -p /temp/prod
COPY service/package.json service/bun.lock /temp/prod/
COPY service/patches /temp/prod/patches
RUN cd /temp/prod && bun install --frozen-lockfile --production

# Build the worker server
Expand Down
29 changes: 18 additions & 11 deletions service/bun.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 12 additions & 1 deletion service/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,20 @@
"typescript": "^5.5.4"
},
"overrides": {
"@types/minimatch": "5.1.2",
"@typescript-eslint/typescript-estree": {
"minimatch": "11.0.1"
},
"decode-uri-component": "0.5.1",
"uuid": "11.1.1",
"qs": "6.16.1",
"proxy-addr": "2.0.8"
"proxy-addr": "2.0.8",
"minio": {
"stream-json": "3.9.0"
}
},
"patchedDependencies": {
"deepmerge@4.3.1": "patches/deepmerge@4.3.1.patch",
"minio@8.0.7": "patches/minio@8.0.7.patch"
Comment thread
danny-avila marked this conversation as resolved.
Resolved
}
}
39 changes: 39 additions & 0 deletions service/patches/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# Dependency security patches

Install with Bun 1.4.4 and the committed lockfile. The service Dockerfiles copy
this directory before installing dependencies so development, build, and
production installs apply the same patches. Do not replace these installs with
`npm install`: npm does not apply Bun's `patchedDependencies`.

## deepmerge 4.3.1

[GHSA-gcqx-w48m-w2h4](https://github.com/advisories/GHSA-gcqx-w48m-w2h4)
has no patched release. The Rollup resolver brings in this build dependency.
The patch defines destination keys as own data properties instead of invoking
inherited setters, including `__proto__`. It covers the source and both shipped
CommonJS/UMD builds while retaining normal objects, recursive merges, symbols,
and concatenated arrays.

`bun audit` still reports the original version. This warning is not suppressed;
remove the patch only after adopting and testing a fixed upstream release.
Regression tests are in `src/dependency-security.test.ts`.

## MinIO 8.0.7 / stream-json 3.9.0

MinIO still requests stream-json 1.x. The scoped override installs patched
stream-json 3.9.0; the MinIO patch adapts its sole parser call site to the new
lowercase module path and Node stream adapter. Both the CommonJS and ESM builds
are patched, together with the TypeScript source. A version override alone would
break MinIO imports and notification parsing.

`scripts/dependency-compat.test.cjs` checks both MinIO builds under Node and Bun,
including split UTF-8 records and malformed JSON. Existing MinIO upload and
listing tests cover the storage operations used by the service. Remove the
patch and override after MinIO ships a compatible patched parser dependency.

## minimatch

Only typescript-estree's minimatch dependency is upgraded to 11.0.1. Older
ESLint/glob callers retain the compatible callable v3 API. The deprecated
`@types/minimatch` stub is replaced with 5.1.2, which provides declarations
without installing an unnecessary runtime minimatch dependency.
Loading
Loading