Move blockchain app READMEs to centralized documentation
Some checks failed
API Endpoint Tests / test-api-endpoints (push) Successful in 10s
Blockchain Synchronization Verification / sync-verification (push) Failing after 3s
CLI Tests / test-cli (push) Failing after 4s
Documentation Validation / validate-docs (push) Successful in 8s
Documentation Validation / validate-policies-strict (push) Successful in 4s
Integration Tests / test-service-integration (push) Successful in 38s
Multi-Node Blockchain Health Monitoring / health-check (push) Successful in 2s
P2P Network Verification / p2p-verification (push) Successful in 3s
Security Scanning / security-scan (push) Successful in 40s
Smart Contract Tests / test-solidity (map[name:aitbc-token path:packages/solidity/aitbc-token]) (push) Successful in 15s
Smart Contract Tests / lint-solidity (push) Successful in 8s
Some checks failed
API Endpoint Tests / test-api-endpoints (push) Successful in 10s
Blockchain Synchronization Verification / sync-verification (push) Failing after 3s
CLI Tests / test-cli (push) Failing after 4s
Documentation Validation / validate-docs (push) Successful in 8s
Documentation Validation / validate-policies-strict (push) Successful in 4s
Integration Tests / test-service-integration (push) Successful in 38s
Multi-Node Blockchain Health Monitoring / health-check (push) Successful in 2s
P2P Network Verification / p2p-verification (push) Successful in 3s
Security Scanning / security-scan (push) Successful in 40s
Smart Contract Tests / test-solidity (map[name:aitbc-token path:packages/solidity/aitbc-token]) (push) Successful in 15s
Smart Contract Tests / lint-solidity (push) Successful in 8s
- Relocate blockchain-event-bridge README content to docs/apps/blockchain/blockchain-event-bridge.md - Relocate blockchain-explorer README content to docs/apps/blockchain/blockchain-explorer.md - Replace app READMEs with redirect notices pointing to new documentation location - Consolidate documentation in central docs/ directory for better organization
This commit is contained in:
17
docs/apps/plugins/README.md
Normal file
17
docs/apps/plugins/README.md
Normal file
@@ -0,0 +1,17 @@
|
||||
# Plugin Applications
|
||||
|
||||
Plugin system for extending AITBC functionality.
|
||||
|
||||
## Applications
|
||||
|
||||
- [Plugin Analytics](plugin-analytics.md) - Analytics plugin
|
||||
- [Plugin Marketplace](plugin-marketplace.md) - Marketplace plugin
|
||||
- [Plugin Registry](plugin-registry.md) - Plugin registry
|
||||
- [Plugin Security](plugin-security.md) - Security plugin
|
||||
|
||||
## Features
|
||||
|
||||
- Plugin discovery and registration
|
||||
- Plugin marketplace
|
||||
- Analytics integration
|
||||
- Security scanning
|
||||
214
docs/apps/plugins/plugin-analytics.md
Normal file
214
docs/apps/plugins/plugin-analytics.md
Normal file
@@ -0,0 +1,214 @@
|
||||
# Plugin Analytics
|
||||
|
||||
## Status
|
||||
✅ Operational
|
||||
|
||||
## Overview
|
||||
Analytics plugin for collecting, processing, and analyzing data from various AITBC components and services.
|
||||
|
||||
## Architecture
|
||||
|
||||
### Core Components
|
||||
- **Data Collector**: Collects data from services and plugins
|
||||
- **Data Processor**: Processes and normalizes collected data
|
||||
- **Analytics Engine**: Performs analytics and generates insights
|
||||
- **Report Generator**: Generates reports and visualizations
|
||||
- **Storage Manager**: Manages data storage and retention
|
||||
|
||||
## Quick Start (End Users)
|
||||
|
||||
### Prerequisites
|
||||
- Python 3.13+
|
||||
- PostgreSQL database
|
||||
- Access to service metrics endpoints
|
||||
|
||||
### Installation
|
||||
```bash
|
||||
cd /opt/aitbc/apps/plugin-analytics
|
||||
.venv/bin/pip install -r requirements.txt
|
||||
```
|
||||
|
||||
### Configuration
|
||||
Set environment variables in `.env`:
|
||||
```bash
|
||||
DATABASE_URL=postgresql://user:pass@localhost/analytics
|
||||
COLLECTION_INTERVAL=300
|
||||
RETENTION_DAYS=90
|
||||
```
|
||||
|
||||
### Running the Service
|
||||
```bash
|
||||
.venv/bin/python main.py
|
||||
```
|
||||
|
||||
## Developer Guide
|
||||
|
||||
### Development Setup
|
||||
1. Clone the repository
|
||||
2. Create virtual environment: `python -m venv .venv`
|
||||
3. Install dependencies: `pip install -r requirements.txt`
|
||||
4. Set up database
|
||||
5. Configure data sources
|
||||
6. Run tests: `pytest tests/`
|
||||
|
||||
### Project Structure
|
||||
```
|
||||
plugin-analytics/
|
||||
├── src/
|
||||
│ ├── data_collector/ # Data collection
|
||||
│ ├── data_processor/ # Data processing
|
||||
│ ├── analytics_engine/ # Analytics engine
|
||||
│ ├── report_generator/ # Report generation
|
||||
│ └── storage_manager/ # Storage management
|
||||
├── tests/ # Test suite
|
||||
└── pyproject.toml # Project configuration
|
||||
```
|
||||
|
||||
### Testing
|
||||
```bash
|
||||
# Run all tests
|
||||
pytest tests/
|
||||
|
||||
# Run data collector tests
|
||||
pytest tests/test_collector.py
|
||||
|
||||
# Run analytics engine tests
|
||||
pytest tests/test_analytics.py
|
||||
```
|
||||
|
||||
## API Reference
|
||||
|
||||
### Data Collection
|
||||
|
||||
#### Start Collection
|
||||
```http
|
||||
POST /api/v1/analytics/collection/start
|
||||
Content-Type: application/json
|
||||
|
||||
{
|
||||
"data_source": "string",
|
||||
"interval": 300
|
||||
}
|
||||
```
|
||||
|
||||
#### Stop Collection
|
||||
```http
|
||||
POST /api/v1/analytics/collection/stop
|
||||
Content-Type: application/json
|
||||
|
||||
{
|
||||
"collection_id": "string"
|
||||
}
|
||||
```
|
||||
|
||||
#### Get Collection Status
|
||||
```http
|
||||
GET /api/v1/analytics/collection/status
|
||||
```
|
||||
|
||||
### Analytics
|
||||
|
||||
#### Run Analysis
|
||||
```http
|
||||
POST /api/v1/analytics/analyze
|
||||
Content-Type: application/json
|
||||
|
||||
{
|
||||
"analysis_type": "trend|anomaly|correlation",
|
||||
"data_source": "string",
|
||||
"time_range": "1h|1d|1w"
|
||||
}
|
||||
```
|
||||
|
||||
#### Get Analysis Results
|
||||
```http
|
||||
GET /api/v1/analytics/results/{analysis_id}
|
||||
```
|
||||
|
||||
### Reports
|
||||
|
||||
#### Generate Report
|
||||
```http
|
||||
POST /api/v1/analytics/reports/generate
|
||||
Content-Type: application/json
|
||||
|
||||
{
|
||||
"report_type": "summary|detailed|custom",
|
||||
"data_source": "string",
|
||||
"time_range": "1d|1w|1m"
|
||||
}
|
||||
```
|
||||
|
||||
#### Get Report
|
||||
```http
|
||||
GET /api/v1/analytics/reports/{report_id}
|
||||
```
|
||||
|
||||
#### List Reports
|
||||
```http
|
||||
GET /api/v1/analytics/reports?limit=10
|
||||
```
|
||||
|
||||
### Data Management
|
||||
|
||||
#### Query Data
|
||||
```http
|
||||
POST /api/v1/analytics/data/query
|
||||
Content-Type: application/json
|
||||
|
||||
{
|
||||
"data_source": "string",
|
||||
"filters": {},
|
||||
"time_range": "1h"
|
||||
}
|
||||
```
|
||||
|
||||
#### Export Data
|
||||
```http
|
||||
POST /api/v1/analytics/data/export
|
||||
Content-Type: application/json
|
||||
|
||||
{
|
||||
"data_source": "string",
|
||||
"format": "csv|json",
|
||||
"time_range": "1d"
|
||||
}
|
||||
```
|
||||
|
||||
## Configuration
|
||||
|
||||
### Environment Variables
|
||||
- `DATABASE_URL`: PostgreSQL connection string
|
||||
- `COLLECTION_INTERVAL`: Data collection interval (default: 300s)
|
||||
- `RETENTION_DAYS`: Data retention period (default: 90 days)
|
||||
- `MAX_BATCH_SIZE`: Maximum batch size for processing
|
||||
|
||||
### Data Sources
|
||||
- **Blockchain Metrics**: Blockchain node metrics
|
||||
- **Exchange Data**: Exchange trading data
|
||||
- **Agent Activity**: Agent coordination data
|
||||
- **System Metrics**: System performance metrics
|
||||
|
||||
### Analysis Types
|
||||
- **Trend Analysis**: Identify trends over time
|
||||
- **Anomaly Detection**: Detect unusual patterns
|
||||
- **Correlation Analysis**: Find correlations between metrics
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
**Data not collecting**: Check data source connectivity and configuration.
|
||||
|
||||
**Analysis not running**: Verify data availability and analysis parameters.
|
||||
|
||||
**Report generation failed**: Check data completeness and report configuration.
|
||||
|
||||
**Storage full**: Review retention policy and data growth rate.
|
||||
|
||||
## Security Notes
|
||||
|
||||
- Secure database access credentials
|
||||
- Implement data encryption at rest
|
||||
- Validate all data inputs
|
||||
- Implement access controls for sensitive data
|
||||
- Regularly audit data access logs
|
||||
- Comply with data retention policies
|
||||
223
docs/apps/plugins/plugin-marketplace.md
Normal file
223
docs/apps/plugins/plugin-marketplace.md
Normal file
@@ -0,0 +1,223 @@
|
||||
# Plugin Marketplace
|
||||
|
||||
## Status
|
||||
✅ Operational
|
||||
|
||||
## Overview
|
||||
Marketplace plugin for discovering, installing, and managing AITBC plugins and extensions.
|
||||
|
||||
## Architecture
|
||||
|
||||
### Core Components
|
||||
- **Plugin Catalog**: Catalog of available plugins
|
||||
- **Plugin Installer**: Handles plugin installation and updates
|
||||
- **Dependency Manager**: Manages plugin dependencies
|
||||
- **Version Manager**: Handles plugin versioning
|
||||
- **License Manager**: Manages plugin licenses
|
||||
|
||||
## Quick Start (End Users)
|
||||
|
||||
### Prerequisites
|
||||
- Python 3.13+
|
||||
- Internet access for plugin downloads
|
||||
- Sufficient disk space for plugins
|
||||
|
||||
### Installation
|
||||
```bash
|
||||
cd /opt/aitbc/apps/plugin-marketplace
|
||||
.venv/bin/pip install -r requirements.txt
|
||||
```
|
||||
|
||||
### Configuration
|
||||
Set environment variables in `.env`:
|
||||
```bash
|
||||
PLUGIN_REGISTRY_URL=https://plugins.aitbc.com
|
||||
INSTALLATION_PATH=/opt/aitbc/plugins
|
||||
AUTO_UPDATE_ENABLED=false
|
||||
```
|
||||
|
||||
### Running the Service
|
||||
```bash
|
||||
.venv/bin/python main.py
|
||||
```
|
||||
|
||||
## Developer Guide
|
||||
|
||||
### Development Setup
|
||||
1. Clone the repository
|
||||
2. Create virtual environment: `python -m venv .venv`
|
||||
3. Install dependencies: `pip install -r requirements.txt`
|
||||
4. Configure plugin registry
|
||||
5. Run tests: `pytest tests/`
|
||||
|
||||
### Project Structure
|
||||
```
|
||||
plugin-marketplace/
|
||||
├── src/
|
||||
│ ├── plugin_catalog/ # Plugin catalog
|
||||
│ ├── plugin_installer/ # Plugin installation
|
||||
│ ├── dependency_manager/ # Dependency management
|
||||
│ ├── version_manager/ # Version management
|
||||
│ └── license_manager/ # License management
|
||||
├── tests/ # Test suite
|
||||
└── pyproject.toml # Project configuration
|
||||
```
|
||||
|
||||
### Testing
|
||||
```bash
|
||||
# Run all tests
|
||||
pytest tests/
|
||||
|
||||
# Run installer tests
|
||||
pytest tests/test_installer.py
|
||||
|
||||
# Run dependency manager tests
|
||||
pytest tests/test_dependencies.py
|
||||
```
|
||||
|
||||
## API Reference
|
||||
|
||||
### Plugin Catalog
|
||||
|
||||
#### List Plugins
|
||||
```http
|
||||
GET /api/v1/marketplace/plugins?category=analytics&limit=20
|
||||
```
|
||||
|
||||
#### Get Plugin Details
|
||||
```http
|
||||
GET /api/v1/marketplace/plugins/{plugin_id}
|
||||
```
|
||||
|
||||
#### Search Plugins
|
||||
```http
|
||||
POST /api/v1/marketplace/plugins/search
|
||||
Content-Type: application/json
|
||||
|
||||
{
|
||||
"query": "analytics",
|
||||
"filters": {
|
||||
"category": "string",
|
||||
"version": "string"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
### Plugin Installation
|
||||
|
||||
#### Install Plugin
|
||||
```http
|
||||
POST /api/v1/marketplace/plugins/install
|
||||
Content-Type: application/json
|
||||
|
||||
{
|
||||
"plugin_id": "string",
|
||||
"version": "string",
|
||||
"auto_dependencies": true
|
||||
}
|
||||
```
|
||||
|
||||
#### Uninstall Plugin
|
||||
```http
|
||||
DELETE /api/v1/marketplace/plugins/{plugin_id}
|
||||
```
|
||||
|
||||
#### Update Plugin
|
||||
```http
|
||||
POST /api/v1/marketplace/plugins/{plugin_id}/update
|
||||
Content-Type: application/json
|
||||
|
||||
{
|
||||
"version": "string"
|
||||
}
|
||||
```
|
||||
|
||||
#### Get Installation Status
|
||||
```http
|
||||
GET /api/v1/marketplace/plugins/{plugin_id}/status
|
||||
```
|
||||
|
||||
### Dependencies
|
||||
|
||||
#### Get Plugin Dependencies
|
||||
```http
|
||||
GET /api/v1/marketplace/plugins/{plugin_id}/dependencies
|
||||
```
|
||||
|
||||
#### Resolve Dependencies
|
||||
```http
|
||||
POST /api/v1/marketplace/dependencies/resolve
|
||||
Content-Type: application/json
|
||||
|
||||
{
|
||||
"plugin_ids": ["plugin1", "plugin2"]
|
||||
}
|
||||
```
|
||||
|
||||
### Versions
|
||||
|
||||
#### List Plugin Versions
|
||||
```http
|
||||
GET /api/v1/marketplace/plugins/{plugin_id}/versions
|
||||
```
|
||||
|
||||
#### Get Version Compatibility
|
||||
```http
|
||||
GET /api/v1/marketplace/plugins/{plugin_id}/compatibility?version=1.0.0
|
||||
```
|
||||
|
||||
### Licenses
|
||||
|
||||
#### Validate License
|
||||
```http
|
||||
POST /api/v1/marketplace/licenses/validate
|
||||
Content-Type: application/json
|
||||
|
||||
{
|
||||
"plugin_id": "string",
|
||||
"license_key": "string"
|
||||
}
|
||||
```
|
||||
|
||||
#### Get License Info
|
||||
```http
|
||||
GET /api/v1/marketplace/plugins/{plugin_id}/license
|
||||
```
|
||||
|
||||
## Configuration
|
||||
|
||||
### Environment Variables
|
||||
- `PLUGIN_REGISTRY_URL`: URL for plugin registry
|
||||
- `INSTALLATION_PATH`: Path for plugin installation
|
||||
- `AUTO_UPDATE_ENABLED`: Enable automatic plugin updates
|
||||
- `MAX_CONCURRENT_INSTALLS`: Maximum concurrent installations
|
||||
|
||||
### Plugin Categories
|
||||
- **Analytics**: Data analysis and reporting plugins
|
||||
- **Security**: Security scanning and monitoring plugins
|
||||
- **Infrastructure**: Infrastructure management plugins
|
||||
- **Trading**: Trading and exchange plugins
|
||||
|
||||
### Installation Parameters
|
||||
- **Installation Path**: Directory for plugin installation
|
||||
- **Dependency Resolution**: Automatic dependency handling
|
||||
- **Version Constraints**: Version compatibility checks
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
**Plugin installation failed**: Check plugin compatibility and dependencies.
|
||||
|
||||
**License validation failed**: Verify license key and plugin ID.
|
||||
|
||||
**Dependency resolution failed**: Check dependency conflicts and versions.
|
||||
|
||||
**Auto-update not working**: Verify auto-update configuration and registry connectivity.
|
||||
|
||||
## Security Notes
|
||||
|
||||
- Validate plugin signatures before installation
|
||||
- Scan plugins for security vulnerabilities
|
||||
- Use HTTPS for plugin downloads
|
||||
- Implement plugin sandboxing
|
||||
- Regularly update plugins for security patches
|
||||
- Monitor for malicious plugin behavior
|
||||
217
docs/apps/plugins/plugin-registry.md
Normal file
217
docs/apps/plugins/plugin-registry.md
Normal file
@@ -0,0 +1,217 @@
|
||||
# Plugin Registry
|
||||
|
||||
## Status
|
||||
✅ Operational
|
||||
|
||||
## Overview
|
||||
Registry plugin for managing plugin metadata, versions, and availability in the AITBC ecosystem.
|
||||
|
||||
## Architecture
|
||||
|
||||
### Core Components
|
||||
- **Registry Database**: Stores plugin metadata and versions
|
||||
- **Metadata Manager**: Manages plugin metadata
|
||||
- **Version Controller**: Controls plugin versioning
|
||||
- **Availability Checker**: Checks plugin availability
|
||||
- **Indexer**: Indexes plugins for search
|
||||
|
||||
## Quick Start (End Users)
|
||||
|
||||
### Prerequisites
|
||||
- Python 3.13+
|
||||
- PostgreSQL database
|
||||
- Storage for plugin files
|
||||
|
||||
### Installation
|
||||
```bash
|
||||
cd /opt/aitbc/apps/plugin-registry
|
||||
.venv/bin/pip install -r requirements.txt
|
||||
```
|
||||
|
||||
### Configuration
|
||||
Set environment variables in `.env`:
|
||||
```bash
|
||||
DATABASE_URL=postgresql://user:pass@localhost/plugin_registry
|
||||
STORAGE_PATH=/opt/aitbc/plugins/storage
|
||||
INDEXING_ENABLED=true
|
||||
```
|
||||
|
||||
### Running the Service
|
||||
```bash
|
||||
.venv/bin/python main.py
|
||||
```
|
||||
|
||||
## Developer Guide
|
||||
|
||||
### Development Setup
|
||||
1. Clone the repository
|
||||
2. Create virtual environment: `python -m venv .venv`
|
||||
3. Install dependencies: `pip install -r requirements.txt`
|
||||
4. Set up database
|
||||
5. Configure storage path
|
||||
6. Run tests: `pytest tests/`
|
||||
|
||||
### Project Structure
|
||||
```
|
||||
plugin-registry/
|
||||
├── src/
|
||||
│ ├── registry_database/ # Registry database
|
||||
│ ├── metadata_manager/ # Metadata management
|
||||
│ ├── version_controller/ # Version control
|
||||
│ ├── availability_checker/ # Availability checking
|
||||
│ └── indexer/ # Plugin indexing
|
||||
├── storage/ # Plugin storage
|
||||
├── tests/ # Test suite
|
||||
└── pyproject.toml # Project configuration
|
||||
```
|
||||
|
||||
### Testing
|
||||
```bash
|
||||
# Run all tests
|
||||
pytest tests/
|
||||
|
||||
# Run registry database tests
|
||||
pytest tests/test_registry.py
|
||||
|
||||
# Run indexer tests
|
||||
pytest tests/test_indexer.py
|
||||
```
|
||||
|
||||
## API Reference
|
||||
|
||||
### Plugin Registration
|
||||
|
||||
#### Register Plugin
|
||||
```http
|
||||
POST /api/v1/registry/plugins
|
||||
Content-Type: application/json
|
||||
|
||||
{
|
||||
"plugin_id": "string",
|
||||
"name": "string",
|
||||
"version": "1.0.0",
|
||||
"description": "string",
|
||||
"author": "string",
|
||||
"category": "string",
|
||||
"metadata": {}
|
||||
}
|
||||
```
|
||||
|
||||
#### Update Plugin Metadata
|
||||
```http
|
||||
PUT /api/v1/registry/plugins/{plugin_id}
|
||||
Content-Type: application/json
|
||||
|
||||
{
|
||||
"version": "1.0.1",
|
||||
"description": "updated description",
|
||||
"metadata": {}
|
||||
}
|
||||
```
|
||||
|
||||
#### Get Plugin Metadata
|
||||
```http
|
||||
GET /api/v1/registry/plugins/{plugin_id}
|
||||
```
|
||||
|
||||
### Version Management
|
||||
|
||||
#### Add Version
|
||||
```http
|
||||
POST /api/v1/registry/plugins/{plugin_id}/versions
|
||||
Content-Type: application/json
|
||||
|
||||
{
|
||||
"version": "1.1.0",
|
||||
"changes": ["fix1", "feature2"],
|
||||
"compatibility": {}
|
||||
}
|
||||
```
|
||||
|
||||
#### List Versions
|
||||
```http
|
||||
GET /api/v1/registry/plugins/{plugin_id}/versions
|
||||
```
|
||||
|
||||
#### Get Latest Version
|
||||
```http
|
||||
GET /api/v1/registry/plugins/{plugin_id}/latest
|
||||
```
|
||||
|
||||
### Availability
|
||||
|
||||
#### Check Availability
|
||||
```http
|
||||
GET /api/v1/registry/plugins/{plugin_id}/availability?version=1.0.0
|
||||
```
|
||||
|
||||
#### Update Availability
|
||||
```http
|
||||
POST /api/v1/registry/plugins/{plugin_id}/availability
|
||||
Content-Type: application/json
|
||||
|
||||
{
|
||||
"version": "1.0.0",
|
||||
"available": true,
|
||||
"download_url": "string"
|
||||
}
|
||||
```
|
||||
|
||||
### Search
|
||||
|
||||
#### Search Plugins
|
||||
```http
|
||||
POST /api/v1/registry/search
|
||||
Content-Type: application/json
|
||||
|
||||
{
|
||||
"query": "analytics",
|
||||
"filters": {
|
||||
"category": "string",
|
||||
"author": "string",
|
||||
"version": "string"
|
||||
},
|
||||
"limit": 20
|
||||
}
|
||||
```
|
||||
|
||||
#### Reindex Plugins
|
||||
```http
|
||||
POST /api/v1/registry/reindex
|
||||
```
|
||||
|
||||
## Configuration
|
||||
|
||||
### Environment Variables
|
||||
- `DATABASE_URL`: PostgreSQL connection string
|
||||
- `STORAGE_PATH`: Path for plugin storage
|
||||
- `INDEXING_ENABLED`: Enable plugin indexing
|
||||
- `MAX_METADATA_SIZE`: Maximum metadata size
|
||||
|
||||
### Registry Parameters
|
||||
- **Plugin ID Format**: Format for plugin identifiers
|
||||
- **Version Schema**: Version numbering scheme
|
||||
- **Metadata Schema**: Metadata validation schema
|
||||
|
||||
### Indexing
|
||||
- **Full Text Search**: Enable full text search
|
||||
- **Faceted Search**: Enable faceted search
|
||||
- **Index Refresh Interval**: Index refresh frequency
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
**Plugin registration failed**: Validate plugin metadata and version format.
|
||||
|
||||
**Version conflict**: Check existing versions and compatibility rules.
|
||||
|
||||
**Index not updating**: Verify indexing configuration and database connectivity.
|
||||
|
||||
**Storage full**: Review storage usage and cleanup old versions.
|
||||
|
||||
## Security Notes
|
||||
|
||||
- Validate plugin metadata on registration
|
||||
- Implement access controls for registry operations
|
||||
- Scan plugins for security issues
|
||||
- Regularly audit registry entries
|
||||
- Implement rate limiting for API endpoints
|
||||
218
docs/apps/plugins/plugin-security.md
Normal file
218
docs/apps/plugins/plugin-security.md
Normal file
@@ -0,0 +1,218 @@
|
||||
# Plugin Security
|
||||
|
||||
## Status
|
||||
✅ Operational
|
||||
|
||||
## Overview
|
||||
Security plugin for scanning, validating, and monitoring AITBC plugins for security vulnerabilities and compliance.
|
||||
|
||||
## Architecture
|
||||
|
||||
### Core Components
|
||||
- **Vulnerability Scanner**: Scans plugins for security vulnerabilities
|
||||
- **Code Analyzer**: Analyzes plugin code for security issues
|
||||
- **Dependency Checker**: Checks plugin dependencies for vulnerabilities
|
||||
- **Compliance Validator**: Validates plugin compliance with security standards
|
||||
- **Policy Engine**: Enforces security policies
|
||||
|
||||
## Quick Start (End Users)
|
||||
|
||||
### Prerequisites
|
||||
- Python 3.13+
|
||||
- Access to plugin files
|
||||
- Vulnerability database access
|
||||
|
||||
### Installation
|
||||
```bash
|
||||
cd /opt/aitbc/apps/plugin-security
|
||||
.venv/bin/pip install -r requirements.txt
|
||||
```
|
||||
|
||||
### Configuration
|
||||
Set environment variables in `.env`:
|
||||
```bash
|
||||
VULN_DB_URL=https://vuln-db.example.com
|
||||
SCAN_DEPTH=full
|
||||
COMPLIANCE_STANDARDS=OWASP,SANS
|
||||
POLICY_FILE=/path/to/policies.yaml
|
||||
```
|
||||
|
||||
### Running the Service
|
||||
```bash
|
||||
.venv/bin/python main.py
|
||||
```
|
||||
|
||||
## Developer Guide
|
||||
|
||||
### Development Setup
|
||||
1. Clone the repository
|
||||
2. Create virtual environment: `python -m venv .venv`
|
||||
3. Install dependencies: `pip install -r requirements.txt`
|
||||
4. Configure vulnerability database
|
||||
5. Configure security policies
|
||||
6. Run tests: `pytest tests/`
|
||||
|
||||
### Project Structure
|
||||
```
|
||||
plugin-security/
|
||||
├── src/
|
||||
│ ├── vulnerability_scanner/ # Vulnerability scanning
|
||||
│ ├── code_analyzer/ # Code analysis
|
||||
│ ├── dependency_checker/ # Dependency checking
|
||||
│ ├── compliance_validator/ # Compliance validation
|
||||
│ └── policy_engine/ # Policy enforcement
|
||||
├── policies/ # Security policies
|
||||
├── tests/ # Test suite
|
||||
└── pyproject.toml # Project configuration
|
||||
```
|
||||
|
||||
### Testing
|
||||
```bash
|
||||
# Run all tests
|
||||
pytest tests/
|
||||
|
||||
# Run vulnerability scanner tests
|
||||
pytest tests/test_scanner.py
|
||||
|
||||
# Run compliance validator tests
|
||||
pytest tests/test_compliance.py
|
||||
```
|
||||
|
||||
## API Reference
|
||||
|
||||
### Vulnerability Scanning
|
||||
|
||||
#### Scan Plugin
|
||||
```http
|
||||
POST /api/v1/security/scan
|
||||
Content-Type: application/json
|
||||
|
||||
{
|
||||
"plugin_id": "string",
|
||||
"version": "1.0.0",
|
||||
"scan_depth": "quick|full",
|
||||
"scan_types": ["code", "dependencies", "configuration"]
|
||||
}
|
||||
```
|
||||
|
||||
#### Get Scan Results
|
||||
```http
|
||||
GET /api/v1/security/scan/{scan_id}
|
||||
```
|
||||
|
||||
#### Get Scan History
|
||||
```http
|
||||
GET /api/v1/security/scan/history?plugin_id=string
|
||||
```
|
||||
|
||||
### Code Analysis
|
||||
|
||||
#### Analyze Code
|
||||
```http
|
||||
POST /api/v1/security/analyze
|
||||
Content-Type: application/json
|
||||
|
||||
{
|
||||
"plugin_id": "string",
|
||||
"code_path": "/path/to/code",
|
||||
"analysis_types": ["sast", "secrets", "quality"]
|
||||
}
|
||||
```
|
||||
|
||||
#### Get Analysis Report
|
||||
```http
|
||||
GET /api/v1/security/analyze/{analysis_id}
|
||||
```
|
||||
|
||||
### Dependency Checking
|
||||
|
||||
#### Check Dependencies
|
||||
```http
|
||||
POST /api/v1/security/dependencies/check
|
||||
Content-Type: application/json
|
||||
|
||||
{
|
||||
"plugin_id": "string",
|
||||
"dependencies": [{"name": "string", "version": "string"}]
|
||||
}
|
||||
```
|
||||
|
||||
#### Get Vulnerability Report
|
||||
```http
|
||||
GET /api/v1/security/dependencies/vulnerabilities?plugin_id=string
|
||||
```
|
||||
|
||||
### Compliance Validation
|
||||
|
||||
#### Validate Compliance
|
||||
```http
|
||||
POST /api/v1/security/compliance/validate
|
||||
Content-Type: application/json
|
||||
|
||||
{
|
||||
"plugin_id": "string",
|
||||
"standards": ["OWASP", "SANS"],
|
||||
"severity": "high|medium|low"
|
||||
}
|
||||
```
|
||||
|
||||
#### Get Compliance Report
|
||||
```http
|
||||
GET /api/v1/security/compliance/report/{validation_id}
|
||||
```
|
||||
|
||||
### Policy Enforcement
|
||||
|
||||
#### Check Policy Compliance
|
||||
```http
|
||||
POST /api/v1/security/policies/check
|
||||
Content-Type: application/json
|
||||
|
||||
{
|
||||
"plugin_id": "string",
|
||||
"policy_name": "string"
|
||||
}
|
||||
```
|
||||
|
||||
#### List Policies
|
||||
```http
|
||||
GET /api/v1/security/policies
|
||||
```
|
||||
|
||||
## Configuration
|
||||
|
||||
### Environment Variables
|
||||
- `VULN_DB_URL`: Vulnerability database URL
|
||||
- `SCAN_DEPTH`: Default scan depth (quick/full)
|
||||
- `COMPLIANCE_STANDARDS`: Compliance standards to enforce
|
||||
- `POLICY_FILE`: Path to security policies file
|
||||
|
||||
### Scan Types
|
||||
- **SAST**: Static Application Security Testing
|
||||
- **Secrets Detection**: Detect hardcoded secrets
|
||||
- **Dependency Scanning**: Scan dependencies for vulnerabilities
|
||||
- **Configuration Analysis**: Analyze configuration files
|
||||
|
||||
### Compliance Standards
|
||||
- **OWASP**: OWASP security standards
|
||||
- **SANS**: SANS security controls
|
||||
- **CIS**: CIS benchmarks
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
**Scan not running**: Check vulnerability database connectivity and plugin accessibility.
|
||||
|
||||
**False positives**: Review scan rules and adjust severity thresholds.
|
||||
|
||||
**Compliance validation failed**: Review plugin code against compliance standards.
|
||||
|
||||
**Policy check failed**: Verify policy configuration and plugin compliance.
|
||||
|
||||
## Security Notes
|
||||
|
||||
- Regularly update vulnerability database
|
||||
- Use isolated environment for scanning
|
||||
- Implement rate limiting for scan requests
|
||||
- Secure scan results storage
|
||||
- Regularly audit security policies
|
||||
- Monitor for security incidents
|
||||
Reference in New Issue
Block a user