Files
Willie 70aedcddde build(ui): upgrade Vite to 8.3.8 and keep dev ports on loopback (#959)
Vite 8.3.0 to 8.3.6 is affected by GHSA-p4f5-76q4-ffq7: a request to a
network-exposed dev server can inject code through the
__vite-browser-external virtual module, read files outside server.fs, and
run code on the server. The dashboard dev server ran 8.3.1, and the
devcontainer published its port on every host interface, so other machines
on the network could reach it. The advisory PoC read a file the dev server
had refused on 8.3.1 and is refused on 8.3.8, which pulls in the patched
Rolldown 1.2.19.

The devcontainer now publishes Vite, the API and Docusaurus on 127.0.0.1
only. These are development servers and nothing uses them from another
machine. Released builds serve the prebuilt dashboard from the Go binary
and never run the Vite dev server, so users are not affected.
2026-11-19 04:35:28 +08:00

52 lines
2.0 KiB
YAML

# Devcontainer-only service: no profile restriction, stays alive for VS Code attach.
# Reuses the same Dockerfile and volume setup as sandbox-dev.
name: skillshare_devcontainer
services:
skillshare-devcontainer:
build:
context: ..
dockerfile: docker/sandbox/Dockerfile
working_dir: /workspace
command: sleep infinity
environment:
HOME: /home/developer
# virtiofs doesn't reliably deliver inotify events, so Vite/Docusaurus
# miss file saves. Force polling-based file watching inside the container.
CHOKIDAR_USEPOLLING: "true"
# `docker exec -it` sets TERM=xterm only, which reads as a 16-color
# terminal; the CLI's colors (and init's logo) need truecolor.
COLORTERM: truecolor
GOCACHE: /go/build-cache
SKILLSHARE_API_PORT: "49420"
GITHUB_TOKEN: ${GITHUB_TOKEN:-}
GITLAB_TOKEN: ${GITLAB_TOKEN:-}
BITBUCKET_TOKEN: ${BITBUCKET_TOKEN:-}
BITBUCKET_USERNAME: ${BITBUCKET_USERNAME:-}
SKILLSHARE_GIT_TOKEN: ${SKILLSHARE_GIT_TOKEN:-}
# Uncommon ports: 5173/8888/19420 clash with whatever else is running on the host.
# Publish on host loopback only: the dev servers are not hardened for the
# network. Inside the container they still bind 0.0.0.0, which publishing needs.
ports:
- "127.0.0.1:45173:45173"
- "127.0.0.1:49420:49420"
- "127.0.0.1:48888:48888"
volumes:
- ..:/workspace
# Container-local node_modules (anonymous volumes) so platform-native
# bindings (e.g. @rolldown/binding-linux-*) are installed inside the
# container instead of inheriting the host's darwin bindings via the
# virtiofs bind mount above. Without this, vite 8 / rolldown fails to load.
- /workspace/ui/node_modules
- /workspace/website/node_modules
- go-mod-cache:/go/pkg/mod
- go-build-cache:/go/build-cache
- dev-home:/home/developer
security_opt:
- no-new-privileges:true
volumes:
go-mod-cache:
go-build-cache:
dev-home: