fix: round-L audit (parser comments, BSD pgrep, poll guard, log rotation)#21
Merged
Conversation
…ion) - parseSSHConfig now strips inline `# comment` from every directive line. `Host prod # primary` was treating `#` and `primary` as bogus aliases; `Include foo # note` was running 2-3 spurious filesystem lookups per cycle. The strip rule mirrors OpenSSH itself — `#` only starts a comment when preceded by whitespace, so values like `prod#qa` are preserved. - pgrep -af → -lf for BSD compatibility. macOS BSD pgrep silently ignores -a (it's a GNU extension), which made the fallback discovery path emit PIDs without command lines and lose the daemon target name. -lf works on both BSD and GNU/procps. - Poll-loop re-entrancy guard. setInterval(poll, 200ms) could stack iterations if a slow ssh upload or PowerShell call held one open past its deadline — concurrent xclip/PowerShell processes, semaphore flooded with the same image. A `pollInFlight` boolean now self-throttles the loop: long iterations just delay the next tick instead of stacking. - daemon.log size-cap rotation. The file was opened append-only by startBackground and never pruned; a recurring stderr (failing ssh, missing xclip, etc.) would grow it forever. Now rotates to daemon.log.1 on next start when it exceeds 5 MB. - Clipboard write status check. xclip/wl-copy/PowerShell/clip.exe all return success-bool now; processNewImage logs "Clipboard write failed" honestly instead of falsely reporting "Copied to clipboard" when the underlying tool exited non-zero (no X11 display, missing binary, etc). - isValidRemoteName tightened to an explicit whitelist `[A-Za-z0-9._@][A-Za-z0-9._@-]*`. Defense-in-depth — no current code path interpolates `remote` into a remote shell, but a future feature that does (e.g. `sshshot logs <remote>`) would inherit the constraint. +4 tests for the parser comment-stripping cases and the new whitelist rejections (shell metacharacters). Total 41.
|
🎉 This PR is included in version 0.7.6 🎉 The release is available on GitHub release Your semantic-release bot 📦🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Six fixes from the latest audit, bundled into one `fix:` PR. Two flagged items were stale (Round-K test coverage for `buildCustomScreenshotRegex` + recursive includes was already added in v0.7.5).
Test plan