Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
73 commits
Select commit Hold shift + click to select a range
7c60e8c
Delete .claude
edward-playground Nov 10, 2025
8d64ae0
Updated .gitignore
Nov 10, 2025
2acd67d
Rename service and enhance README clarity
edward-playground Nov 10, 2025
c32a33a
Revise README
edward-playground Nov 10, 2025
492d9c5
Updates: Software package versions
Nov 10, 2025
95f2db8
Updates on Parser - now with Node.js. Other minor fixes.
Nov 11, 2025
a11e6b9
Minor update: security.yml
Nov 11, 2025
f4c2849
Update README
edward-playground Nov 11, 2025
8a46e54
Minor updates (Readme, Installation Guides)
Nov 11, 2025
e4168b4
Minor Updates - Claude config
Nov 11, 2025
cc636cf
Major Updates - adding more tools
Nov 13, 2025
8051184
Major Updates - bug fixes, tools improvements
Nov 14, 2025
ab20425
Minor Update: File Structure
Nov 14, 2025
5fb39cd
Minor Update: File Structure
Nov 14, 2025
1e4d041
Major Update - bug fixes
Nov 15, 2025
06242c4
Major Updates - bug fixes
Nov 15, 2025
da507a4
Fix: Correct GitHub repository name (aidefense-framework)
Nov 18, 2025
a841073
Fix - Embedding model update
Nov 18, 2025
58e56ea
Fix - bug fixes
Nov 18, 2025
a2c4b81
Minor Update - Comprehensive Search tool
Nov 18, 2025
fa33a22
Minor - bug fix (Comprehensive Search)
Nov 18, 2025
2ca31d5
Minor bug fix on comprehensive search
Nov 18, 2025
0e019be
Added tools and corresponding tests
Nov 19, 2025
d1a0d45
Major Updates - tools addition, performance improvements, bug fixes, …
Nov 22, 2025
d428632
Minor Updates + Clean up. Updated MCP installation experience
Nov 23, 2025
6d7e3a4
Update - installation through scripts/install.py
Nov 27, 2025
af67a88
Update - bug fixes
Nov 27, 2025
6ba1204
Enhance installation guide and script for Claude Code support
Nov 27, 2025
68437f0
Update - bug fix
Nov 27, 2025
5e1e583
Update - fixed cwd path bug
Nov 28, 2025
9e5190d
Update - Visual C++ redistributable link updated
Nov 28, 2025
213c7bf
Update - description and isntallation display updates
Nov 28, 2025
9605405
Minor fix - displaying issue
Nov 28, 2025
28b74fe
Minor fix - update installation progress function
Nov 28, 2025
dd5f174
Minor fix - update installation display issue
Nov 28, 2025
428a2d7
Minor fix - timestamp
Nov 28, 2025
960a093
Minor fix - timestamp
Nov 28, 2025
78d554a
Fix - included required dependencies and verification workflow
Nov 28, 2025
ce76c5e
Readme updates
Nov 28, 2025
374f804
Update - semi-automated installation of components
Nov 28, 2025
b3df426
Minor updates - dependencies doc and requirements
Nov 28, 2025
090d899
Minor fix - pywin32 version
Nov 28, 2025
d5e8645
Update - installation workflow improvment
Nov 28, 2025
b4a5c20
Minor fix - installation workflow
Nov 28, 2025
5d4aa85
Bug fix for installation workflow
Nov 28, 2025
81c1ce0
Update - installation message
Nov 28, 2025
8e6fec8
Bug fix - installation flow
Nov 28, 2025
2c1b9b4
Major update - UX enhancement (int8 quantization on model)
Nov 28, 2025
fa37703
Minor update - installation messages
Nov 28, 2025
74b56f6
Installation message fix
Nov 28, 2025
78343cd
Bug fix on new quantization model setting
Nov 28, 2025
6434e19
Bug fixes
Nov 28, 2025
f567385
Bug fix - dependency compatibility
Nov 28, 2025
eaf7668
Updated installation workflow
Nov 28, 2025
d615051
Minor bug fixes - display issue
Nov 28, 2025
db039a6
Enhancements - displaying model and model replacement instructions
Nov 29, 2025
d963c11
Enhancements - info display
Nov 29, 2025
140bb0b
Enhancements - visual
Nov 29, 2025
0c1e0c1
Enhancements - numbers updates
Nov 29, 2025
3c3a3e8
Update - tools combination & update
Dec 5, 2025
2f05bc0
Minor bug fixes - sync/util
Dec 5, 2025
9b3f738
Enhancemets - frameworks mapping updates & Testing files addition/upd…
Dec 5, 2025
30d366d
Major bug fixes - tools
Dec 6, 2025
0f4a81e
Minor Update - tool (technique comparison)
Dec 6, 2025
aa07242
Documentation & description updates
Dec 6, 2025
4f22832
Minor update - test file cleanup
Dec 6, 2025
dbc1995
Project status update
Dec 7, 2025
c697a50
Updated documentations
Dec 7, 2025
cfa6bda
Enhancements - Docker config & datetime fix
Dec 7, 2025
cb1e939
Updates - documentations clean up & improvements
Dec 7, 2025
1613ff8
Minor Update - dependency installation
Dec 8, 2025
37886f5
Minor Update - documentation accuracy adjustments
Dec 8, 2025
280b96d
chore(deps)(deps): bump beautifulsoup4 from 4.12.3 to 4.14.3
dependabot[bot] Dec 15, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 0 additions & 10 deletions .claude/settings.local.json

