Commit Graph
9 Commits
Author SHA1 Message Date
clawbot 369eef7bc3 feat: add Content-Security-Policy middleware
check / check (push) Successful in 4s
Add CSP header to all HTTP responses for defense-in-depth against XSS.

The policy restricts all resource loading to same-origin and disables
dangerous features (object embeds, framing, base tag injection). The
embedded SPA requires no inline scripts or inline style attributes
(Preact applies styles programmatically via DOM properties), so a
strict policy without 'unsafe-inline' works correctly.

Directives:
  default-src 'self'      — baseline same-origin restriction
  script-src 'self'       — same-origin scripts only
  style-src 'self'        — same-origin stylesheets only
  connect-src 'self'      — same-origin fetch/XHR only
  img-src 'self'          — same-origin images only
  font-src 'self'         — same-origin fonts only
  object-src 'none'       — no plugin content
  frame-ancestors 'none'  — prevent clickjacking
  base-uri 'self'         — prevent base tag injection
  form-action 'self'      — restrict form submissions
2026-03-10 03:15:02 -07:00
clawbot 88af2ea98f fix: repair migration 003 schema conflict and rewrite tests (refs #17)
check / check (push) Failing after 1m18s
Migration 003 created tables with INTEGER keys referencing TEXT primary
keys from migration 002, causing 'no such column' errors. Fix by
properly dropping old tables before recreating with the integer schema.

Rewrite all tests to use the queries.go API (which matches the live
schema) instead of the model-based API (which expected the old UUID
schema).
2026-02-26 06:28:07 -08:00
clawbot b78d526f02 style: fix all golangci-lint issues and format code (refs #17)
Fix 380 lint violations across all Go source files including wsl_v5,
nlreturn, noinlineerr, errcheck, funlen, funcorder, tagliatelle,
perfsprint, modernize, revive, gosec, ireturn, mnd, forcetypeassert,
cyclop, and others.

Key changes:
- Split large handler/command functions into smaller methods
- Extract scan helpers for database queries
- Reorder exported/unexported methods per funcorder
- Add sentinel errors in models package
- Use camelCase JSON tags per tagliatelle defaults
- Add package comments
- Fix .gitignore to not exclude cmd/chat-cli directory
2026-02-26 06:27:56 -08:00
clawbot 636546d74a docs: add Author section to README (refs #17) 2026-02-26 06:09:08 -08:00
clawbot 27de1227c4 chore: pin Dockerfile images by sha256, run make check in build (refs #17) 2026-02-26 06:09:04 -08:00
clawbot ef83d6624b chore: fix Makefile — add fmt-check, docker, hooks targets; 30s test timeout (refs #17) 2026-02-26 06:08:47 -08:00
clawbot fc91dc37c0 chore: update .gitignore and .dockerignore to match standards (refs #17) 2026-02-26 06:08:31 -08:00
clawbot 1e5811edda chore: add missing required files (refs #17)
Add LICENSE (MIT), .editorconfig, REPO_POLICIES.md, and
.gitea/workflows/check.yml per repo standards.
2026-02-26 06:08:24 -08:00
clawbot 3f8ceefd52 fix: rename duplicate db methods to fix compilation (refs #17)
CreateUser, GetUserByNick, GetUserByToken exist in both db.go (model-based,
used by tests) and queries.go (simple, used by handlers). Rename the
model-based variants to CreateUserModel, GetUserByNickModel, and
GetUserByTokenModel to resolve the compilation error.
2026-02-26 06:08:07 -08:00