Local CLI for Rails dependency vulnerability triage
Project description
security-agent
security-agent is a local CLI for Ruby on Rails repositories that finds vulnerable gems, uses LLM-based agentic reachability analysis to inspect whether vulnerable functionality appears reachable in your app, and ranks what to patch first.
This is an early MVP. It is designed for technical users and small teams, not as a fully hardened enterprise scanner.
Current Scope
- Ruby on Rails repositories only
- Bundler /
Gemfile.lockdependency matching - Local advisory cache built from GitHub Advisory Database data
- Agent-assisted reachability analysis for the top matched advisories
- Terminal and JSON output
Requirements
- Python 3.11+
- A Rails repository with
Gemfile,Gemfile.lock,app/, andconfig/routes.rb - Network access for
security-agent advisories update OPENAI_API_KEYif you want real agentic analysis with OpenAI
Install
pip install security-agent
Quickstart
- Build the local advisory cache:
security-agent advisories update
- Set your OpenAI API key:
export OPENAI_API_KEY="your_api_key_here"
- Scan a Rails repository:
security-agent scan /path/to/rails-repo --investigator openai
Recommended Usage
The recommended real investigator for this MVP is openai.
security-agent scan /path/to/rails-repo --investigator openai
You can also request JSON output:
security-agent scan /path/to/rails-repo --investigator openai --json
--json writes the structured result to stdout. Progress and retry messages are written to stderr, so the JSON stays machine-readable.
Example
Terminal:
security-agent scan ../progress_tracker --investigator openai
JSON:
security-agent scan ../progress_tracker --investigator openai --json > result.json
Example Output
During investigation, progress and retry messages are printed to stderr. The final human-readable report is printed afterward. Real terminal output may be colored in auto or always color mode; use --color never when you need plain text with no ANSI escape codes.
$ security-agent scan /path/to/rails-repo --investigator openai --max-investigations 1 --color never
Investigation 1/1: GHSA-xxxx-yyyy-zzzz (actionpack)
security-agent
Repo: /path/to/rails-repo
Type: rails
Dependencies: 82
Findings: 2
Investigated: 1
Summary: 1 investigated, 1 high-priority findings
[HIGH] actionpack 7.0.7 CVE-2024-47887
Severity: high (direct)
Reachability: possibly_reachable
Confidence: 0.78
Fix: 7.0.8.7, 7.1.4.1
Investigator: openai
Summary: Possible ReDoS in HTTP token authentication parsing.
Investigation: The app enables token authentication on API controllers, so the vulnerable parser may be reachable from authenticated API requests.
Evidence: Token authentication is configured for API requests (app/controllers/api/base_controller.rb:12)
Evidence: API routes expose JSON endpoints under /api (config/routes.rb:8)
[MEDIUM] nokogiri 1.15.4 GHSA-abcd-1234-efgh
Severity: medium (transitive)
Reachability: not_investigated
Confidence: n/a
Fix: 1.16.2
Investigator: not_run
Summary: XML parsing advisory matched through a transitive dependency.
How It Works
- Parse
Gemfile.lock - Match installed gems against the local advisory cache
- Prioritize matched advisories for investigation using advisory severity and whether the vulnerable gem is a direct dependency
- Investigate the top 3 advisories by default with a bounded, read-only agentic reachability analysis
- Rerank findings using severity, directness, reachability status, confidence, and investigation evidence
- Return reachability evidence and a patch-priority report
Current default investigation budget:
security-agent scan /path/to/rails-repo --max-investigations 3
Commands
Update the advisory cache:
security-agent advisories update
Scan with the default mock investigator:
security-agent scan /path/to/rails-repo
Scan with OpenAI:
security-agent scan /path/to/rails-repo --investigator openai
Limitations
- Rails only
- Reachability judgments are not exploit proofs
- Only the top matched advisories are investigated per scan
- Advisory data is local and must be refreshed with
security-agent advisories update - Provider failures may fall back to the mock investigator
Troubleshooting
Missing advisory cache:
error: Advisory cache not found ... Run `security-agent advisories update` first.
Fix:
security-agent advisories update
Missing OpenAI API key:
If you run --investigator openai without OPENAI_API_KEY, the scan will fall back to the mock investigator.
Provider timeout or temporary API failure:
security-agentretries transient OpenAI failures with exponential backoff- if retries are exhausted, the scan falls back to the mock investigator
- fallback details appear in the result output
Advisory update fails:
- verify you have network access
- retry
security-agent advisories update - if needed, override the source URL with
--source-url
Exit Codes
0: scan completed and found no matched advisories1: scan completed and found one or more matched advisories2: usage error or setup error, such as unsupported repo shape or missing advisory cache
MVP Positioning
This release is an early technical MVP. The scanner is designed to be evidence-driven and narrow in its claims:
- it can tell you what looks reachable in your repository
- it does not prove exploitability
- it is intended to help developers prioritize, not replace full security review
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file security_agent-0.1.2.tar.gz.
File metadata
- Download URL: security_agent-0.1.2.tar.gz
- Upload date:
- Size: 30.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5084bf9f1a423ac7a4fd37ea121a4d2255ed815984756b7743375a5f1935e0f6
|
|
| MD5 |
4b9096af4424ebb9fba7015e92366f77
|
|
| BLAKE2b-256 |
a02dfd8a84bc96bfd8a67c1291ece855cc6b7e342553e6ee8785f0b097153899
|
File details
Details for the file security_agent-0.1.2-py3-none-any.whl.
File metadata
- Download URL: security_agent-0.1.2-py3-none-any.whl
- Upload date:
- Size: 24.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.11.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
13aa22f0019f786c95f7ede68cb2c9ac1afa72881d072b7efbbc0bd28f418233
|
|
| MD5 |
053cad4b7403cf0849c4e59c54f224f1
|
|
| BLAKE2b-256 |
1b698ff3e6bf557968c149efe588f8a15fe76d05ad396b437629afad83b07469
|