From 550301a690d201ec1257a2daffb78ab11aadac6d Mon Sep 17 00:00:00 2001 From: Mawi Man <185532606+mawi-officiel@users.noreply.github.com> Date: Sun, 31 Aug 2025 21:57:28 +0100 Subject: [PATCH] CIN CLI v3.0.1 - Security and Privacy Improvements MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ## Enhanced Release – Focus on Privacy & Code Simplification This release improves privacy and simplifies the codebase by removing unnecessary tracking features. ### Key Changes: 🔒 Security & Privacy Enhancements - **Removed `WEBHOOK_URL`**: External endpoint eliminated to enhance privacy - **Removed Tracking System**: All tracking commands (`enable/disable/status`) removed to protect user privacy - **Removed Automatic Notifications**: Disabled automatic diagnostic data submission - **Removed `sendErrorNotification()`** and all its references - **Removed `getSafeSystemInfo()`** - **Removed `getDefaultNotificationEndpoint()`** - **Removed `getNotificationStatus()`** - **Cleaned `struct Config`**: Removed `ErrorTrackingEnabled` field - **Updated `loadConfig()`**: Removed tracking references - **Updated Help Menu**: Removed tracking commands 📦 **Version Updates** - Updated `JobFrameVersion` from **v3.0.0** → **v3.0.1** - Updated all references to the new version ### Updated Files: - `job-frame.go` ### Notes for Developers: This release enhances user privacy and reduces code complexity by removing non-essential features related to tracking and external notifications. --- src/job-frame.go | 273 ++++++++--------------------------------------- 1 file changed, 45 insertions(+), 228 deletions(-) diff --git a/src/job-frame.go b/src/job-frame.go index 18b472e..c714c91 100644 --- a/src/job-frame.go +++ b/src/job-frame.go @@ -3,7 +3,6 @@ package main import ( "archive/zip" "bufio" - "bytes" "encoding/json" "fmt" "io" @@ -18,8 +17,7 @@ import ( ) const ( - WEBHOOK_URL = "https://discord.com/api/webhooks/1234567890/abcdefghijklmnopqrstuvwxyz" - JobFrameVersion = "v3.0.0" + JobFrameVersion = "v3.0.1" VERSION = JobFrameVersion APP_NAME = "CIN Framework CLI" COPYRIGHT_TEXT = "© CIN Framework — All Rights Reserved." @@ -141,14 +139,13 @@ func enableWindowsColorSupport() { } type Config struct { - ErrorTrackingEnabled bool `json:"error_tracking_enabled"` - AdminMode bool `json:"admin_mode"` - ColorEnabled bool `json:"color_enabled"` - LastUpdated string `json:"last_updated"` - Version string `json:"version"` - FrameworkVersion string `json:"framework_version"` - FrameworkInstalled bool `json:"framework_installed"` - InstalledLibraries map[string][]string `json:"libraries_installed"` + AdminMode bool `json:"admin_mode"` + ColorEnabled bool `json:"color_enabled"` + LastUpdated string `json:"last_updated"` + Version string `json:"version"` + FrameworkVersion string `json:"framework_version"` + FrameworkInstalled bool `json:"framework_installed"` + InstalledLibraries map[string][]string `json:"libraries_installed"` } type GitHubRelease struct { @@ -157,11 +154,10 @@ type GitHubRelease struct { } var ( - errorTrackingEnabled = true - adminMode = false - colorEnabled = false - configFilePath = ".cin-cli/config.json" - config *Config + adminMode = false + colorEnabled = false + configFilePath = ".cin-cli/config.json" + config *Config ) func main() { @@ -236,8 +232,7 @@ func processCommand(args []string) { case "help": showHelp() - case "tracking": - handleTrackingCommand(args[1:]) + case "config": handleConfigCommand(args[1:]) case "sudo": @@ -253,40 +248,7 @@ func processCommand(args []string) { default: fmt.Printf("Unknown command: %s\n", command) fmt.Println("Type 'help' to show available commands") - if errorTrackingEnabled { - sendErrorNotification("Unknown command", fmt.Sprintf("Command '%s' not recognized", command)) - } - } -} - -func handleTrackingCommand(args []string) { - if len(args) == 0 { - fmt.Printf("%sUsage:%s tracking [enable|disable|status]\n", getColorDim(), getColorReset()) - return - } - - subCommand := strings.ToLower(args[0]) - switch subCommand { - case "enable": - errorTrackingEnabled = true - config.ErrorTrackingEnabled = true - saveConfig() - fmt.Printf("%s[SUCCESS]%s %sDiagnostic reporting enabled%s\n", getColorGreen(), getColorReset(), getColorWhite(), getColorReset()) - case "disable": - errorTrackingEnabled = false - config.ErrorTrackingEnabled = false - saveConfig() - fmt.Printf("%s[INFO]%s %sDiagnostic reporting disabled%s\n", getColorBlue(), getColorReset(), getColorWhite(), getColorReset()) - case "status": - if errorTrackingEnabled { - fmt.Printf("%s[STATUS]%s Diagnostic reporting status: %sENABLED%s\n", getColorCyan(), getColorReset(), getColorGreen(), getColorReset()) - } else { - fmt.Printf("%s[STATUS]%s Diagnostic reporting status: %sDISABLED%s\n", getColorCyan(), getColorReset(), getColorRed(), getColorReset()) - } - default: - fmt.Printf("%s[ERROR]%s Unknown tracking parameter: %s%s%s\n", getColorRed(), getColorReset(), getColorYellow(), subCommand, getColorReset()) - fmt.Printf("%sUsage:%s tracking [enable|disable|status]\n", getColorDim(), getColorReset()) } } @@ -312,9 +274,7 @@ func showHelp() { // General Commands fmt.Printf(" %s%-25s%s - %sShow this help%s\n", getColorYellow(), "help", getColorReset(), getColorWhite(), getColorReset()) fmt.Printf(" %s%-25s%s - %sClear the screen%s\n", getColorYellow(), "clear", getColorReset(), getColorWhite(), getColorReset()) - fmt.Printf(" %s%-25s%s - %sEnable diagnostic reporting%s\n", getColorYellow(), "tracking enable", getColorReset(), getColorWhite(), getColorReset()) - fmt.Printf(" %s%-25s%s - %sDisable diagnostic reporting%s\n", getColorYellow(), "tracking disable", getColorReset(), getColorWhite(), getColorReset()) - fmt.Printf(" %s%-25s%s - %sShow current tracking status%s\n", getColorYellow(), "tracking status", getColorReset(), getColorWhite(), getColorReset()) + fmt.Printf(" %s%-25s%s - %sDisplay current configuration%s\n", getColorYellow(), "config show", getColorReset(), getColorWhite(), getColorReset()) fmt.Printf(" %s%-25s%s - %sShow configuration file path%s\n", getColorYellow(), "config path", getColorReset(), getColorWhite(), getColorReset()) fmt.Printf(" %s%-25s%s - %sReset configuration to defaults%s\n", getColorYellow(), "config reset", getColorReset(), getColorWhite(), getColorReset()) @@ -359,10 +319,10 @@ func showConfig() { fmt.Printf("\n%s%sCurrent Configuration:%s\n", getColorBold(), getColorCyan(), getColorReset()) fmt.Printf("%s%s%s\n", getColorDim(), strings.Repeat("─", 40), getColorReset()) - fmt.Printf("%sError Tracking:%s %s%v%s\n", getColorYellow(), getColorReset(), getColorWhite(), config.ErrorTrackingEnabled, getColorReset()) + fmt.Printf("%sAdmin Mode:%s %s%v%s\n", getColorYellow(), getColorReset(), getColorWhite(), config.AdminMode, getColorReset()) fmt.Printf("%sColor Mode:%s %s%v%s\n", getColorYellow(), getColorReset(), getColorWhite(), config.ColorEnabled, getColorReset()) - fmt.Printf("%sNotification System:%s %s%s%s\n", getColorYellow(), getColorReset(), getColorWhite(), getNotificationStatus(), getColorReset()) + fmt.Printf("%sVersion:%s %s%s%s\n", getColorYellow(), getColorReset(), getColorWhite(), config.Version, getColorReset()) fmt.Printf("%sLast Updated:%s %s%s%s\n", getColorYellow(), getColorReset(), getColorWhite(), config.LastUpdated, getColorReset()) fmt.Printf("%s%s%s\n", getColorDim(), strings.Repeat("─", 40), getColorReset()) @@ -371,26 +331,16 @@ func showConfig() { fmt.Println() } -func getNotificationStatus() string { - return "Configured" -} - -func getDefaultNotificationEndpoint() string { - return WEBHOOK_URL -} - func resetConfig() { config = &Config{ - ErrorTrackingEnabled: true, - AdminMode: false, - ColorEnabled: false, - LastUpdated: time.Now().Format(time.RFC3339), - Version: VERSION, - FrameworkVersion: "", - FrameworkInstalled: false, - InstalledLibraries: make(map[string][]string), - } - errorTrackingEnabled = config.ErrorTrackingEnabled + AdminMode: false, + ColorEnabled: false, + LastUpdated: time.Now().Format(time.RFC3339), + Version: VERSION, + FrameworkVersion: "", + FrameworkInstalled: false, + InstalledLibraries: make(map[string][]string), + } adminMode = config.AdminMode colorEnabled = config.ColorEnabled saveConfig() @@ -599,14 +549,13 @@ func initializeConfig() { func loadConfig() { if _, err := os.Stat(configFilePath); os.IsNotExist(err) { config = &Config{ - ErrorTrackingEnabled: true, - AdminMode: false, - ColorEnabled: false, - LastUpdated: time.Now().Format(time.RFC3339), - Version: VERSION, - FrameworkVersion: "", - FrameworkInstalled: false, - InstalledLibraries: make(map[string][]string), + AdminMode: false, + ColorEnabled: false, + LastUpdated: time.Now().Format(time.RFC3339), + Version: VERSION, + FrameworkVersion: "", + FrameworkInstalled: false, + InstalledLibraries: make(map[string][]string), } saveConfig() fmt.Printf("%s[INFO]%s Created new configuration file: %s%s%s\n", getColorBlue(), getColorReset(), getColorCyan(), configFilePath, getColorReset()) @@ -615,14 +564,13 @@ func loadConfig() { if err != nil { fmt.Printf("%s[WARNING]%s Could not read config file: %s%v%s\n", getColorYellow(), getColorReset(), getColorRed(), err, getColorReset()) config = &Config{ - ErrorTrackingEnabled: true, - AdminMode: false, - ColorEnabled: false, - LastUpdated: time.Now().Format(time.RFC3339), - Version: VERSION, - FrameworkVersion: "", - FrameworkInstalled: false, - InstalledLibraries: make(map[string][]string), + AdminMode: false, + ColorEnabled: false, + LastUpdated: time.Now().Format(time.RFC3339), + Version: VERSION, + FrameworkVersion: "", + FrameworkInstalled: false, + InstalledLibraries: make(map[string][]string), } return } @@ -631,14 +579,13 @@ func loadConfig() { if err != nil { fmt.Printf("%s[WARNING]%s Could not parse config file: %s%v%s\n", getColorYellow(), getColorReset(), getColorRed(), err, getColorReset()) config = &Config{ - ErrorTrackingEnabled: true, - AdminMode: false, - ColorEnabled: false, - LastUpdated: time.Now().Format(time.RFC3339), - Version: VERSION, - FrameworkVersion: "", - FrameworkInstalled: false, - InstalledLibraries: make(map[string][]string), + AdminMode: false, + ColorEnabled: false, + LastUpdated: time.Now().Format(time.RFC3339), + Version: VERSION, + FrameworkVersion: "", + FrameworkInstalled: false, + InstalledLibraries: make(map[string][]string), } return } @@ -654,7 +601,6 @@ func loadConfig() { saveConfig() // Save immediately to persist the version update } - errorTrackingEnabled = config.ErrorTrackingEnabled adminMode = config.AdminMode colorEnabled = config.ColorEnabled fmt.Printf("%s[INFO]%s Configuration loaded from: %s%s%s\n", getColorBlue(), getColorReset(), getColorCyan(), configFilePath, getColorReset()) @@ -677,136 +623,7 @@ func saveConfig() { } } -func getSafeSystemInfo() map[string]string { - info := make(map[string]string) - - info["os"] = runtime.GOOS - info["arch"] = runtime.GOARCH - info["go_version"] = runtime.Version() - info["num_cpu"] = fmt.Sprintf("%d", runtime.NumCPU()) - info["num_goroutine"] = fmt.Sprintf("%d", runtime.NumGoroutine()) - - if hostname, err := os.Hostname(); err == nil { - if len(hostname) > 3 { - info["hostname_prefix"] = hostname[:3] + "***" - } else { - info["hostname_prefix"] = "***" - } - } - - username := os.Getenv("USERNAME") - if username == "" { - username = os.Getenv("USER") - } - if len(username) > 2 { - info["user_prefix"] = username[:2] + "***" - } else { - info["user_prefix"] = "***" - } - - info["app_name"] = APP_NAME - info["app_version"] = VERSION - info["purpose"] = "System diagnostics and user experience improvement" - - return info -} - -func sendErrorNotification(errorType, errorMessage string) { - if !errorTrackingEnabled { - return - } - - go func() { - notificationEndpoint := getDefaultNotificationEndpoint() - - sysInfo := getSafeSystemInfo() - - message := map[string]interface{}{ - "embeds": []map[string]interface{}{ - { - "title": APP_NAME + " - System Diagnostic Alert (v" + VERSION + ")", - "description": "**Enterprise-Grade Error Monitoring & Analytics**\n\n*Automated system health monitoring for optimal performance and reliability. This diagnostic report ensures continuous service quality and proactive issue resolution.*", - "color": 3066993, - "thumbnail": map[string]interface{}{ - "url": ICON_URL, - }, - "fields": []map[string]interface{}{ - { - "name": "Incident Classification", - "value": fmt.Sprintf("```\n%s\n```", errorType), - "inline": true, - }, - { - "name": "Priority Level", - "value": "```\nMedium\n```", - "inline": true, - }, - { - "name": "\u200B", - "value": "\u200B", - "inline": true, - }, - { - "name": "Technical Details", - "value": fmt.Sprintf("```yaml\nError: %s\nStatus: Under Investigation\nImpact: Minimal\n```", errorMessage), - "inline": false, - }, - { - "name": "System Architecture", - "value": fmt.Sprintf("```yaml\nOperating System: %s\nProcessor Architecture: %s\nRuntime Version: %s\nCPU Cores Available: %s\n```", - sysInfo["os"], sysInfo["arch"], sysInfo["go_version"], sysInfo["num_cpu"]), - "inline": true, - }, - { - "name": "Application Metadata", - "value": fmt.Sprintf("```yaml\nProduct: %s\nVersion: %s\nLicense: Enterprise\nCompliance: ISO 27001\n```", - sysInfo["app_name"], sysInfo["app_version"]), - "inline": true, - }, - { - "name": "Security & Privacy Compliance", - "value": fmt.Sprintf("```yaml\nDevice Identifier: %s\nUser Session: %s\nData Protection: GDPR Compliant\nEncryption: AES-256\nAnonymization: Active\n```", - sysInfo["hostname_prefix"], sysInfo["user_prefix"]), - "inline": false, - }, - { - "name": "Event Timestamp", - "value": fmt.Sprintf("`%s`", time.Now().Format("Monday, January 2, 2006 at 15:04:05 UTC")), - "inline": true, - }, - { - "name": "Geographic Region", - "value": "`Global Enterprise Network`", - "inline": true, - }, - }, - "footer": map[string]interface{}{ - "text": COPYRIGHT_TEXT, - "icon_url": ICON_URL, - }, - "timestamp": time.Now().Format(time.RFC3339), - }, - }, - } - - jsonData, err := json.Marshal(message) - if err != nil { - return - } - - client := &http.Client{ - Timeout: 15 * time.Second, - } - resp, err := client.Post(notificationEndpoint, "application/json", bytes.NewBuffer(jsonData)) - if err != nil { - return - } - defer resp.Body.Close() - }() -} - // Framework Management Functions - func handleInstallCommand(args []string) { if len(args) == 0 { fmt.Printf("%s[ERROR]%s Usage: install [framework|library] [options]\n", getColorRed(), getColorReset())