mirror of
https://github.com/lukaszraczylo/graphql-monitoring-proxy.git
synced 2026-10-12 05:32:36 +00:00
chore(security,refactor): extract sanitization and improve code quality (#41)
* chore(security,refactor): extract sanitization and improve code quality
- [x] Extract sanitization functions to dedicated sanitization.go module
- [x] Add comprehensive golangci-lint v2 configuration with security rules
- [x] Replace interface{} with any type throughout codebase
- [x] Add admin API authentication security warning
- [x] Extract WebSocket and stats streaming constants
- [x] Add best-effort error handling comments for resource cleanup
- [x] Expand sensitive field patterns for improved PII redaction
- [x] Simplify safety checks and remove redundant nil validations
- [x] Improve test coverage for password field redaction patterns
* refactor: replace interface{} with any type alias
- [x] Replace all `map[string]interface{}` with `map[string]any`
- [x] Replace all `interface{}` with `any` in function signatures and type definitions
- [x] Update sync.Pool New function returns from `interface{}` to `any`
- [x] Add package documentation comments to 8 package files
- [x] Update type assertions and casts to work with `any` type
This commit is contained in:
+5
-5
@@ -9,7 +9,7 @@ import (
|
||||
// LRUCacheEntry represents a cache entry with metadata
|
||||
type LRUCacheEntry struct {
|
||||
timestamp time.Time
|
||||
value interface{}
|
||||
value any
|
||||
element *list.Element
|
||||
key string
|
||||
size int64
|
||||
@@ -44,7 +44,7 @@ func NewLRUCache(maxEntries int, maxSize int64) *LRUCache {
|
||||
}
|
||||
|
||||
// Get retrieves a value from the cache
|
||||
func (c *LRUCache) Get(key string) (interface{}, bool) {
|
||||
func (c *LRUCache) Get(key string) (any, bool) {
|
||||
c.mu.Lock()
|
||||
defer c.mu.Unlock()
|
||||
|
||||
@@ -61,7 +61,7 @@ func (c *LRUCache) Get(key string) (interface{}, bool) {
|
||||
}
|
||||
|
||||
// Set adds or updates a value in the cache
|
||||
func (c *LRUCache) Set(key string, value interface{}, size int64) {
|
||||
func (c *LRUCache) Set(key string, value any, size int64) {
|
||||
c.mu.Lock()
|
||||
defer c.mu.Unlock()
|
||||
|
||||
@@ -211,11 +211,11 @@ func (c *LRUCache) CleanupExpired(maxAge time.Duration) int {
|
||||
}
|
||||
|
||||
// GetStats returns cache statistics
|
||||
func (c *LRUCache) GetStats() map[string]interface{} {
|
||||
func (c *LRUCache) GetStats() map[string]any {
|
||||
c.mu.RLock()
|
||||
defer c.mu.RUnlock()
|
||||
|
||||
return map[string]interface{}{
|
||||
return map[string]any{
|
||||
"entries": c.evictList.Len(),
|
||||
"size_bytes": c.currentSize,
|
||||
"max_entries": c.maxEntries,
|
||||
|
||||
Reference in New Issue
Block a user