This file was deleted.

62 changes: 62 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
# Docker ignore file - exclude unnecessary files from build context

# Data and databases
data/
*.lancedb/
*.log
logs/

# Python
__pycache__/
*.py[cod]
*$py.class
*.so
.Python
*.egg-info/
dist/
build/

# Virtual environments
venv/
env/
.venv/

# IDE
.vscode/
.idea/
*.swp
*.swo
*~
.DS_Store

# Git
.git/
.gitignore
.gitattributes

# Environment
.env
.env.local

# Documentation (not needed in container)
README.md
SECURITY.md
docs/

# Testing
tests/
.pytest_cache/
.coverage
htmlcov/

# Development dependencies
requirements-dev.txt

# Docker
Dockerfile
docker-compose.yml
.dockerignore

# CI/CD
.github/
.gitlab-ci.yml
67 changes: 62 additions & 5 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

# GitHub Repository
GITHUB_REPO_OWNER=edward-playground
GITHUB_REPO_NAME=aidefend-framework
GITHUB_REPO_NAME=aidefense-framework
GITHUB_BRANCH=main
GITHUB_TACTICS_PATH=tactics

Expand All @@ -15,15 +15,66 @@ ENABLE_AUTO_SYNC=true
# API Configuration
API_HOST=127.0.0.1
API_PORT=8000

# ⚠️ IMPORTANT: Multi-worker mode is NOT supported
# The sync architecture requires a single worker process.
# Setting API_WORKERS > 1 will cause sync conflicts and stale data issues.
# Keep this value at 1 for correct operation.
API_WORKERS=1

# Security
MAX_QUERY_LENGTH=2000
# MAX_QUERY_LENGTH set to 1500 to align with bge-small-en-v1.5 model's 512 token limit
# (1500 chars ≈ 375 tokens with 4:1 ratio, leaving buffer for system overhead)
MAX_QUERY_LENGTH=1500
MAX_TOP_K=20
DEFAULT_TOP_K=5
ENABLE_RATE_LIMITING=true
RATE_LIMIT_PER_MINUTE=60

# Chunked Query Configuration (for long text processing)
# Enables automatic chunking for queries exceeding MAX_QUERY_LENGTH
# Conservative defaults (5000 chars, 5 chunks) balance functionality with security
#
# MAX_TOTAL_QUERY_LENGTH: Maximum total query length (default: 5000 chars)
# - Queries > MAX_QUERY_LENGTH are automatically chunked
# - Each chunk is searched independently, results are combined
# - Use case: Long vulnerability reports, security documents
# - Security: Prevents DoS via excessive input size
# MAX_CHUNKS: Maximum number of chunks per query (default: 5)
# - Limits computational overhead
# - 5 chunks × 1200 chars = ~6000 chars effective capacity
# - Security: Prevents DoS via excessive chunk count
# MAX_CHUNKS_PROCESSING_TIME: Timeout for chunked queries (default: 15 seconds)
# - Prevents long-running queries from blocking the service
# - Security: Timeout protection against resource exhaustion
#
# Example: A 3000-character security report will be split into ~3 chunks,
# searched separately, and results will be deduplicated and ranked.
#
# MAX_TOTAL_QUERY_LENGTH=5000
# MAX_CHUNKS=5
# MAX_CHUNKS_PROCESSING_TIME=15
# CHUNK_SIZE=1200
# CHUNK_OVERLAP=200

# Authentication (REST API only - MCP mode uses file permissions)
# AUTH_MODE options:
# - "no_auth" (default): No authentication required
# ✓ Suitable for: Local development, personal use on localhost
# ✗ NOT suitable for: Production deployment, public networks
# - "api_key": Require API key in X-API-Key header
# ✓ Suitable for: Production deployment, team collaboration, CI/CD
# ⚠️ Requires: AIDEFEND_API_KEY to be set
#
# To enable API key authentication:
# 1. Uncomment AUTH_MODE and set to "api_key"
# 2. Generate key: python scripts/generate_api_key.py
# 3. Uncomment AIDEFEND_API_KEY and paste the generated key
# 4. Restart the service
#
# AUTH_MODE=no_auth
# AIDEFEND_API_KEY=<paste-your-generated-api-key-here>

# CORS
ENABLE_CORS=true
# CORS_ORIGINS=["http://localhost:*","https://localhost:*"]
Expand All @@ -40,6 +91,12 @@ ENABLE_FILE_LOGGING=true
# LOG_PATH=./data/logs/aidefend_mcp.log

