Skip to content

chore: CSP headers, chunking, AGENTS.md and pinned workflows from #34 - #58

Open
Jozkah wants to merge 4 commits into
CNCKitchen:mainfrom
Jozkah:review/infra-docs
Open

Jozkah wants to merge 4 commits into
CNCKitchen:mainfrom
Jozkah:review/infra-docs

Conversation

@Jozkah

@Jozkah Jozkah commented Nov 1, 2026

Copy link
Copy Markdown
Contributor

The infra and docs items from #34, rebased on 0.9.3, one commit each:

  • ci: pin workflow actions and harden license and release jobs
  • docs: add AGENTS.md for coding agents
  • build: split three.js and react into their own chunks
  • feat: send a Content-Security-Policy and security headers

Notes:

  • CSP. public/_headers sends a policy with script-src 'self' 'wasm-unsafe-eval', connect-src for https and the local agent ports, and frame-ancestors 'none', plus nosniff and the referrer policy. The OCCT kernel's bindings use new Function, so the two kernel worker paths get 'unsafe-eval'; the page keeps the strict policy. The inline theme script moved to public/theme.js. I tested it against the built app with the headers applied by a local server: import, the agent link, exports and the kernel all worked with no violations. Worth checking on a preview deploy: the mid-name * match on the worker paths, and that ! Content-Security-Policy replaces the base policy.
  • Chunks. three.js and React now load as their own chunks, taking the main chunk from about 3.5 MB to 2.8 MB. The first-load total is the same; the library chunks stay cached across releases.
  • Workflows. Actions are pinned to commit SHAs with the tag noted, and the license job gets permissions, concurrency and a timeout. What CI runs is unchanged.
  • Skipped: the real-scan fixtures, which would need publishing somewhere CI can fetch them.

Build: npm run build passes. npm test (3094), npm --prefix mcp test (127), the plugin boundary and units checks, and npm run e2e:ci all pass.

Actions are pinned to commit SHAs with the tag kept as a comment, so a moved tag cannot change what runs. The license check gets a read-only token, a concurrency group and a timeout, and pins license-checker to 25.0.1 so the gate is deterministic. Release runs are serialised. What each workflow runs is unchanged.
Summarises setup including the mcp package, the commands CI runs, the plugin boundary, display-units and license rules, and the style notes from CONTRIBUTING and the development guide.
The main chunk drops from 3522 kB to 2769 kB minified; three and three-mesh-bvh (632 kB) and react, react-dom and zustand (195 kB) now load as separate chunks that stay cached across app releases. Total bytes on first load are unchanged. Lazy-loading workspaces was left out because it touches the plugin registry and app shell.
public/_headers gives every static asset a CSP plus nosniff, a referrer policy and frame denial. The page allows its own scripts with wasm-unsafe-eval for the WebAssembly workers, https fetches for the file store and open links, and loopback http and WebSocket for the agent link. The CAD kernel workers alone also get unsafe-eval because the occt-wasm bindings are built with new Function. The theme bootstrap moves from an inline script to public/theme.js so the policy needs no inline-script allowance. Checked by serving the built dist with these headers and running the production smoke, agent and Reverse engineer kernel checks in headless Chrome with no CSP violations.

This branch has not been deployed

No deployments
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.

1 participant