You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+61-42Lines changed: 61 additions & 42 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,65 +6,69 @@
6
6
7
7
# CodeScanAI
8
8
9
-
CodeScanAI utilizes a variety of AI models to scan your codebase for bad development practices. It is currently configured to catch potential security vulnerabilities, but will be extended to other use cases in the future. It leverages powerful LLM models to provide suggestions on ways to improve the security of your codebase from external attacks, unauthorized access, etc. The currently supported AI models include:
9
+
CodeScanAI utilizes a variety of AI models to scan your codebase for security vulnerabilities. It leverages powerful LLM models to identify risks and provide actionable remediation suggestions. The currently supported AI providers include:
10
10
11
11
- OpenAI,
12
12
- Google Gemini, and
13
-
- custom self-hosted AI servers.
13
+
- custom self-hosted AI servers (Ollama, etc.).
14
14
15
-
It has also been designed to enable seamless integration into CI/CD pipelines like GitHub Actions, or can be used via a simple CLI command locally. The idea behind CodeScanAI is to enable developers automatically detect potential security issues in their code throughout the development process.
15
+
It has been designed to integrate seamlessly into CI/CD pipelines like GitHub Actions, or can be used via a simple CLI command locally.
16
16
17
17
Check out the detailed [demo and setup](https://github.com/codescan-ai/codescanai-demo) and try it out today!
18
18
19
+
## What's new in v0.1.2
20
+
21
+
-**Pydantic-AI agent scanner:** Files are now scanned one at a time by a structured AI agent, returning typed `FileScanResult` output instead of a raw markdown string.
22
+
-**Inline PR review comments:** When running a PR scan, findings are posted as inline review comments directly on the relevant line in the diff. Falls back to a regular issue comment for architectural findings with no specific line.
23
+
-**Diff-aware analysis:** When scanning a PR or local git diff, changed lines are highlighted with a `[CHANGED]` marker in the prompt. The agent prioritises those lines while retaining full file context for accurate data flow analysis.
24
+
19
25
## Features
20
26
21
27
-**Flexible Scanning Options:**
22
-
-**Full Directory Scans:** You can perform a comprehensive security analysis by scanning all files within a directory.
23
-
-**Changes Only Scan:** Supports the ability to scan only those files that have changed since the last scan.
24
-
-**PR-Specific Scans:** Only scan the files modified in a specific pull request to optimize the scanning process, reduce overhead and ensure new code changes are up to standard.
28
+
-**Full Directory Scans:** Comprehensive security analysis across all files in a directory.
29
+
-**Changes Only Scan:** Scan only files changed since the last commit (`--changes_only`).
30
+
-**PR-Specific Scans:** Scan only files modified in a specific pull request, with findings posted as inline review comments.
31
+
32
+
-**Diff-Aware PR Analysis:**
33
+
34
+
When scanning a pull request, CodeScanAI fetches the exact lines changed in the diff and annotates them for the agent. This focuses the analysis on new and modified code while preserving full file context to avoid false negatives.
25
35
26
36
-**Support for Multiple AI Models:**
27
37
28
-
CodeScanAI provides support for a range of AI models. It currently supports OpenAI, Google Gemini, and self hosted model. Based on user demands, we can add support for other popular AI models like Claude, Grok, etc.
38
+
Supports OpenAI, Google Gemini, and any self-hosted OpenAI-compatible server. Support for additional providers can be added on demand.
29
39
30
40
-**CI/CD Integration:**
31
41
32
-
- Seamlessly integrate the CLI tool into GitHub Actions for automated security vulnerability scanning on every pull request.
33
-
- Supports targeted scans on specific branches or changes within a repository.
42
+
Integrate into GitHub Actions for automated security scanning on every pull request. Supports targeted scans on specific branches or changes within a repository.
34
43
35
44
## Getting Started
36
45
37
46
### Prerequisites
38
47
39
48
- Python 3.10 or higher
40
-
- API keys for the supported AI models:
49
+
- API key for your chosen provider:
41
50
- OpenAI API key, OR
42
51
- Gemini API key, OR
43
52
- Access to a custom AI server (host, port, and optional token)
44
-
- Set an environment variable for your API key(s).
45
53
46
54
```bash
47
-
export OPENAI_API_KEY = 'your_openai_api_key'
55
+
export OPENAI_API_KEY='your_openai_api_key'
48
56
49
-
export GEMINI_API_KEY = 'your_gemini_api_key'
57
+
export GEMINI_API_KEY='your_gemini_api_key'
50
58
```
51
59
52
60
### Installation
53
61
54
62
#### Option 1: Install via pip
55
63
56
-
You can install the tool directly from the repository using pip:
57
-
58
64
```bash
59
65
pip install codescanai
60
66
```
61
67
62
-
This will allow you to use the `codescanai` command directly in your terminal.
68
+
This will make the `codescanai` command available directly in your terminal.
63
69
64
70
#### Option 2: Clone the Repository
65
71
66
-
If you prefer to clone the repository and install the dependencies manually:
|`github_token`| GitHub API token (required for PR scans)|`false`|`""`|
132
+
|`host`| Custom AI server host|`false`|`""`|
133
+
|`port`| Custom AI server port|`false`|`""`|
134
+
|`token`| Token for authenticating with the custom AI server|`false`|`""`|
135
+
|`endpoint`| API endpoint for the custom server|`false`|`/api/v1/scan`|
115
136
116
137
### Limitations
117
138
118
-
-**Large number of files:**We currently do not support scalable way to scan a large number of files on a single run. Depending on the capacity of your AI Provider, you might run into a `rate_limit_exceeded` error. To do this, you can create a custom solution that breaks down the number of files for each run.
139
+
-**Rate limits:**Depending on your AI provider's capacity, scanning a large number of files in a single run may hit rate limits. The V2 scanner processes files one at a time, which helps, but you may still need to break up very large directories manually.
119
140
120
141
## Future Work
121
142
122
-
-**Batch Processing:** For the limitation above, a future version will be to implement batch processing for a large number of files.
123
-
124
-
-**Caching Implementation:** A caching mechanism to store results of previously scanned files, reducing the number of API calls and optimizing performance.
143
+
-**Caching:** Store results of previously scanned files to reduce API calls and speed up repeat scans.
125
144
126
-
-**Expanded Git Provider Support:**The tool is currently integrated with GitHub for PR-based scanning, future plans include extending support to other Git providers like GitLab, Bitbucket, and Azure Repos.
145
+
-**Expanded Git Provider Support:**Currently integrated with GitHub. Future plans include GitLab, Bitbucket, and Azure Repos.
127
146
128
-
-**Expanded Development tools:**This will be a plan to expand this tool to be accessible in other development environments. For example, as a VSCode extension.
147
+
-**Expanded Development Tools:**Plans to make CodeScanAI accessible as a VSCode extension and in other development environments.
0 commit comments