Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,27 @@ cd claude-code-security-review
pytest claudecode -v
```

## Windows setup

To run the Claude Code Security Review on Windows:

1. Install Node.js (v18 or later) and npm:
- Download from https://nodejs.org or use nvm-windows.
2. Install the Claude CLI:npm install -g @anthropic-ai/claude-code
Copy link
Preview

Copilot AI Aug 9, 2025

Choose a reason for hiding this comment

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

The installation command is missing proper formatting and line breaks. It should be formatted as a code block for clarity.

Suggested change
2. Install the Claude CLI:npm install -g @anthropic-ai/claude-code
2. Install the Claude CLI:
```bash
npm install -g @anthropic-ai/claude-code

Copilot uses AI. Check for mistakes.


3. Add npm global directory to PATH:$npmPath = npm config get prefix
[Environment]::SetEnvironmentVariable("Path", [Environment]::GetEnvironmentVariable("Path", "User") + ";$npmPath", "User")

4. Set PowerShell execution policy:Set-ExecutionPolicy -Scope CurrentUser -ExecutionPolicy RemoteSigned
5. Verify installation:claude --version

Copy link
Preview

Copilot AI Aug 9, 2025

Choose a reason for hiding this comment

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

The PowerShell commands are not properly formatted as code blocks and appear as continuous text. These should be separate code blocks with proper formatting.

Suggested change
2. Install the Claude CLI:
```powershell
npm install -g @anthropic-ai/claude-code
  1. Add npm global directory to PATH:

    $npmPath = npm config get prefix
    [Environment]::SetEnvironmentVariable("Path", [Environment]::GetEnvironmentVariable("Path", "User") + ";$npmPath", "User")
  2. Set PowerShell execution policy:

    Set-ExecutionPolicy -Scope CurrentUser -ExecutionPolicy RemoteSigned
  3. Verify installation:

    claude --version

Copilot uses AI. Check for mistakes.

Copy link
Preview

Copilot AI Aug 9, 2025

Choose a reason for hiding this comment

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

Missing proper formatting for the PowerShell command. Should be in a code block for better readability.

Suggested change
4. Set PowerShell execution policy:
```powershell
Set-ExecutionPolicy -Scope CurrentUser -ExecutionPolicy RemoteSigned
  1. Verify installation:

    claude --version

Copilot uses AI. Check for mistakes.

Copy link
Preview

Copilot AI Aug 9, 2025

Choose a reason for hiding this comment

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

The command should be formatted as a code block for consistency with documentation standards.

Suggested change
5. Verify installation:

claude --version

Copilot uses AI. Check for mistakes.

Expected output: 1.0.71 (Claude Code) or similar.

Troubleshooting
Copy link
Preview

Copilot AI Aug 9, 2025

Choose a reason for hiding this comment

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

Missing proper markdown heading formatting. Should be '### Troubleshooting' to maintain documentation hierarchy.

Suggested change
Troubleshooting
### Troubleshooting

Copilot uses AI. Check for mistakes.


Claude CLI not found: Ensure claude.ps1 or claude.cmd is in PATH and execution policy is RemoteSigned.
Test failures: Verify npm is installed and check logs in github_action_audit.py for errors.

## Support

For issues or questions:
Expand Down
44 changes: 15 additions & 29 deletions claudecode/github_action_audit.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
SUBPROCESS_TIMEOUT
)
from claudecode.logger import get_logger
from claudecode.platform_utils import run_claude_subprocess, get_platform_adapter

logger = get_logger(__name__)

Expand Down Expand Up @@ -230,7 +231,7 @@ def run_security_audit(self, repo_dir: Path, prompt: str) -> Tuple[bool, str, Di
# Run Claude Code with retry logic
NUM_RETRIES = 3
for attempt in range(NUM_RETRIES):
result = subprocess.run(
result = run_claude_subprocess(
cmd,
input=prompt, # Pass prompt via stdin
cwd=repo_dir,
Expand Down Expand Up @@ -313,34 +314,19 @@ def _extract_security_findings(self, claude_output: Any) -> Dict[str, Any]:

def validate_claude_available(self) -> Tuple[bool, str]:
"""Validate that Claude Code is available."""
try:
result = subprocess.run(
['claude', '--version'],
capture_output=True,
text=True,
timeout=10
)

if result.returncode == 0:
# Also check if API key is configured
api_key = os.environ.get('ANTHROPIC_API_KEY', '')
if not api_key:
return False, "ANTHROPIC_API_KEY environment variable is not set"
return True, ""
else:
error_msg = f"Claude Code returned exit code {result.returncode}"
if result.stderr:
error_msg += f". Stderr: {result.stderr}"
if result.stdout:
error_msg += f". Stdout: {result.stdout}"
return False, error_msg

except subprocess.TimeoutExpired:
return False, "Claude Code command timed out"
except FileNotFoundError:
return False, "Claude Code is not installed or not in PATH"
except Exception as e:
return False, f"Failed to check Claude Code: {str(e)}"
# Use platform adapter for robust cross-platform validation
platform_adapter = get_platform_adapter()
is_available, error_msg = platform_adapter.validate_claude_availability()

if not is_available:
return False, error_msg

# Also check if API key is configured
api_key = os.environ.get('ANTHROPIC_API_KEY', '')
if not api_key:
return False, "ANTHROPIC_API_KEY environment variable is not set"

return True, ""



Expand Down
Loading