Commit graph

11 commits

Author SHA1 Message Date
ZTatman
442261f403 fix(web): mypy fixes, Starlette exception handler, disable CTA without PAT
- Fix return type annotations to use Response for TemplateResponse returns
- Fix db.scalar nullability with `or 0` for mypy
- Catch StarletteHTTPException for 404/405 error page rendering
- Disable "Create share link" button when PAT not registered
- Formatter/linter cleanup

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-06-05 11:19:36 -04:00
ZTatman
18897362df fix(web): security hardening, rename cleanup, and error pages
- Move TOKEN_ENCRYPTION_KEY from DB to env var (no longer stored alongside encrypted data)
- Add one-time setup token printed to server logs to prevent anonymous setup takeover
- Setup token persists until first successful login, allowing config retries
- Remove setup_complete flag in favor of app_settings nullability check
- Fix stale Myst→Firebreak references in crypto.py, dev.sh, pyproject.toml
- Add dynamic OAuth callback URL in setup wizard
- Fix global heading color override to use foreground instead of danger
- Add aria-label to brand link for accessibility
- Remove forced redirect to /settings after first login
- Remove reconfigure link from landing page
- Add styled error page with HTML/JSON content negotiation
- Add 401 guard dog easter egg

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-06-05 00:27:51 -04:00
ZTatman
8e56a5bb1c feat(web): setup wizard, settings page, and Myst → Firebreak rename
Replace manual .env configuration with a browser-based setup wizard.
New users deploy with `docker compose up` and configure Forgejo OAuth
credentials through /setup on first visit. Existing users can
reconfigure via the same page (auth-gated post-setup).

Key changes:

Rename (Myst → Firebreak):
- Config fields, env vars, session cookie, templates, docker-compose,
  README all renamed from Myst to Firebreak

Setup wizard (/setup):
- New AppSettings single-row DB table stores Forgejo config
- Auto-generates Fernet encryption key on first setup
- SetupRequiredMiddleware redirects all routes to /setup pre-config
- Reconfigure mode pre-fills existing values, requires auth
- Landing page links to /setup for recovery if OAuth breaks

Settings page (/settings):
- PAT registration moved out of dashboard into dedicated page
- Token card with registration date, delete, and update actions
- Dashboard shows CTA linking to settings when no PAT registered

Auth updates:
- Routes use AppSettings from DB instead of env-based Settings
- OAuth callback redirects new users to /settings for PAT setup
- Forgejo API errors no longer leak upstream response bodies
- Decrypt failures return actionable 503 instead of unhandled 500

Code quality:
- Extracted templating.py to eliminate circular import hacks
- AppSettings.get_fernet() caches Fernet cipher instance
- User.has_pat property replaces scattered None checks
- lookup_session promoted to public API
- Dead code removed, return type annotations added
- PAT input fields use type="password"
- CSRF gap documented in agents.md for future addressing

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-06-03 11:15:44 -04:00
ZTatman
abcde0ac2a feat(web): refine auth cleanup and PAT settings 2026-05-29 15:03:58 -04:00
74a0d0dbb7
feat(web): OAuth CSRF protection, refactor, and cleanup (#11) 2026-05-15 15:18:52 -04:00
e27a9d7e7d
Add FastAPI web service with async SQLAlchemy and Docker (#10) 2026-04-24 16:03:54 -04:00
40ffb1553c
simplify: reduce CLI config to just Forgejo URL and PAT (#8) 2026-04-18 13:30:17 -04:00
39fadc8048
refactor(cli): restructure CLI with new command router and merge verify/doctor (#7) 2026-04-13 14:29:29 -04:00
ee85b079ad
Phase 1: CLI init skeleton and deployment plan (#5)
* Add CLI scaffold and config generators

* Add PR stacking note to README

* refactor: write embargo init command myself for clarity

* refactor: rename Myst and narrow CLI setup flow

* Update Phase 1 plans with finalized design decisions

Major updates:
- Add authentication model (Forgejo sessions for identity, PAT for data access)
- Add link types (private email-verified, public time-expired)
- Add link creation rules (owner-only)
- Add Docker/deployment guidance (Dockerfile only, Dokploy handles orchestration)
- Add database model (separate DBs on same PostgreSQL instance)
- Add viewer baseline and user dashboard sections
- Add SMTP configuration via post-login setup page

Key architectural decisions:
- Users log in via Forgejo session, no separate Myst login
- Service account PAT used for API calls, not user identity
- Private links require email verification code
- Public links are time-expired for job applications
- Myst provides Dockerfile, operators use Dokploy for deployment

* Complete CLI init skeleton with CodeRabbit review fixes

CLI changes:
- Narrow init to Myst-only config generation (no Forgejo provisioning)
- Add yoctocolors styling to CLI output
- Simplify URL validation logic (remove dead code)
- Fix typo in env.ts comment
- Remove docker-compose generator (out of scope)
- Move example config from src/ to packages/cli/examples/
- Fix CommandName type to match implemented commands only

Config changes:
- Remove databaseUrl from myst.config.json (DB is .env-only)
- Update example config with current fields
- Reject non-HTTP schemes before auto-prepending https://
- Use localhost -> 127.0.0.1 in Caddy/Nginx examples
- Add file existence checks and 0o600 permissions

Build passes after all changes.

* docs: rewrite README with Myst branding and architecture

- Add Mermaid architecture diagram
- Document two link types (private/public)
- Explain authentication model
- Provide setup steps
- Add example configuration
- Include Phase 1 completion checklist

* fix: correct Mermaid diagram syntax

* refactor: streamline README per create-readme skill guidelines

- Use blockquote for tagline
- Simplify architecture diagram labels
- Remove redundant sections (Setup, Example Config, License)
- Keep checklist as primary tracking mechanism
- Use tables for features and auth
- Reduce verbosity throughout

* cli: add preflight check and version flag

- Add preflightWriteTargets to check file existence before writing
- Remove stub commands (start, stop, status) from help text
- Add --version flag support
- Sequential file writes with preflight check

* cleanup: remove empty command stubs and test config

- Remove start.ts, stop.ts, status.ts (not implemented yet)
- Remove myst.config.json (generated during testing)

* cleanup: remove app-ini generator (Forgejo provisioning out of scope)

* cleanup: remove empty unused utility files (docker.ts, flags.ts, init.ts)

* cleanup: remove examples.ts (examples belong in docs, not deployed code)

* Docs: clarify Forgejo user PAT wording (#4)

* Docs: add diagram slot and clarify deployment examples (#6)

* docs: rename Forgejo bot configuration

* refactor(cli): improve init command error handling; change "service
account" verbaige to "dedicated forgejo user" to match Forgejo user
model;
2026-04-07 13:27:19 -04:00
Zach Tatman
16557aa44d
docs: rewrite README with architecture and checklist (#3)
* docs: rewrite README with Myst branding and architecture

- Add Mermaid architecture diagram
- Document two link types (private/public)
- Explain authentication model
- Provide setup steps
- Add example configuration
- Include Phase 1 completion checklist

* fix: correct Mermaid diagram syntax

* refactor: streamline README per create-readme skill guidelines

- Use blockquote for tagline
- Simplify architecture diagram labels
- Remove redundant sections (Setup, Example Config, License)
- Keep checklist as primary tracking mechanism
- Use tables for features and auth
- Reduce verbosity throughout
2026-04-02 18:31:17 -04:00
ZTatman
c6567440c7 Initialize Embargo repository 2026-03-30 16:29:10 -04:00