Skip to content

Security hardening: reference backend, marketing site, bench VM#37

Merged
matejcsok-ee merged 3 commits into
mainfrom
security-audit
Jul 16, 2026
Merged

Security hardening: reference backend, marketing site, bench VM#37
matejcsok-ee merged 3 commits into
mainfrom
security-audit

Conversation

@matejcsok-ee

Copy link
Copy Markdown
Contributor

Security hardening pass

Three focused hardening changes, each with tests:

  • Reference backend (web/backend): bound the write surface — a 5 MiB body cap (413 over it), per-owner library and per-lib item quotas (400/429), bind to 127.0.0.1 by default (opt into off-box via HOST), and force CORS credentials off when the origin is a wildcard. main() is refactored into an exported buildApp() so it can be driven via Fastify app.inject(); adds web/backend/test/security.test.ts.
  • Marketing site (site): the gerber-demo boot script now honors the ?base=/?cdn=/?tag= script-source overrides only on a loopback hostname (a shipped page ignores them), and /api/waitlist gains a best-effort per-IP/per-address rate limit plus address masking in the no-key log line. Adds vitest to the site (test/boot-overrides.test.ts under happy-dom, test/waitlist.test.ts).
  • Bench VM (scripts/bench): the cloud-init seed now uses SSH key auth only — the committed console/SSH password and password auth are removed (lock_passwd: true, ssh_pwauth: false); setup-vm.sh already injects the operator's pubkey.

All new tests pass locally (backend via pnpm --filter @pcbjam/backend-example test, site via npm test).

🤖 Generated with Claude Code

matejcsok-ee and others added 3 commits July 16, 2026 12:46
The @pcbjam/backend-example server had a 1 GiB body limit, no per-owner/per-lib
quotas, bound to 0.0.0.0, and reflected any origin with credentials when
CORS_ORIGIN is *. Bound the write surface (5 MiB body cap, per-owner lib and
per-lib item quotas), bind 127.0.0.1 by default (opt in via HOST), and force
credentials off for a wildcard CORS origin. Refactor main() into an exported
buildApp() and add web/backend/test/security.test.ts (inject-based).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…aitlist

- gerber-demo/boot.js honors the base/cdn/tag script-source overrides only on a
  loopback hostname, so a shipped page ignores them.
- /api/waitlist gains a best-effort per-IP/per-address rate limit and masks the
  submitter address in the no-key log line.
Adds vitest to the site: test/boot-overrides.test.ts (happy-dom) and
test/waitlist.test.ts.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The wasm-opt bench VM cloud-init seed carried a committed console/SSH password
and enabled SSH password auth. setup-vm.sh already requires and injects an SSH
pubkey, so lock the password (lock_passwd: true) and disable SSH password auth
(ssh_pwauth: false).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@vercel

vercel Bot commented Jul 16, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
pcbjam Ready Ready Preview, Comment Jul 16, 2026 10:52am

Request Review

@matejcsok-ee
matejcsok-ee merged commit f8ab901 into main Jul 16, 2026
3 checks passed
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