H1: Prevent workspace path traversal via ../
Add resolveLocalDirPath() that validates resolved path stays under
baseDir, expands ~/... via os.UserHomeDir, rejects escaping paths.
M2: Sanitize sender_name in inject_sender header
Replace quotes with single quotes, strip newlines/CR to prevent
prompt injection via display names.
M3: Warn on unset env var placeholders in config
resolveEnvPlaceholders now logs slog.Warn when ${VAR} references
an environment variable that is not set.
M4: Validate WeCom api_base_url
Reject non-http(s) or malformed URLs at New() to prevent credential
exfiltration via misconfigured base URL.
M5: Quote systemd Environment= values
Wrap values in double quotes to handle spaces, #, and special chars
in proxy URLs and paths.
M7: Discord table detection now requires separator row
Only wrap pipe-delimited blocks that contain a markdown separator
row (| --- | --- |), reducing false positives on decorative pipes.
Made-with: Cursor
Lowercase fmt.Errorf prefixes in daemon/update CLI paths and collapse
systemd manager error to a single line without trailing punctuation.
</think>
mcp_GitKraken_git_push
LaunchAgent used KeepAlive=true, so launchd restarted cc-connect after
every process exit, including graceful SIGTERM shutdown. That looked like
"stop then immediate restart" and could make tooling that waits for the
Unix API socket to disappear hang if the service respawned quickly.
Use KeepAlive with SuccessfulExit=true so only unclean exits are restarted,
matching systemd Restart=on-failure behavior.
Existing installs: re-run `cc-connect daemon install --force` to refresh
the plist.
Fixes#153
Made-with: Cursor
Co-authored-by: Claude <noreply@anthropic.com>
The changes add error handling for previously ignored operations and introduce logging for critical errors and warnings. This includes:
- Adding error checks for file operations, JSON unmarshaling, system calls
- Logging warnings/errors for failed operations using slog
- Properly handling return values from functions that were previously ignored
- Adding context to error messages for better debugging
- Cleaning up unused code and variables
generated by llmgit
Co-Authored-By: Claude <noreply@anthropic.com>
When rotate() fails to open the new log file, the original code set
w.file to nil (via the failed retry that returned nil). Subsequent
Write() calls would dereference w.file and panic.
Fix:
- Add nil check in Write() to return os.ErrClosed gracefully
- Remove the useless retry in rotate() (identical call would also fail)
- Explicitly set w.file = nil on failure so the nil guard in Write() and
Close() handles it correctly
- Add support for system-level systemd (/etc/systemd/system/) when running as root
- Add requireInstalled check before start/stop/restart operations
- Improve systemd detection and error messages for WSL2, containers, SSH
- Add isWSL2() helper for better platform detection
- Update daemon help text to clarify Linux root vs non-root behavior
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Add support for running cc-connect as a daemon managed by OS init system:
- Linux: systemd user service
- macOS: launchd LaunchAgent
New CLI commands:
- cc-connect daemon install/uninstall
- cc-connect daemon start/stop/restart/status
- cc-connect daemon logs [-f] [-n N] [--log-file PATH]
Features:
- Auto log rotation with configurable max size
- Cross-platform support (systemd/launchd)
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>