Skip to content

fix: address high-priority server, SSR, and adapter defects - #968

Merged
domgan-oai merged 3 commits into
octanejs:mainfrom
openai-oss-forks:fix/high-priority-audit-967
Sep 5, 2026
Merged

domgan-oai merged 3 commits into
octanejs:mainfrom
openai-oss-forks:fix/high-priority-audit-967

Conversation

@domgan-oai

@domgan-oai domgan-oai commented Sep 5, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Return generic production API errors while retaining server-side diagnostics, and restrict the built-in Node static server to its configured canonical asset tree.
  • Settle readable SSR streams when user callbacks throw, finalize injected sources on early terminal paths, and preserve injected HTML under backpressure.
  • Prove imported descriptorChildren markers through Rspack's source graph, including explicit re-exports, so Rspack and Rsbuild builds deliver inspectable children.

Why

Addresses the five highest-priority findings in #967 on one branch. The broader audit tracker remains open for the other correctness and performance findings.

Changes

  • Add app-core HTTP regressions for outside file/directory symlinks, static-root retargeting, a missing root at boot, a path replaced after verification, and sensitive exception text.
  • Add web and Node SSR regressions for injection ordering, external abort, document-tail retention, stream cancellation, and callback settlement across shell and allReady paths.
  • Add client/server Rspack bundles and routed Rsbuild regression coverage for direct and explicitly re-exported descriptor markers, including default-export barrels, plus invalidation and cycle controls.
  • Add patch changesets for @octanejs/app-core, octane, and @octanejs/rspack-plugin.

Validation

  • pnpm format:check
  • pnpm typecheck
  • pnpm test
  • pnpm sync
  • Node 24 focused changed-file suite: 205 tests across 8 test projects
  • App-core targeted suite: 131 tests
  • Octane SSR targeted dev and prod suites: 276 tests
  • Rspack package targeted suite: 157 tests
  • Rsbuild production routed client/server integration
  • pnpm changeset:check
  • Full CI on merged main commit 1f19beb0 (run)

The unsharded local pnpm test run on Node 26.4.0 reached Vitest's 4 GB heap limit and exited with V8 OOM after unrelated package failures. On the repository's supported Node 24 line, isolated Jotai and resizable-panels cases that failed under Node 26 passed (10/10 and 6/6). An isolated email preview watcher case remained failing on both Node versions with untouched source. The PR run was cancelled by the merge after all four Node 24 test shards passed. The merged-main CI run passed every lane, including Chromium integration and CI provenance.

Risk / follow-ups

  • Static containment assumes the built asset tree cannot be changed by an untrusted actor during a request; portable Node APIs cannot atomically anchor each ancestor lookup. Local warm built-in HTTP HEAD probes indicated roughly 1.4–1.6× latency versus the previous implementation for a tiny file. These timings are directional and do not measure production throughput.
  • Descriptor proof adds build-time resolution for imported uppercase component tags; it does not add a runtime helper. A warm neutral-compiler probe saw 36.9→50.0 ms per 100 ordinary imported-component transforms, with byte-identical output; three-file marked barrels averaged 28.3 ms for 100 importers. This is build-time overhead, not an end-to-end build estimate. export * barrels remain an existing limitation shared with Vite's proof.
  • Isolated Rsbuild dev-watch hot-rebuild testing hit Watchpack EMFILE even with the original fixture and the descriptor preflight disabled. Production routed client/server integration passed.
  • The no-injection SSR path adds no per-node allocation. Production streaming benchmarks preserved output and chunk counts; concurrent workload made timing inconclusive.

Provenance

  • An agent produced this diff (agent-authored)

View with [code]smith Autofix with [code]smith
Need help on this PR? Tag @codesmith-bot with what you need. Autofix is disabled.


Note

High Risk
Changes touch security-sensitive static path serving and production API error responses, plus substantial streaming SSR settlement logic on the hot request path.

Overview
Hardens production defaults and fixes several high-priority server, SSR, and bundler edge cases called out in the audit.

Production HTTP and API: Thrown API route failures now always return a generic { error: 'Internal Server Error' } JSON body while the full exception stays in server logs. The built-in Node static server pins the asset root at startup with realpath, rejects resolved paths outside that tree (including symlink escapes and retargeted roots), and serves from an opened read-only file descriptor so a path swap after verification cannot change the bytes streamed.

Streaming SSR: Injected HTML handling gains recovery/backpressure semantics (onUnaccepted, 'recovery' writes) so notified fragments, document tails, and terminal salvage still land in order when readers start late, consumers abort, or Node accepts bytes under pressure. User hooks (onShellReady, onError, etc.) that throw now deterministically reject shell/allReady promises instead of leaving streams pending, and injection sources are finalized on early shell failures.

Rspack / compiler: findDescriptorChildrenImports follows default re-exports through barrels. A new Rspack pre-transform loader resolves and proves descriptorChildren markers (including chained re-exports) and passes that into the Octane compiler so client and server bundles treat imported slot components correctly; Rsbuild integration coverage exercises the same path.

Reviewed by Cursor Bugbot for commit 714c92d. Bugbot is set up for automated code reviews on this repo. Configure here.

@domgan-oai
domgan-oai marked this pull request as ready for review September 5, 2026 22:25
@github-actions github-actions Bot added agent-authored Diff or issue body substantially produced by an AI agent fix PR: bug fix labels Sep 5, 2026
@domgan-oai domgan-oai changed the title fix: harden server and streaming SSR boundaries fix: address high-priority server, SSR, and adapter defects Sep 5, 2026

@cursor cursor 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.

Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.

Fix All in Cursor

Bugbot Autofix is ON, but it could not run because the branch was deleted or merged before autofix could start.

Reviewed by Cursor Bugbot for commit 93cab37. Configure here.

Comment thread packages/octane/src/runtime.server.ts Resolved
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agent-authored Diff or issue body substantially produced by an AI agent fix PR: bug fix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant