feat: Production readiness improvements for WHOOSH council formation
Major security, observability, and configuration improvements:
## Security Hardening
- Implemented configurable CORS (no more wildcards)
- Added comprehensive auth middleware for admin endpoints
- Enhanced webhook HMAC validation
- Added input validation and rate limiting
- Security headers and CSP policies
## Configuration Management
- Made N8N webhook URL configurable (WHOOSH_N8N_BASE_URL)
- Replaced all hardcoded endpoints with environment variables
- Added feature flags for LLM vs heuristic composition
- Gitea fetch hardening with EAGER_FILTER and FULL_RESCAN options
## API Completeness
- Implemented GetCouncilComposition function
- Added GET /api/v1/councils/{id} endpoint
- Council artifacts API (POST/GET /api/v1/councils/{id}/artifacts)
- /admin/health/details endpoint with component status
- Database lookup for repository URLs (no hardcoded fallbacks)
## Observability & Performance
- Added OpenTelemetry distributed tracing with goal/pulse correlation
- Performance optimization database indexes
- Comprehensive health monitoring
- Enhanced logging and error handling
## Infrastructure
- Production-ready P2P discovery (replaces mock implementation)
- Removed unused Redis configuration
- Enhanced Docker Swarm integration
- Added migration files for performance indexes
## Code Quality
- Comprehensive input validation
- Graceful error handling and failsafe fallbacks
- Backwards compatibility maintained
- Following security best practices
🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
46
vendor/github.com/golang-migrate/migrate/v4/database/multistmt/parse.go
generated
vendored
Normal file
46
vendor/github.com/golang-migrate/migrate/v4/database/multistmt/parse.go
generated
vendored
Normal file
@@ -0,0 +1,46 @@
|
||||
// Package multistmt provides methods for parsing multi-statement database migrations
|
||||
package multistmt
|
||||
|
||||
import (
|
||||
"bufio"
|
||||
"bytes"
|
||||
"io"
|
||||
)
|
||||
|
||||
// StartBufSize is the default starting size of the buffer used to scan and parse multi-statement migrations
|
||||
var StartBufSize = 4096
|
||||
|
||||
// Handler handles a single migration parsed from a multi-statement migration.
|
||||
// It's given the single migration to handle and returns whether or not further statements
|
||||
// from the multi-statement migration should be parsed and handled.
|
||||
type Handler func(migration []byte) bool
|
||||
|
||||
func splitWithDelimiter(delimiter []byte) func(d []byte, atEOF bool) (int, []byte, error) {
|
||||
return func(d []byte, atEOF bool) (int, []byte, error) {
|
||||
// SplitFunc inspired by bufio.ScanLines() implementation
|
||||
if atEOF {
|
||||
if len(d) == 0 {
|
||||
return 0, nil, nil
|
||||
}
|
||||
return len(d), d, nil
|
||||
}
|
||||
if i := bytes.Index(d, delimiter); i >= 0 {
|
||||
return i + len(delimiter), d[:i+len(delimiter)], nil
|
||||
}
|
||||
return 0, nil, nil
|
||||
}
|
||||
}
|
||||
|
||||
// Parse parses the given multi-statement migration
|
||||
func Parse(reader io.Reader, delimiter []byte, maxMigrationSize int, h Handler) error {
|
||||
scanner := bufio.NewScanner(reader)
|
||||
scanner.Buffer(make([]byte, 0, StartBufSize), maxMigrationSize)
|
||||
scanner.Split(splitWithDelimiter(delimiter))
|
||||
for scanner.Scan() {
|
||||
cont := h(scanner.Bytes())
|
||||
if !cont {
|
||||
break
|
||||
}
|
||||
}
|
||||
return scanner.Err()
|
||||
}
|
||||
Reference in New Issue
Block a user