Skip to content

fix: add support for detecting Apple Command Line Tools stubs in executors and detectors#71

Merged
ashishkurmi merged 2 commits into
step-security:mainfrom
shubham-stepsecurity:sm/fix
May 13, 2026
Merged

fix: add support for detecting Apple Command Line Tools stubs in executors and detectors#71
ashishkurmi merged 2 commits into
step-security:mainfrom
shubham-stepsecurity:sm/fix

Conversation

@shubham-stepsecurity
Copy link
Copy Markdown
Member

What does this PR do?

Type of change

  • Bug fix
  • Enhancement
  • Documentation

Testing

  • Tested on macOS (version: ___)
  • Binary runs without errors: ./stepsecurity-dev-machine-guard --verbose
  • JSON output is valid: ./stepsecurity-dev-machine-guard --json | python3 -m json.tool
  • No secrets or credentials included
  • Lint passes: make lint
  • Tests pass: make test

Related Issues

Copy link
Copy Markdown

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 adds macOS-specific protection to avoid invoking Apple Command Line Tools (CLT) “install prompt” shims (notably under /usr/bin/) during Python-related detection/scanning, preventing disruptive GUI prompts on machines without CLT installed.

Changes:

  • Extends the executor.Executor interface with IsAppleCLTStub(ctx, binPath) and implements it in Real, Mock, and UserAwareExecutor.
  • Updates Python detectors/scanners to skip /usr/bin/ CLT shim binaries when CLT is not installed, and adds targeted unit tests.
  • Includes minor gofmt/alignment-only edits in several files.

Reviewed changes

Copilot reviewed 9 out of 13 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
internal/model/model.go Formatting/alignment-only struct field changes.
internal/executor/executor.go Adds IsAppleCLTStub to the interface and implements CLT presence probing + caching in Real.
internal/executor/user_aware.go Forwards IsAppleCLTStub to the wrapped executor.
internal/executor/mock.go Adds CLT-installed flag + IsAppleCLTStub behavior to the mock.
internal/executor/mock_test.go Adds unit tests covering mock CLT-stub detection behavior.
internal/detector/pythonscan.go Skips invoking Apple CLT shim binaries during global Python scanning.
internal/detector/pythonscan_test.go Adds tests ensuring stub binaries are skipped without CLT and scanned with CLT.
internal/detector/pythonpm.go Skips invoking Apple CLT shim binaries for Python PM detection and pip package listing.
internal/detector/pythonpm_test.go Adds tests for skipping stubs on darwin without CLT + ensuring behavior on darwin with CLT and on linux.
internal/detector/brew.go Formatting/alignment-only struct field changes.
internal/detector/aicli.go Comment formatting adjustments.
internal/detector/aicli_test.go Minor spacing/alignment in test table.
internal/detector/agent.go Minor spacing/alignment in struct definition.

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

Comment thread internal/executor/executor.go
Comment thread internal/executor/mock.go Outdated
@ashishkurmi ashishkurmi merged commit ef036bb into step-security:main May 13, 2026
5 checks passed
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.

3 participants