๐—ง๐—ฒ๐˜€๐˜๐—ถ๐—ป๐—ด ๐—š๐—ฒ๐—บ๐—ถ๐—ป๐—ถ๐—–๐—Ÿ๐—œ ๐—ฆ๐—ฒ๐—ฐ๐˜‚๐—ฟ๐—ถ๐˜๐˜† ๐—˜๐˜…๐˜๐—ฒ๐—ป๐˜€๐—ถ๐—ผ๐—ป๐˜€ ๐—ผ๐—ป ๐—–๐—ผ๐—ฑ๐—ฒ๐—ซ

I tested two new Gemini CLI extensions on the CodeX source code. These tools help with code reviews and security scans.

๐—ง๐—ต๐—ฒ ๐—˜๐˜…๐˜๐—ฒ๐—ป๐˜€๐—ถ๐—ผ๐—ป๐˜€

โ€ข Code Review Extension: This tool checks code changes for quality. Use the /code-review command to start. โ€ข Security Extension: This tool performs SAST scans. It finds vulnerabilities and provides fix suggestions. Use /security:analyze to start.

๐—›๐—ผ๐˜„ ๐˜๐—ผ ๐—œ๐—ป๐˜€๐˜๐—ฎ๐—น๐—น

You can install them using these commands:

โฏ gemini extensions install https://github.com/gemini-cli-extensions/security โฏ gemini extensions install https://github.com/gemini-cli-extensions/code-review

๐—ง๐—ฒ๐˜€๐˜ ๐—ฅ๐—ฒ๐˜€๐˜‚๐—น๐˜๐˜€

I ran the security scan on 65 files from the CodeX repository. The tool found several issues:

โ€ข High Severity: Path Traversal in read_file.rs. The code does not restrict file access to a specific directory. โ€ข Medium Severity: Potential Prompt Injection in codex.rs. User input goes to the model without sanitization. โ€ข Medium Severity: Information Disclosure in otel_event_manager.rs. Sensitive prompts might get logged. โ€ข Low Severity: Hardcoded password in the GitHub release workflow.

๐—ง๐—ต๐—ฒ ๐—–๐—ผ๐˜€๐˜ ๐—ผ๐—ณ ๐—ฆ๐—ฒ๐—ฐ๐˜‚๐—ฟ๐—ถ๐˜๐˜†

Running these scans comes with a price in time and money. For 65 files, the results were:

โ€ข Time: 36 minutes. โ€ข Cost: 23.88 USD.

The speed is similar to traditional SAST tools. The cost is currently high for daily use. You might want to wait for more optimized tools before using this for every scan.

๐—ง๐—ถ๐—ฝ ๐—ณ๐—ผ๐—ฟ ๐—จ๐˜€๐—ฒ๐—ฟ๐˜€

Do not use a standard Google login for large scans. It often fails with error messages. Instead, use a Gemini API Key or Vertex AI for better stability.

Source: https://dev.to/jh5_pulse/shi-ce-geminicli-security-extensions-lai-review-codex-yuan-shi-ma-4h40

Optional learning community: https://t.me/GyaanSetuAi