Skip to content

feat(detector): add PatchWarden detection - #180

Open
jiezeng2004-design wants to merge 2 commits into
step-security:mainfrom
jiezeng2004-design:codex/detect-patchwarden
Open

feat(detector): add PatchWarden detection#180
jiezeng2004-design wants to merge 2 commits into
step-security:mainfrom
jiezeng2004-design:codex/detect-patchwarden

Conversation

@jiezeng2004-design

Copy link
Copy Markdown

Summary

  • detect PatchWarden as an OpenSource AI CLI when the patchwarden binary is on PATH
  • resolve npm version and install metadata without executing the MCP stdio entrypoint
  • avoid treating stale .patchwarden/ task artifacts as installation evidence
  • document the detector and its metadata-only version behavior

Why

PatchWarden is installed as an npm CLI, but its executable starts an MCP stdio
server rather than behaving like a conventional --version command. Detector
version probing must therefore use static package metadata and return unknown
when metadata is unavailable.

The detector is deliberately binary-first. A repository can retain a
.patchwarden/ directory after the CLI has been removed, so project artifacts
alone are not reliable installation evidence.

Validation

  • gofmt -d internal/detector/aicli.go internal/detector/aicli_test.go
  • go test ./internal/detector -run PatchWarden -count=1
  • go vet ./...
  • cross-platform go build ./... for Windows, Linux, and macOS amd64 with CGO_ENABLED=0
  • go mod tidy leaves go.mod and go.sum unchanged
  • git diff --check

The four focused tests cover Unix npm metadata, Windows npm shims, missing
metadata without process execution, and stale project artifacts.

@jiezeng2004-design
jiezeng2004-design marked this pull request as ready for review July 25, 2026 11:10
Copilot AI review requested due to automatic review settings July 25, 2026 11:10

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

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