Skip to content

fix: secure dev-server file access and refresh tutorial tooling - #380

Merged
petermuessig merged 2 commits into
mainfrom
fix/dev-server-containment-and-tooling
Nov 17, 2026
Merged

petermuessig merged 2 commits into
mainfrom
fix/dev-server-containment-and-tooling

Conversation

@petermuessig

Copy link
Copy Markdown
Contributor

Summary

Prevent filesystem traversal in the tutorial preview server, make network sharing an explicit opt-in, and refresh development tooling across the runnable tutorial workspaces without updating OpenUI5.

Why

The dev server previously joined the raw request URL to the repository directory and served any existing file. Clients that preserve ../ segments could escape the checkout and read files accessible to the developer account. Express and BrowserSync also listened on network interfaces by default.

Dev-server changes

  • Decode request paths once and reject parent-directory segments, Windows-style separators, null bytes, and malformed URL encoding before file-serving routes run.
  • Resolve targets against the checkout and check both lexical containment and canonical symlink targets before reading or serving content.
  • Apply the same boundary to built artifacts, dependencies, markdown directory indexes, breadcrumbs, and tutorial metadata.
  • Use a fixed root for file responses and disable unchecked implicit dependency-directory index lookup.
  • Return plain rejection responses instead of exposing filesystem paths or stack traces; escape requested paths in the missing-build hint page.
  • Bind Express and BrowserSync's proxy/UI to 127.0.0.1 by default.
  • Add --host <address> and --help, including IPv4/IPv6 support and a warning for network-visible bindings.
  • Preserve the upstream language-toggle behavior for documentation-only tutorials, with containment checks on their steps.json reads.
  • Add a Node test suite and run it before workspace typechecks through npm test.

Trusted-network preview remains available explicitly:

npm start -- --host 0.0.0.0

Network mode is still unauthenticated and exposes checkout files and the BrowserSync UI. It is intended only for trusted development networks, not public hosting.

Tutorial dependency updates

Update declarations consistently across all 84 runnable tutorial steps and regenerate the npm lockfile:

Dependency Previous declaration New declaration
@ui5/cli ^4.0.53 ^4.0.73
ui5-middleware-livereload ^3.3.1 ^3.4.0
ui5-middleware-serveframework ^3.8.1 ^3.8.2
ui5-middleware-simpleproxy ^3.7.1 ^3.9.0
ui5-tooling-transpile ^3.11.0 ^3.14.1
local-web-server ^5.4.0 ^5.4.2
@types/qunit 2.5.4 2.19.14

Unchanged: OpenUI5 runtime and @openui5/types remain at 1.148.10; TypeScript remains at 6.0.3; the interface generator remains at 0.12.0. The repository remains npm-only. Root dependency updates and pnpm lockfile removal are already on main and are not duplicated here.

Validation

Validated on Node.js 24.14.0:

  • Clean cached npm installation: npm ci --offline --ignore-scripts --no-audit --no-fund.
  • npm test: 54 dev-server tests and 83 workspace typechecks passed.
  • npm run lint:lockfile and git diff --check passed.
  • Final-step application builds passed for Quickstart 03, Walkthrough 38, Data Binding 15, Navigation 17, and OData V4 11 using the installed UI5 CLI.
  • Regression coverage includes raw/encoded traversal, symlink escapes, metadata reads, malformed paths, normal previews/assets/downloads, and default/explicit listener configuration.
  • Confirmed OpenUI5 lock entries are unchanged.

Build limitation: the full site build timed out locally during an npx invocation. Direct UI5 CLI builds passed; the existing PR workflow will run the complete site build in CI.

Commits

  1. fix: prevent dev-server filesystem traversal
  2. build: refresh tutorial tooling without changing OpenUI5

Validate decoded request targets and canonical filesystem paths before serving checkout content, including symlink targets and tutorial metadata.

Bind Express and BrowserSync to loopback by default, provide an explicit --host option for trusted-network previews, and add regression tests and documentation.
Update UI5 CLI, development middleware, transpilation tooling, local-web-server, and QUnit type declarations consistently across all 84 runnable tutorial steps.

Keep OpenUI5 runtime/types at 1.148.10 and TypeScript at 6.0.3, and regenerate the npm workspace lockfile.

@margopolo margopolo left a comment

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.

LGTM

@petermuessig
petermuessig merged commit b14565e into main Nov 17, 2026
3 checks passed
@petermuessig
petermuessig deleted the fix/dev-server-containment-and-tooling branch November 17, 2026 15:39
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.

2 participants