feat: add comprehensive security scanning and EditorConfig integration

- Add govulncheck, Snyk, and Trivy vulnerability scanning
- Create security workflow for automated scanning on push/PR/schedule
- Add gitleaks for secrets detection and prevention
- Implement EditorConfig linting with eclint and editorconfig-checker
- Update Makefile with security and formatting targets
- Create SECURITY.md with vulnerability reporting guidelines
- Configure Dependabot for automated dependency updates
- Fix all EditorConfig violations across codebase
- Update Go version to 1.23.10 to address stdlib vulnerabilities
- Add tests for internal/helpers package (80% coverage)
- Remove deprecated functions and migrate to error-returning patterns
- Fix YAML indentation in test fixtures to resolve test failures
This commit is contained in:
2025-08-03 20:12:18 +03:00
parent e6c3e09a7f
commit ce02d36929
53 changed files with 2400 additions and 590 deletions

View File

@@ -4,7 +4,6 @@ package cache
import (
"encoding/json"
"fmt"
"log"
"os"
"path/filepath"
"sync"
@@ -28,7 +27,6 @@ type Cache struct {
ticker *time.Ticker // Cleanup ticker
done chan bool // Cleanup shutdown
defaultTTL time.Duration // Default TTL for entries
errorLog bool // Whether to log errors (default: true)
}
// Config represents cache configuration.
@@ -69,7 +67,6 @@ func NewCache(config *Config) (*Cache, error) {
data: make(map[string]Entry),
defaultTTL: config.DefaultTTL,
done: make(chan bool),
errorLog: true, // Enable error logging by default
}
// Load existing cache from disk
@@ -267,12 +264,11 @@ func (c *Cache) saveToDisk() error {
return nil
}
// saveToDiskAsync saves the cache to disk asynchronously with error logging.
// saveToDiskAsync saves the cache to disk asynchronously.
// Cache save failures are non-critical and silently ignored.
func (c *Cache) saveToDiskAsync() {
go func() {
if err := c.saveToDisk(); err != nil && c.errorLog {
log.Printf("gh-action-readme cache: failed to save cache to disk: %v", err)
}
_ = c.saveToDisk() // Ignore errors - cache save failures are non-critical
}()
}