 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>
		
	
		
			
				
	
	
		
			53 lines
		
	
	
		
			1.5 KiB
		
	
	
	
		
			Go
		
	
	
	
	
	
			
		
		
	
	
			53 lines
		
	
	
		
			1.5 KiB
		
	
	
	
		
			Go
		
	
	
	
	
	
| package zerolog
 | |
| 
 | |
| import (
 | |
| 	"context"
 | |
| )
 | |
| 
 | |
| var disabledLogger *Logger
 | |
| 
 | |
| func init() {
 | |
| 	SetGlobalLevel(TraceLevel)
 | |
| 	l := Nop()
 | |
| 	disabledLogger = &l
 | |
| }
 | |
| 
 | |
| type ctxKey struct{}
 | |
| 
 | |
| // WithContext returns a copy of ctx with the receiver attached. The Logger
 | |
| // attached to the provided Context (if any) will not be effected.  If the
 | |
| // receiver's log level is Disabled it will only be attached to the returned
 | |
| // Context if the provided Context has a previously attached Logger. If the
 | |
| // provided Context has no attached Logger, a Disabled Logger will not be
 | |
| // attached.
 | |
| //
 | |
| // Note: to modify the existing Logger attached to a Context (instead of
 | |
| // replacing it in a new Context), use UpdateContext with the following
 | |
| // notation:
 | |
| //
 | |
| //     ctx := r.Context()
 | |
| //     l := zerolog.Ctx(ctx)
 | |
| //     l.UpdateContext(func(c Context) Context {
 | |
| //         return c.Str("bar", "baz")
 | |
| //     })
 | |
| //
 | |
| func (l Logger) WithContext(ctx context.Context) context.Context {
 | |
| 	if _, ok := ctx.Value(ctxKey{}).(*Logger); !ok && l.level == Disabled {
 | |
| 		// Do not store disabled logger.
 | |
| 		return ctx
 | |
| 	}
 | |
| 	return context.WithValue(ctx, ctxKey{}, &l)
 | |
| }
 | |
| 
 | |
| // Ctx returns the Logger associated with the ctx. If no logger
 | |
| // is associated, DefaultContextLogger is returned, unless DefaultContextLogger
 | |
| // is nil, in which case a disabled logger is returned.
 | |
| func Ctx(ctx context.Context) *Logger {
 | |
| 	if l, ok := ctx.Value(ctxKey{}).(*Logger); ok {
 | |
| 		return l
 | |
| 	} else if l = DefaultContextLogger; l != nil {
 | |
| 		return l
 | |
| 	}
 | |
| 	return disabledLogger
 | |
| }
 |