# Advanced: Embedding model (uses FastEmbed with ONNX Runtime)
# Default: BAAI/bge-small-en-v1.5 (lightweight, fast, 384-dim)
# Alternative: sentence-transformers/all-MiniLM-L6-v2 (also supported)
# EMBEDDING_MODEL=BAAI/bge-small-en-v1.5
# Default: Xenova/multilingual-e5-base (Microsoft, multilingual, 768-dim, 512 tokens, 100+ languages)
# - Model size: ~265 MB (int8 quantized), supports cross-language semantic search
# - Allows users to query in any language (e.g., Chinese, Japanese) and match English content
# Alternative options:
# - intfloat/multilingual-e5-small: Smaller (113 MB), 384-dim, good performance
# - sentence-transformers/paraphrase-multilingual-MiniLM-L12-v2: 220 MB, 384-dim, 50+ languages
# Embedding Configuration
EMBEDDING_MODEL=Xenova/multilingual-e5-base
EMBEDDING_DIMENSION=768
46 changes: 46 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
version: 2
updates:
# Python dependencies
- package-ecosystem: "pip"
directory: "/"
schedule:
interval: "weekly"
day: "monday"
time: "09:00"
timezone: "UTC"
open-pull-requests-limit: 5
labels:
- "dependencies"
- "python"
commit-message:
prefix: "chore(deps)"
include: "scope"
# Group minor and patch updates together
groups:
dev-dependencies:
patterns:
- "pytest*"
- "black"
- "flake8"
- "mypy"
- "bandit"
- "safety"
update-types:
- "minor"
- "patch"

# GitHub Actions
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "weekly"
day: "monday"
time: "09:00"
timezone: "UTC"
open-pull-requests-limit: 3
labels:
- "dependencies"
- "github-actions"
commit-message:
prefix: "chore(ci)"
include: "scope"
95 changes: 95 additions & 0 deletions .github/workflows/security.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
name: Security Scan

on:
push:
branches: [ main, develop ]
pull_request:
branches: [ main, develop ]
schedule:
# Run weekly on Monday at 00:00 UTC
- cron: '0 0 * * 1'
workflow_dispatch: # Allow manual trigger

permissions:
contents: read
security-events: write

jobs:
bandit:
name: Bandit Security Scan
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'

- name: Install Bandit
run: pip install bandit[toml]

- name: Run Bandit security scan
run: |
bandit -r app/ -f json -o bandit-report.json || true
bandit -r app/ -f screen
continue-on-error: true

- name: Upload Bandit results
uses: actions/upload-artifact@v4
if: always()
with:
name: bandit-report
path: bandit-report.json

safety:
name: Safety Dependency Check
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.11'

- name: Install Safety
run: pip install safety

- name: Check dependencies with Safety
run: |
safety check -r requirements.txt --json > safety-report.json || true
safety check -r requirements.txt
continue-on-error: true

- name: Upload Safety results
uses: actions/upload-artifact@v4
if: always()
with:
name: safety-report
path: safety-report.json

codeql:
name: CodeQL Analysis
runs-on: ubuntu-latest

permissions:
actions: read
contents: read
security-events: write

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Initialize CodeQL
uses: github/codeql-action/init@v3
with:
languages: python

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v3
49 changes: 46 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
# Node.js
node_modules/
npm-debug.log*
yarn-debug.log*
yarn-error.log*
*.tgz
package-lock.7z

# Python
__pycache__/
*.py[cod]
Expand Down Expand Up @@ -52,6 +60,7 @@ data/
# Testing
.pytest_cache/
.coverage
coverage.xml
htmlcov/
.tox/
.hypothesis/
Expand All @@ -67,8 +76,8 @@ dmypy.json
# Distribution / packaging
*.whl

# Docker
*.dockerignore
# Docker volumes and runtime data
docker-compose.override.yml

# Logs
logs/
Expand All @@ -80,4 +89,38 @@ temp/
tmp/

# VSCode Claude extension cache
.claude/
.claude/

# Claude temporary output files (but keep official CLAUDE.md)
CLAUDE_TEMP*.md
CLAUDE_OUTPUT*.md
UPGRADE*.md
UPDATE*.md
*UPDATE*REPORT*.md
!CLAUDE.md

# Test and verification scripts (keep these for documentation)
# tests/fixtures/test_example.js - Example file for parser testing

# Temporary diagnostic/troubleshooting scripts (created during development)
scripts/diagnose_*.py
scripts/compare_*.py
scripts/find_*.py
scripts/check_*.py
scripts/test_*.py

# Security: Sensitive files that must NEVER be committed
# These patterns are critical for security
.env
.env.*
!.env.example
*.key
*.pem
*.p12
*_secret*
*_private*
credentials*.json
secrets*.json

# Windows command error artifacts
nul
Loading
Loading