7 Commits
Author SHA1 Message Date
CatoandClaude Fable 5.1 2077bfc207 feat(auth,docs): developer page for "Sign in with OrangeCat"; passkeys (#1185)
* feat(docs): developer page for "Sign in with OrangeCat" + round-trip script

Step D9 of ADR-0009. OrangeCat has been a real OpenID Connect provider
since June and five relying parties sign people in through it, but a site
that wanted the button had the standard and nothing else.

/docs/sign-in-with-orangecat: what you get (one identity keyed by sub,
passwords optional, people can disconnect you), self-service registration
with its rules, the Auth.js config Solon/Heidi/Loki run and the by-hand
authorize/token/userinfo/refresh calls, button wording (prompt=create,
login_hint), sessions and what invalid_grant means, and every scope with
its consent-screen wording. Every URL, scope and lifetime is derived from
the provider's own config (snippets.ts), and a unit test pins the snippets
to the discovery document, so the page cannot quote an endpoint the server
does not serve.

scripts/oauth/sign-in-roundtrip.mjs registers a client, opens the sign-in,
catches the code on loopback, exchanges it with PKCE, checks iss/aud/nonce,
reads userinfo, refreshes, and proves the spent token is refused — the
same steps any relying party takes, runnable before writing a line.

Linked from /docs. ADR-0009 status updated: D1–D4 shipped, relying parties
now honour revocation (solon#203, heidi#145).

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QDMxjTqKNLXETMYYuapMa3

* fix(docs): userinfo snippet uses a shell variable for the token

gitleaks (curl-auth-header) reads 'Bearer THE_ACCESS_TOKEN' as a leaked
token; $ACCESS_TOKEN is what a person would paste anyway.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QDMxjTqKNLXETMYYuapMa3

* chore(security): allowlist the docs bearer-token placeholder for gitleaks

The developer page's userinfo example used 'Bearer THE_ACCESS_TOKEN', which
gitleaks' curl-auth-header rule reads as a leak. The tree now uses a shell
variable; the placeholder in history is allowlisted instead of rewriting it.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QDMxjTqKNLXETMYYuapMa3

* feat(auth): passkeys — add/list/remove in settings, sign in with a passkey

Step D5 of ADR-0009. The self-hosted auth server (GoTrue) supports WebAuthn
passkeys and the browser client already carries the ceremony; what was
missing was the UI, the wrapper, and the switch.

- Settings → Security → Passkeys: the person's passkeys with name, date and
  last use; "Add a passkey" (browser prompt, then named); remove.
- /auth: "Sign in with a passkey" beside the emailed code — nothing typed.
- Both are hidden until the auth server reports passkeys_enabled: true
  (lib/auth/passkeys-availability reads GoTrue's public settings, cached
  five minutes, fails closed). A button that cannot work is a dead end.
- docs/operations/passkeys.md is the switch: GOTRUE_PASSKEY_ENABLED and the
  relying-party id/origins, with why the id is orangecat.ch and not the
  API host. scripts/auth/passkeys-e2e.mjs drives add → sign in → remove
  with Chromium's virtual authenticator and exits 2 while the switch is off.

services/supabase/auth/passkeys.ts wraps registerPasskey / passkey.list /
update / delete / signInWithPasskey in the auth service's shape; a passkey
is named in a second call and a failed rename still returns a working key.
Unit tests cover the availability parser and the wrappers.

Also: the two CLI scripts under scripts/ carry the no-console pragma their
siblings use.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QDMxjTqKNLXETMYYuapMa3

* fix(scripts): throwaway inbox password from crypto.randomBytes

CodeQL (js/insecure-randomness) flags Math.random() for a password, even
a disposable one; the real generator costs nothing.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QDMxjTqKNLXETMYYuapMa3

---------

Co-authored-by: Claude <noreply@anthropic.com>
2026-09-29 02:45:52 -07:00
Georgy ButaevandClaude Opus 4.8 a52836c793 chore: remove all Vercel — everything runs on Hetzner
Production is fully self-hosted on the Hetzner box (bitbaum, behind Caddy)
with self-hosted Supabase. This scrubs the remaining Vercel footprint:

Code (src/ now has zero Vercel references):
- security page: "Hosted on Vercel" → self-hosted infrastructure
- FleetCrown URL fleetcrown.vercel.app → fleetcrown.orangecat.ch (entity
  registry + external-publish allowlist; the dead vercel.app subdomain was
  also a re-registration risk in an allowlist)
- webhook-secret error + cron/env comments point at the box, not Vercel
- corrected stale "Vercel kills the function on response" comments (false
  on a persistent server) to accurate await-before-respond reasoning

Security/config:
- supabase/config.toml: dropped dead *.vercel.app auth redirect URLs
- @vercel/mcp-adapter dependency removed (unused)

Artifacts removed:
- scripts/auth/vercel-login.js, scripts/preview-url.sh,
  scripts/dev/merge-env.js, scripts/monitoring/deployment-monitor.js,
  scripts/db/setup-env.js, mcp-servers/vercel-openapi.json, .vercel/
- setup_vercel_secrets MCP tool in mcp-servers/github-server.js
- .gitignore Vercel section; env scripts stripped of vercel-login/token

Docs + .claude rules/commands rewritten to the self-host deploy flow
(scripts/deploy-selfhost.sh / .github/workflows/cd.yml; env at
/opt/orangecat/app/.env). Historical/archive records left intact.

Verified: tsc 0 errors, SELF_HOST=1 build green, cron unit tests pass.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-23 08:50:43 +02:00
Your Name 1b2a2371e9 refactor: Complete codebase improvements per engineering principles
- Fix currency defaults (SATS → CHF) across forms, configs, and API routes
- Remove @ts-nocheck from socialService.ts and improve type safety
- Replace console.log statements with proper logger utility in production code
- Additional type safety improvements and code quality enhancements
- Documentation updates for improved maintainability

All changes follow DRY, SSOT, and separation of concerns principles.
2026-01-04 12:25:26 +01:00
Your Name a1b3aba810 fix: TypeScript errors in messaging service, profile hooks, and core types
- Fixed messaging service Supabase insert/update type errors
- Fixed profile hooks (useProfileForm, useAuth, useActiveRoute, useMobileMenu)
- Added missing type exports (UserProduct, UserService, UserCause, Profile with email)
- Fixed messaging API route type errors
- Updated Database types for proper Supabase type safety

Note: Some TypeScript errors remain in non-critical areas (commerce, entity configs, tests) but core messaging and profile functionality is type-safe.
2025-12-22 15:38:36 +01:00
Your Name 38cc4669d8 chore: comprehensive codebase cleanup and organization
- Move 100+ files from root to proper directories
  - Migration scripts → scripts/db/
  - SQL files → supabase/sql/archive/
  - Test/debug scripts → scripts/test/
  - Documentation → docs/archive/ (organized by category)
  - Shell scripts → scripts/ (organized by category)

- Fix test organization
  - Remove nested tests/unit/tests/unit/ structure
  - Consolidate test files to proper locations

- Update documentation references
  - Update migration script paths in workflow docs
  - Update scripts/README.md with moved file notes

- Delete placeholder files
  - Remove empty placeholder.ipynb

- Result: Root directory now contains only essential config files
- Result: Professional, organized codebase structure
- Result: All files in proper locations per project standards

See docs/CLEANUP_COMPLETE.md for full details.
2025-12-21 22:57:54 +01:00
Your Name bc63b2262a feat: setup GitHub + Vercel automatic deployment
- Add CI workflow for automated checks (lint, test, type-check)
- Configure Vercel GitHub integration
- Add deployment monitoring and setup scripts
- Update deployment documentation
- Fix .env.local protection (preserve existing variables)
- Add restore script for missing env variables
2025-12-12 16:45:15 +01:00
Your Name 94bfe613b6 chore: deploy local snapshot
Commit current local state for production deploy.
2025-12-10 16:56:40 +01:00