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:
		
							
								
								
									
										157
									
								
								vendor/golang.org/x/text/secure/precis/options.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										157
									
								
								vendor/golang.org/x/text/secure/precis/options.go
									
									
									
										generated
									
									
										vendored
									
									
										Normal file
									
								
							| @@ -0,0 +1,157 @@ | ||||
| // Copyright 2015 The Go Authors. All rights reserved. | ||||
| // Use of this source code is governed by a BSD-style | ||||
| // license that can be found in the LICENSE file. | ||||
|  | ||||
| package precis | ||||
|  | ||||
| import ( | ||||
| 	"golang.org/x/text/cases" | ||||
| 	"golang.org/x/text/language" | ||||
| 	"golang.org/x/text/runes" | ||||
| 	"golang.org/x/text/transform" | ||||
| 	"golang.org/x/text/unicode/norm" | ||||
| ) | ||||
|  | ||||
| // An Option is used to define the behavior and rules of a Profile. | ||||
| type Option func(*options) | ||||
|  | ||||
| type options struct { | ||||
| 	// Preparation options | ||||
| 	foldWidth bool | ||||
|  | ||||
| 	// Enforcement options | ||||
| 	asciiLower    bool | ||||
| 	cases         transform.SpanningTransformer | ||||
| 	disallow      runes.Set | ||||
| 	norm          transform.SpanningTransformer | ||||
| 	additional    []func() transform.SpanningTransformer | ||||
| 	width         transform.SpanningTransformer | ||||
| 	disallowEmpty bool | ||||
| 	bidiRule      bool | ||||
| 	repeat        bool | ||||
|  | ||||
| 	// Comparison options | ||||
| 	ignorecase bool | ||||
| } | ||||
|  | ||||
| func getOpts(o ...Option) (res options) { | ||||
| 	for _, f := range o { | ||||
| 		f(&res) | ||||
| 	} | ||||
| 	// Using a SpanningTransformer, instead of norm.Form prevents an allocation | ||||
| 	// down the road. | ||||
| 	if res.norm == nil { | ||||
| 		res.norm = norm.NFC | ||||
| 	} | ||||
| 	return | ||||
| } | ||||
|  | ||||
| var ( | ||||
| 	// The IgnoreCase option causes the profile to perform a case insensitive | ||||
| 	// comparison during the PRECIS comparison step. | ||||
| 	IgnoreCase Option = ignoreCase | ||||
|  | ||||
| 	// The FoldWidth option causes the profile to map non-canonical wide and | ||||
| 	// narrow variants to their decomposition mapping. This is useful for | ||||
| 	// profiles that are based on the identifier class which would otherwise | ||||
| 	// disallow such characters. | ||||
| 	FoldWidth Option = foldWidth | ||||
|  | ||||
| 	// The DisallowEmpty option causes the enforcement step to return an error if | ||||
| 	// the resulting string would be empty. | ||||
| 	DisallowEmpty Option = disallowEmpty | ||||
|  | ||||
| 	// The BidiRule option causes the Bidi Rule defined in RFC 5893 to be | ||||
| 	// applied. | ||||
| 	BidiRule Option = bidiRule | ||||
| ) | ||||
|  | ||||
| var ( | ||||
| 	ignoreCase = func(o *options) { | ||||
| 		o.ignorecase = true | ||||
| 	} | ||||
| 	foldWidth = func(o *options) { | ||||
| 		o.foldWidth = true | ||||
| 	} | ||||
| 	disallowEmpty = func(o *options) { | ||||
| 		o.disallowEmpty = true | ||||
| 	} | ||||
| 	bidiRule = func(o *options) { | ||||
| 		o.bidiRule = true | ||||
| 	} | ||||
| 	repeat = func(o *options) { | ||||
| 		o.repeat = true | ||||
| 	} | ||||
| ) | ||||
|  | ||||
| // TODO: move this logic to package transform | ||||
|  | ||||
| type spanWrap struct{ transform.Transformer } | ||||
|  | ||||
| func (s spanWrap) Span(src []byte, atEOF bool) (n int, err error) { | ||||
| 	return 0, transform.ErrEndOfSpan | ||||
| } | ||||
|  | ||||
| // TODO: allow different types? For instance: | ||||
| //     func() transform.Transformer | ||||
| //     func() transform.SpanningTransformer | ||||
| //     func([]byte) bool  // validation only | ||||
| // | ||||
| // Also, would be great if we could detect if a transformer is reentrant. | ||||
|  | ||||
| // The AdditionalMapping option defines the additional mapping rule for the | ||||
| // Profile by applying Transformer's in sequence. | ||||
| func AdditionalMapping(t ...func() transform.Transformer) Option { | ||||
| 	return func(o *options) { | ||||
| 		for _, f := range t { | ||||
| 			sf := func() transform.SpanningTransformer { | ||||
| 				return f().(transform.SpanningTransformer) | ||||
| 			} | ||||
| 			if _, ok := f().(transform.SpanningTransformer); !ok { | ||||
| 				sf = func() transform.SpanningTransformer { | ||||
| 					return spanWrap{f()} | ||||
| 				} | ||||
| 			} | ||||
| 			o.additional = append(o.additional, sf) | ||||
| 		} | ||||
| 	} | ||||
| } | ||||
|  | ||||
| // The Norm option defines a Profile's normalization rule. Defaults to NFC. | ||||
| func Norm(f norm.Form) Option { | ||||
| 	return func(o *options) { | ||||
| 		o.norm = f | ||||
| 	} | ||||
| } | ||||
|  | ||||
| // The FoldCase option defines a Profile's case mapping rule. Options can be | ||||
| // provided to determine the type of case folding used. | ||||
| func FoldCase(opts ...cases.Option) Option { | ||||
| 	return func(o *options) { | ||||
| 		o.asciiLower = true | ||||
| 		o.cases = cases.Fold(opts...) | ||||
| 	} | ||||
| } | ||||
|  | ||||
| // The LowerCase option defines a Profile's case mapping rule. Options can be | ||||
| // provided to determine the type of case folding used. | ||||
| func LowerCase(opts ...cases.Option) Option { | ||||
| 	return func(o *options) { | ||||
| 		o.asciiLower = true | ||||
| 		if len(opts) == 0 { | ||||
| 			o.cases = cases.Lower(language.Und, cases.HandleFinalSigma(false)) | ||||
| 			return | ||||
| 		} | ||||
|  | ||||
| 		opts = append([]cases.Option{cases.HandleFinalSigma(false)}, opts...) | ||||
| 		o.cases = cases.Lower(language.Und, opts...) | ||||
| 	} | ||||
| } | ||||
|  | ||||
| // The Disallow option further restricts a Profile's allowed characters beyond | ||||
| // what is disallowed by the underlying string class. | ||||
| func Disallow(set runes.Set) Option { | ||||
| 	return func(o *options) { | ||||
| 		o.disallow = set | ||||
| 	} | ||||
| } | ||||
		Reference in New Issue
	
	Block a user
	 Claude Code
					Claude Code