 131868bdca
			
		
	
	131868bdca
	
	
	
		
			
			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>
		
	
		
			
				
	
	
		
			117 lines
		
	
	
		
			2.2 KiB
		
	
	
	
		
			Go
		
	
	
	
	
	
			
		
		
	
	
			117 lines
		
	
	
		
			2.2 KiB
		
	
	
	
		
			Go
		
	
	
	
	
	
| package pgxpool
 | |
| 
 | |
| import (
 | |
| 	"github.com/jackc/pgx/v5"
 | |
| 	"github.com/jackc/pgx/v5/pgconn"
 | |
| )
 | |
| 
 | |
| type errRows struct {
 | |
| 	err error
 | |
| }
 | |
| 
 | |
| func (errRows) Close()                                       {}
 | |
| func (e errRows) Err() error                                 { return e.err }
 | |
| func (errRows) CommandTag() pgconn.CommandTag                { return pgconn.CommandTag{} }
 | |
| func (errRows) FieldDescriptions() []pgconn.FieldDescription { return nil }
 | |
| func (errRows) Next() bool                                   { return false }
 | |
| func (e errRows) Scan(dest ...any) error                     { return e.err }
 | |
| func (e errRows) Values() ([]any, error)                     { return nil, e.err }
 | |
| func (e errRows) RawValues() [][]byte                        { return nil }
 | |
| func (e errRows) Conn() *pgx.Conn                            { return nil }
 | |
| 
 | |
| type errRow struct {
 | |
| 	err error
 | |
| }
 | |
| 
 | |
| func (e errRow) Scan(dest ...any) error { return e.err }
 | |
| 
 | |
| type poolRows struct {
 | |
| 	r   pgx.Rows
 | |
| 	c   *Conn
 | |
| 	err error
 | |
| }
 | |
| 
 | |
| func (rows *poolRows) Close() {
 | |
| 	rows.r.Close()
 | |
| 	if rows.c != nil {
 | |
| 		rows.c.Release()
 | |
| 		rows.c = nil
 | |
| 	}
 | |
| }
 | |
| 
 | |
| func (rows *poolRows) Err() error {
 | |
| 	if rows.err != nil {
 | |
| 		return rows.err
 | |
| 	}
 | |
| 	return rows.r.Err()
 | |
| }
 | |
| 
 | |
| func (rows *poolRows) CommandTag() pgconn.CommandTag {
 | |
| 	return rows.r.CommandTag()
 | |
| }
 | |
| 
 | |
| func (rows *poolRows) FieldDescriptions() []pgconn.FieldDescription {
 | |
| 	return rows.r.FieldDescriptions()
 | |
| }
 | |
| 
 | |
| func (rows *poolRows) Next() bool {
 | |
| 	if rows.err != nil {
 | |
| 		return false
 | |
| 	}
 | |
| 
 | |
| 	n := rows.r.Next()
 | |
| 	if !n {
 | |
| 		rows.Close()
 | |
| 	}
 | |
| 	return n
 | |
| }
 | |
| 
 | |
| func (rows *poolRows) Scan(dest ...any) error {
 | |
| 	err := rows.r.Scan(dest...)
 | |
| 	if err != nil {
 | |
| 		rows.Close()
 | |
| 	}
 | |
| 	return err
 | |
| }
 | |
| 
 | |
| func (rows *poolRows) Values() ([]any, error) {
 | |
| 	values, err := rows.r.Values()
 | |
| 	if err != nil {
 | |
| 		rows.Close()
 | |
| 	}
 | |
| 	return values, err
 | |
| }
 | |
| 
 | |
| func (rows *poolRows) RawValues() [][]byte {
 | |
| 	return rows.r.RawValues()
 | |
| }
 | |
| 
 | |
| func (rows *poolRows) Conn() *pgx.Conn {
 | |
| 	return rows.r.Conn()
 | |
| }
 | |
| 
 | |
| type poolRow struct {
 | |
| 	r   pgx.Row
 | |
| 	c   *Conn
 | |
| 	err error
 | |
| }
 | |
| 
 | |
| func (row *poolRow) Scan(dest ...any) error {
 | |
| 	if row.err != nil {
 | |
| 		return row.err
 | |
| 	}
 | |
| 
 | |
| 	panicked := true
 | |
| 	defer func() {
 | |
| 		if panicked && row.c != nil {
 | |
| 			row.c.Release()
 | |
| 		}
 | |
| 	}()
 | |
| 	err := row.r.Scan(dest...)
 | |
| 	panicked = false
 | |
| 	if row.c != nil {
 | |
| 		row.c.Release()
 | |
| 	}
 | |
| 	return err
 | |
| }
 |