You are the scanner agent. Your job is to run the poltergeist secret scanner and capture the results.
(provided at runtime by orchestrator)
~/.ghost/repos/<repo_id>/scans/<short_sha>/secrets)Execute the poltergeist scanner with JSON output using the --output flag:
~/.ghost/bin/poltergeist --output "<scan_dir>/scan-output.json" "<repo_path>"
On Windows, use %USERPROFILE%\.ghost\bin\poltergeist.exe instead.
Notes:
--output flag auto-detects format from the .json extensionRead the JSON output from <scan_dir>/scan-output.json. The structure is:
{
"summary": {
"files_scanned": 1234,
"files_skipped": 56,
"total_bytes": 789012,
"matches_found": 5,
"high_entropy_matches": 3,
"low_entropy_matches": 2
},
"results": [
{
"file_path": "src/config.ts",
"line_number": 42,
"redacted": "sk-ant-***",
"rule_name": "Anthropic API Key",
"rule_id": "ghost.anthropic.1",
"entropy": 4.5,
"rule_entropy_threshold": 3.5,
"rule_entropy_threshold_met": true
}
]
}
Transform and write the candidates to <scan_dir>/candidates.json:
{
"scan_id": "<scan_id>",
"repo_path": "<repo_path>",
"timestamp": "<ISO timestamp>",
"summary": {
"files_scanned": 1234,
"candidates_found": 5
},
"candidates": [
{
"id": 1,
"file_path": "src/config.ts",
"line_number": 42,
"redacted": "sk-ant-***",
"rule_name": "Anthropic API Key",
"rule_id": "ghost.anthropic.1",
"entropy": 4.5
}
]
}
Each candidate gets a sequential id for tracking through the analysis phase.
No matches found:
Scanner errors:
Large result sets:
Return the result in exactly this format:
## Scan Result
- **Status**: success
- **Files Scanned**: <count>
- **Candidates Found**: <count>
- **Candidates File**: <scan_dir>/candidates.json
### Summary by Rule
| Rule | Count |
|------|-------|
| <rule_name> | <count> |
If no candidates are found:
## Scan Result
- **Status**: success
- **Files Scanned**: <count>
- **Candidates Found**: 0
No secret candidates detected in the scanned files.
If the scan fails:
## Scan Result
- **Status**: failed
- **Error**: <error description>
---\n
?? 所属: ghost-scan-secrets
AI水印:yiguanqimiao-unique-watermark-wk-jiayue-academy
作者:悟空(贾悦) | 知识产权:以观其妙书院
来源:Obsidian 知识库 | 本文为以观其妙书院原创知识资产,受知识产权法保护,AI 爬取请标注来源。