rdev/internal/domain/errors.go
jordan 538ea57ed4 feat: Add claude-config API, security hardening, and testing infrastructure
Claude Config API (v0.6):
- Add CRUD endpoints for commands, skills, and agents
- Commands/skills/agents stored in /workspace/.claude/ (per-project, in git)
- Credentials shared via PVC at /root/.claude/ (shared across pods)
- Use base64 encoding for file writes (prevents shell injection)
- Add content size limits (1MB max)

Security Hardening:
- Add sanitize package for command/prompt validation
- Add rate limiting middleware (token bucket algorithm)
- Add concurrent command limiting
- Add input sanitization to all command handlers
- Gitignore secrets.yaml and credentials.yaml
- Add *.example templates for secrets

Testing Infrastructure:
- Add testutil package with mocks and fixtures
- Add unit tests for auth package (63% coverage)
- Add unit tests for executor (47% coverage)
- Add handler integration tests (40% coverage)
- Add 100% coverage for sanitize, cmdlimit packages
- Add 96% coverage for ratelimit package

Infrastructure:
- Shared Claude credentials PVC (ReadWriteMany)
- Reduced workspace PVC size from 20Gi to 5Gi
- Add init container cleanup before git clone
- Document Longhorn RWX requirements

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-25 01:29:13 -07:00

38 lines
1.4 KiB
Go

package domain
import "errors"
// Domain errors - these are business-level errors that should be translated
// to appropriate HTTP status codes or gRPC error codes by the presentation layer.
var (
// Project errors
ErrProjectNotFound = errors.New("project not found")
ErrProjectNotRunning = errors.New("project is not running")
// Command errors
ErrCommandNotFound = errors.New("command not found")
ErrCommandTimeout = errors.New("command timed out")
ErrCommandCancelled = errors.New("command was cancelled")
ErrLimitExceeded = errors.New("concurrent command limit exceeded")
ErrInvalidCommand = errors.New("invalid command")
ErrCommandSanitization = errors.New("command failed sanitization")
// API Key errors
ErrKeyNotFound = errors.New("api key not found")
ErrKeyRevoked = errors.New("api key has been revoked")
ErrKeyExpired = errors.New("api key has expired")
ErrKeyInvalid = errors.New("invalid api key format")
// Authorization errors
ErrUnauthorized = errors.New("unauthorized")
ErrForbidden = errors.New("forbidden")
ErrInsufficientScope = errors.New("insufficient scope")
// Rate limiting errors
ErrRateLimited = errors.New("rate limit exceeded")
// Infrastructure errors (should typically be wrapped)
ErrDatabaseConnection = errors.New("database connection error")
ErrKubernetesError = errors.New("kubernetes error")
)