Skip to content

Secure keyboard signal#50

Merged
erichs merged 4 commits intomainfrom
secure-keyboard-signal
Dec 26, 2025
Merged

Secure keyboard signal#50
erichs merged 4 commits intomainfrom
secure-keyboard-signal

Conversation

@erichs
Copy link
Owner

@erichs erichs commented Dec 26, 2025

No description provided.

Modified src/signals/internal/filestat/filestat.go:
- Added containsAtWordBoundary() function that checks if a substring appears bounded by delimiters (-, _, ., space) or string edges
- Added isDelimiter() helper function
- Changed substring matching to use word-boundary awareness
- Added "production" as an explicit pattern (since "prod" in "production" isn't at a word boundary)

Updated src/signals/internal/filestat/filestat_test.go:
- Expanded TestMatchFile_Substrings with cases that should and shouldn't match
- Added TestContainsAtWordBoundary and TestIsDelimiter unit tests

Behavior:
| Filename            | Before  | After      |
|---------------------|---------|------------|
| prod-data.csv       | ✓ match | ✓ match    |
| production-dump.sql | ✓ match | ✓ match    |
| my-product.csv      | ✓ match | ✗ no match |
| produce-list.txt    | ✓ match | ✗ no match |
| prodded-users.csv   | ✓ match | ✗ no match |
Supports Terminal.app, iTerm2, and Ghostty
Copilot AI review requested due to automatic review settings December 26, 2025 18:46
@codecov-commenter
Copy link

codecov-commenter commented Dec 26, 2025

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

❌ Patch coverage is 60.37736% with 42 lines in your changes missing coverage. Please review.
✅ Project coverage is 86.80%. Comparing base (784e6ff) to head (e4a2831).

Files with missing lines Patch % Lines
src/signals/secure_keyboard.go 52.94% 40 Missing ⚠️
src/signals/internal/filestat/filestat.go 90.00% 1 Missing and 1 partial ⚠️
❗ Your organization needs to install the Codecov GitHub app to enable full functionality.
Additional details and impacted files
@@            Coverage Diff             @@
##             main      #50      +/-   ##
==========================================
- Coverage   87.47%   86.80%   -0.68%     
==========================================
  Files          60       61       +1     
  Lines        4040     4144     +104     
==========================================
+ Hits         3534     3597      +63     
- Misses        360      399      +39     
- Partials      146      148       +2     
Flag Coverage Δ
unittests 86.80% <60.37%> (-0.68%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR introduces a new security signal that detects when macOS terminal applications (Terminal.app, iTerm2, or Ghostty) are running without Secure Keyboard Entry enabled, which could allow keyloggers to intercept sensitive input like passwords and API tokens.

Key Changes:

  • Adds a new SecureKeyboardSignal that checks if terminal apps have Secure Keyboard Entry disabled
  • Enhances file pattern matching with word-boundary awareness to prevent false positives (e.g., "prod" no longer matches "product")
  • Includes comprehensive test coverage and detailed security documentation

Reviewed changes

Copilot reviewed 7 out of 8 changed files in this pull request and generated no comments.

Show a summary per file
File Description
src/signals/secure_keyboard.go Implements the SecureKeyboardSignal with process enumeration and plist reading to detect insecure terminal configurations on macOS
src/signals/secure_keyboard_test.go Provides comprehensive test coverage with 20+ test cases covering edge cases, error handling, context cancellation, and plist parsing scenarios
src/signals/registry.go Registers the new SecureKeyboardSignal in the global signal registry
src/signals/internal/filestat/filestat.go Adds word-boundary matching logic to prevent "prod" from incorrectly matching "product", "produce", etc.
src/signals/internal/filestat/filestat_test.go Adds extensive test coverage for the new word-boundary matching functionality
go.mod Adds dependencies for process enumeration (mitchellh/go-ps) and plist parsing (howett.net/plist)
go.sum Updates dependency checksums for the new packages
docs/signals/secure_keyboard.md Provides comprehensive documentation explaining the security risk, remediation steps, and best practices for Secure Keyboard Entry

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@erichs erichs merged commit c5ae54a into main Dec 26, 2025
7 of 8 checks passed
@erichs erichs deleted the secure-keyboard-signal branch December 26, 2025 20:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

Comments