Skip to content

Commit 69372ca

Browse files
committed
refactor: Replace Bandit with Ruff security checks and cleanup
- Remove Bandit dependency in favor of Ruff's flake8-bandit rules (S prefix) - Update CI/CD workflow to use Ruff for security scanning - Remove Bandit from pre-commit hooks - Update documentation to reflect security scanning with Ruff - Clean up nosec comments since Ruff uses per-file ignores - Remove IMPROVEMENTS.md (historical review document no longer needed) - Simplify toolchain by consolidating security checks into Ruff - Fix pre-commit hook issues (trailing whitespace, EOF, mypy types) - Configure mypy to be less strict for test files Ruff now includes comprehensive security rules from flake8-bandit, making a separate Bandit installation redundant. This reduces dependencies and improves performance while maintaining the same security coverage.
1 parent a5688cf commit 69372ca

18 files changed

Lines changed: 81 additions & 236 deletions

.github/workflows/ci.yml

Lines changed: 25 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -13,38 +13,38 @@ jobs:
1313
matrix:
1414
os: [ubuntu-latest, macos-latest, windows-latest]
1515
python-version: ["3.10", "3.11", "3.12", "3.13"]
16-
16+
1717
steps:
1818
- uses: actions/checkout@v4
19-
19+
2020
- name: Set up Python ${{ matrix.python-version }}
2121
uses: actions/setup-python@v5
2222
with:
2323
python-version: ${{ matrix.python-version }}
24-
24+
2525
- name: Install uv
2626
uses: astral-sh/setup-uv@v3
2727
with:
2828
enable-cache: true
2929
cache-dependency-glob: "uv.lock"
30-
30+
3131
- name: Install dependencies
3232
run: |
3333
uv sync --all-extras --dev
34-
34+
3535
- name: Run linting
3636
run: |
3737
uv run ruff check .
3838
uv run ruff format --check .
39-
39+
4040
- name: Run type checking
4141
run: |
4242
uv run mypy src/
43-
43+
4444
- name: Run tests with coverage
4545
run: |
4646
uv run pytest -v --cov=src/gemini_mcp --cov-report=xml --cov-report=term
47-
47+
4848
- name: Upload coverage to Codecov
4949
if: matrix.os == 'ubuntu-latest' && matrix.python-version == '3.11'
5050
uses: codecov/codecov-action@v4
@@ -59,54 +59,58 @@ jobs:
5959
runs-on: ubuntu-latest
6060
steps:
6161
- uses: actions/checkout@v4
62-
62+
6363
- name: Set up Python
6464
uses: actions/setup-python@v5
6565
with:
6666
python-version: "3.11"
67-
67+
68+
- name: Install uv
69+
uses: astral-sh/setup-uv@v3
70+
6871
- name: Install dependencies
6972
run: |
70-
pip install bandit[toml] safety
71-
73+
uv sync --all-extras --dev
74+
pip install safety
75+
7276
- name: Run security checks
7377
run: |
74-
bandit -r src/ -f json -o bandit-report.json
78+
uv run ruff check --select S --output-format=json > ruff-security-report.json || true
7579
safety check --json --output safety-report.json || true
76-
80+
7781
- name: Upload security reports
7882
uses: actions/upload-artifact@v4
7983
with:
8084
name: security-reports
8185
path: |
82-
bandit-report.json
86+
ruff-security-report.json
8387
safety-report.json
8488
8589
build:
8690
runs-on: ubuntu-latest
8791
needs: [test, security]
8892
steps:
8993
- uses: actions/checkout@v4
90-
94+
9195
- name: Set up Python
9296
uses: actions/setup-python@v5
9397
with:
9498
python-version: "3.11"
95-
99+
96100
- name: Install build tools
97101
run: |
98102
pip install build twine
99-
103+
100104
- name: Build package
101105
run: |
102106
python -m build
103-
107+
104108
- name: Check package
105109
run: |
106110
twine check dist/*
107-
111+
108112
- name: Upload artifacts
109113
uses: actions/upload-artifact@v4
110114
with:
111115
name: dist
112-
path: dist/
116+
path: dist/

.github/workflows/release.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,20 +13,20 @@ jobs:
1313
runs-on: ubuntu-latest
1414
steps:
1515
- uses: actions/checkout@v4
16-
16+
1717
- name: Set up Python
1818
uses: actions/setup-python@v5
1919
with:
2020
python-version: "3.11"
21-
21+
2222
- name: Install build tools
2323
run: |
2424
pip install build
25-
25+
2626
- name: Build package
2727
run: |
2828
python -m build
29-
29+
3030
- name: Upload artifacts
3131
uses: actions/upload-artifact@v4
3232
with:
@@ -45,8 +45,8 @@ jobs:
4545
with:
4646
name: dist
4747
path: dist/
48-
48+
4949
- name: Publish to PyPI
5050
uses: pypa/gh-action-pypi-publish@release/v1
5151
with:
52-
skip-existing: true
52+
skip-existing: true

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,4 +44,4 @@ coverage.xml
4444
dmypy.json
4545

4646
# Ruff
47-
.ruff_cache/
47+
.ruff_cache/

.pre-commit-config.yaml

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,3 @@ repos:
2424
- id: mypy
2525
additional_dependencies: [types-aiofiles, pydantic]
2626
args: [--ignore-missing-imports]
27-
28-
- repo: https://github.com/pycqa/bandit
29-
rev: 1.7.6
30-
hooks:
31-
- id: bandit
32-
args: ["-c", "pyproject.toml"]
33-
additional_dependencies: ["bandit[toml]"]

CONTRIBUTING.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -49,16 +49,16 @@ By participating in this project, you agree to be respectful and constructive in
4949
```bash
5050
# Run all tests
5151
uv run pytest
52-
52+
5353
# Check code style
5454
uv run ruff check .
5555
uv run ruff format .
56-
56+
5757
# Type checking
5858
uv run mypy src/
59-
59+
6060
# Security checks
61-
uv run bandit -r src/
61+
uv run ruff check --select S .
6262
```
6363

6464
6. **Commit Your Changes**
@@ -124,4 +124,4 @@ Releases are managed by maintainers and follow semantic versioning:
124124

125125
## Questions?
126126

127-
Feel free to open an issue for any questions about contributing!
127+
Feel free to open an issue for any questions about contributing!

IMPROVEMENTS.md

Lines changed: 0 additions & 108 deletions
This file was deleted.

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,4 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
1818
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1919
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
2020
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21-
SOFTWARE.
21+
SOFTWARE.

PROJECT_INFO.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,4 +71,4 @@ uv run mypy src/
7171
## Publishing
7272

7373
The project is configured for automated PyPI releases via GitHub Actions.
74-
Create a new release on GitHub to trigger the publication workflow.
74+
Create a new release on GitHub to trigger the publication workflow.

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,7 @@ uv run ruff format .
239239
uv run mypy src/
240240

241241
# Run security checks
242-
uv run bandit -r src/
242+
uv run ruff check --select S .
243243
```
244244

245245
## Troubleshooting
@@ -301,4 +301,4 @@ This project is licensed under the MIT License - see the [LICENSE](LICENSE) file
301301

302302
- Built on top of the [Model Context Protocol](https://github.com/anthropics/mcp)
303303
- Integrates with Google's Gemini CLI (unofficial integration)
304-
- Inspired by the MCP ecosystem and community
304+
- Inspired by the MCP ecosystem and community

examples/claude_desktop_config.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@
66
"description": "Gemini CLI integration for research and analysis"
77
}
88
}
9-
}
9+
}

0 commit comments

Comments
 (0)