


![]()
![Status]()
![Python]()

![CI]()
![Security]()
![Docker]()
![codecov]()
So, GDPR-compliant AI infrastructure standard for the European Union.
> Status: Concept / RFC -- NSS v3.1.1 is a conceptual standard and reference architecture. It has not been independently tested, audited, or by third parties. The code in this repository is a reference implementation for demonstration purposes. Compliance ratings are self-assessed design targets, not certified results. Contributions, feedback, and peer review are welcome.
---
NSS (Nexus So Standard) proposes a 6-layer defensi with Guardian Shield for enterprise AI deployments. It is designed around Mistral AI models with local Ollama inference, targeting zero Cloud Act exposure and full EU data so.
NSS is a conceptual framework designed to meet European regulatory requirements, including GDPR and the EU AI Act. The architecture targets pri principles at every layer, from knowledge storage through cogniti to go o. All components are designed to operate within EU borders. This is a design specification and reference implementation -- production readiness requires independent security audits, penetration testing, and compliance certification.
---
#### Layer Stack (Data Flow)
#### Guardian Shield Defense Mechanisms
#### Microservice Communication
#### Privacy & Compliance Flow
Each layer enforces strict isolation boundaries. Requests flow upward from the Knowledge Fabric through Agent Execution, are filtered by the Cogniti, protected by Guardian Shield, and go by the Go Plane. No layer can be bypassed.
---
| Service | Port | Bind | Description |
|---------|------|------|-------------|
| Cogniti | 11337 | External (only entry point) | PII redaction, STEER, PNC, HMAC, pipeline orchestration |
| Guardian Shield | 11338 | Internal (127.0.0.1) | MARS scoring, SENTINEL check, APEX routing, SHIELD, VIGIL |
| Go Plane | 11339 | Internal (127.0.0.1) | Policy e, privacy budget, DPIA, audit trail |
| Metrics Server | 11340 | Internal (127.0.0.1) | Prometheus-compatible operational metrics |
| Qdrant DB | 6333 | Internal (127.0.0.1) | SAG-encrypted storage for RAG |
See Port Schema for network isolation and firewall configuration.
---
---
> Prerequisites: Python 3.11+, Ollama installed and running, Docker (for Qdrant and Redis).
---
:11337)| Method | Endpoint | Description |
|--------|----------|-------------|
| GET | /health | Li/readiness probe |
| GET | /metrics | Operational metrics |
| POST | /v1/process | Full 6-layer pipeline (HMAC → Policy → PII → SENTINEL → MARS → APEX → SHIELD → LLM → Budget) |
| POST | /v1/tools/execute | Sandboxed tool execution with VIGIL pre-check |
| POST | /v1/unlearn/{user_id} | GDPR Art. 17 right-to-be-forgotten orchestrator |
:11338)| Method | Endpoint | Description |
|--------|----------|-------------|
| GET | /health | Service health check |
| POST | /v1/mars/score | MARS risk scoring (0-1 score, tier 0-3) |
| POST | /v1/sentinel/check | SENTINEL 3-method injection defense |
| POST | /v1/apex/route | APEX intelligent model routing |
| POST | /v1/shield/enhance | SHIELD defensi wrapping |
| POST | /v1/vigil/check | VIGIL tool-call CIA |
:11339)| Method | Endpoint | Description |
|--------|----------|-------------|
| GET | /health | Service health check |
| POST | /v1/policy/e | OPA-style policy e (role, risk, PII, tools) |
| GET | /v1/privacy/budget/{user_id} | Remaining epsilon budget for a user |
| POST | /v1/privacy/consume | Consume epsilon from privacy budget |
| POST | /v1/dpia/generate | Generate GDPR Art. 35 DPIA report |
| GET | /v1/audit/{audit_id} | Retrie audit trail entry |
| GET | /v1/audit | Retrieve all audit trail entries |
:11340)| Method | Endpoint | Description |
|--------|----------|-------------|
| GET | /health | Service health check |
| GET | /metrics | Full metrics snapshot (counters + histograms) |
| GET | /metrics/prometheus | Prometheus/OpenMetrics text format export |
---
| Module | File | Description |
|--------|------|-------------|
| Gateway Server | src/nss/gateway/server.py | FastAPI pipeline orchestrator, entry point for all requests |
| PII Redaction | src/nss/gateway/pii_redaction.py | Regex-based detection and redaction of emails, phones, IBANs, credit cards, IPv4 |
| STEER | src/nss/gateway/steer.py | Structured Transformation: language detection (DE/EN), pri context injection, normalization |
| PNC Compression | src/nss/gateway/pnc_compression.py | Prompt Normalization and Compression: deduplication, filler removal, token budget truncation |
| HMAC Signing | src/nss/gateway/hmac_signing.py | HMAC-SHA256 request signing and with timestamp-based replay protection |
| Module | File | Description |
|--------|------|-------------|
| Guardian Server | src/nss/guardian/server.py | FastAPI microservice exposing all Guardian components |
| MARS | src/nss/guardian/mars.py | Model Audit & Risk Scoring: LLM-assisted risk e (score 0-1, tier 0-3) |
| APEX | src/nss/guardian/apex.py | Adapti & Execution: intelligent model routing with cost optimization |
| SENTINEL | src/nss/guardian/sentinel.py | 3-method injection defense: regex rules + LLM analysis + embedding cosine similarity |
| SHIELD | src/nss/guardian/shield.py | Defensi injection: prepend/append safety tokens around user prompts |
| VIGIL | src/nss/guardian/vigil.py | Tool-call safety : CIA triad (Confidentiality, Integrity, A) |
| Module | File | Description |
|--------|------|-------------|
| Go Server | src/nss/go/server.py | FastAPI microservice for go endpoints |
| Policy Engine | src/nss/go/policy_engine.py | OPA/Rego simulation: role-based risk limits, PII privacy tiers, tool allowlists |
| Privacy Budget | src/nss/go/pri.py | Per-user differential privacy epsilon budget tracking with optional Redis persistence |
| DPIA Generator | src/nss/go/dpia.py | GDPR Article 35 DPIA auto-generation with 5 sections and markdown export |
| Module | File | Description |
|--------|------|-------------|
| DPSparse | src/nss/agent/dp_sparse_vote.py | Differentially private RAG: Laplace noise on similarity scores, budget tracking |
| Tool Sandbox | src/nss/agent/tool_isolation.py | WASM/WASI simulation with VIGIL pre-check and timeouts |
| Module | File | Description |
|--------|------|-------------|
| Store | src/nss/knowledge/.py | Qdrant wrapper with GDPR Art. 17 right-to-erasure, retention policy, auto-timestamps |
| Embeddings | src/nss/knowledge/embeddings.py | Sentence-transformer embedding service (all-MiniLM-L6-v2) |
| SAG Encryption | src/nss/knowledge/sag_encryption.py | AES-256-GCM encryption/decryption of payloads at rest |
| RAG Pipeline | src/nss/knowledge/rag_pipeline.py | Retrie Generation: embed → search → decrypt → augment prompt |
| Module | File | Description |
|--------|------|-------------|
| Config | src/nss/config.py | En configuration with NSS_ prefix |
| Models | src/nss/models.py | Pydantic v2 data models (NSSRequest, NSSResponse, RiskScore, SentinelResult, etc.) |
| Auth | src/nss/auth.py | JWT creation/ (HS256, 15min), RBAC (Admin/DataProcessor/Auditor/) |
| Audit | src/nss/audit.py | Immutable audit logging with SHA-256 hash-chain and optional Redis persistence |
| Metrics | src/nss/metrics.py | Lightweight Counter/Histogram registry with snapshot export |
| Middleware | src/nss/middleware.py | SecurityHeaders, TracingMiddleware (X-Trace-ID), RateLimitMiddleware (sliding window) |
| Cache | src/nss/cache.py | Redis async caching with graceful degradation (no-op when una) |
| Metrics Server | src/nss/metrics_server.py | Dedicated FastAPI metrics endpoint |
| LLM Client | src/nss/llm/ollama_client.py | Async Ollama client with health checks and confidence extraction |
| Model Config | src/nss/llm/model_config.py | Model tier definitions for APEX routing decisions |
---
209 tests across 35 test files, organized by layer:
| Category | Tests | Description |
|----------|-------|-------------|
| Gateway | 20 | PII redaction, HMAC signing, STEER, PNC compression |
| Guardian | 25 | MARS, APEX, SENTINEL (rules + async + embedding), SHIELD, VIGIL |
| Go | 18 | Policy engine, privacy budget, DPIA, go server |
| Agent | 13 | DPSparse (noise, budget, fallback), tool sandbox |
| Knowledge | 21 | store (retention, timestamps), embeddings, SAG encryption, RAG pipeline |
| LLM | 6 | Ollama client (generate, confidence, health) |
| Cross-Cutting | 25 | Audit, auth, metrics, middleware, cache, metrics server |
| Guardian Server | 6 | All Guardian endpoints |
| Go Server | 5 | All Go endpoints |
| Integration | 46 | Full pipeline, security enforcement, persistence, unlearning, privacy, multi-service, wiring |
---
/health and /metrics endpointsrequire_role() FastAPI dependency for endpoint-leRPUSH to nss:audit:log with graceful degradation() the entire chainnss_requests_total, nss_requests_blocked, nss_pii_entities_redacted, nss_prinss_request_latency_ms, nss_guardian_latency_msGET /metrics and Prometheus text format via GET /metrics/prometheus on port 11340nss:{layer}:{hash}---
| Standard | Rating | Status |
|----------|--------|--------|
| GDPR (General Data Protection Regulation) | 98/100 | Self-Assessed Design Target |
| EU AI Act | 96/100 | Self-Assessed Design Target |
| ISO 27001 | 4.1/5 | Aligned (Not Certified) |
| STRIDE Threat Model | 9.7/10 | Self-Assessed |
> Note: All compliance ratings are self-assessed design targets based on architectural analysis. They have not been independently or certified. Production deployments require formal audits by accredited bodies. See the Compliance section for methodology.
---
| Component | Technology | Purpose |
|-----------|-----------|--------|
| LLM Provider | Mistral AI | Foundation models (Mistral 7B, Mistral-Nemo 12B) |
| Local Inference | Ollama | On-premises model serving with EU data residency |
| Database | Qdrant | High-performance similarity search for RAG |
| Caching Layer | Redis | Session management and response caching |
| Policy Engine | OPA (simulated) | Go rules and access control dicts |
| API Framework | FastAPI | High-performance async HTTP for all 4 microservices |
| Auth | PyJWT | HS256 JWT tokens with RBAC |
| Embeddings | sentence-transformers | all-MiniLM-L6-v2 for SENTINEL and RAG |
| Runtime | Python 3.11+ | Core application runtime |
| Encryption | cryptography | AES-256-GCM for SAG payload encryption |
| Testing | pytest | 209 tests with asyncio support |
---
| Document | Description |
|----------|-------------|
| White Paper | Full technical specification and design rationale |
| API Reference | Complete REST API documentation for all 4 microservices |
| Architecture | Detailed architecture diagrams and component descriptions |
| ADRs | Architecture Decision Records (license, models, inference, layers, HMAC) |
| Port Schema | Microservice ports, network isolation, firewall rules |
| Security | Security model, threat analysis, and Guardian Shield documentation |
| Compliance | GDPR, EU AI Act, and ISO 27001 compliance documentation |
| Benchmarks | Reproducible benchmark methodology for performance metrics |
| Deployment | Production deployment guides and infrastructure requirements |
| Licensing | License terms, commercial options, and contributor agreements |
---
---
NSS is dual-licensed:
If you use NSS in a proprietary product or service, you must obtain a commercial license. Contact for details.
---
We welcome contributions from the community. Please read our Contributing Guide before submitting pull requests.
All contributors must agree to the Contributor License Agreement (CLA) to ensure license compatibility.
---
For security-related information, please see our Security Policy.
---
LEEI1337 -- Technical Architect
---
| Channel | Contact |
|---------|--------|
| Bug Reports | GitHub Issues |
| Feature Requests | Feature Request Template |
---
<p align="center">
Made in Austria | Powered by Mistral AI | Secured by Guardian Shield
</p>
开发语言:Python
Star 数:4
该项目属于防护思路方向的开源资源,代码结构清晰,适合安全研究人员学习参考。项目围绕6-Layer Defensive Architecture Sovereign, GDPR-compliant AI security standard for the EU Guardian Shield展开,提供了可运行的实现,对理解相关安全机制、工具原理与攻防技术具有较高的研究价值。
从技术实现角度看,此类项目的核心在于对底层原理的深入理解与工程化落地。开发者在研究过程中可以结合官方文档与社区讨论,梳理项目的初始化流程、核心模块职责与数据流转,逐步掌握其中的技术细节与设计思路。
1. 下载源码压缩包,解压到本地环境。
2. 根据项目类型准备对应的运行环境与依赖。
3. 按照 README 中的步骤完成配置与部署。
4. 在隔离的测试环境中运行验证,避免影响生产系统。
本资源来源于开源社区,仅供安全研究、技术学习与合法授权范围内的攻防演练使用,请勿用于任何非法或侵害他人权益的用途。使用本项目产生的一切后果由使用者自行承担。
| 资源标题 | nss - 6-Layer Defensive Architecture Sovereign, GDPR-co |
| 所属分类 | 防护思路 |
| 发布作者 | admin |
| 发布时间 | 2026-10-06 00:15:19 |
| 下载权限 | 免费下载 |
| 附件数量 | 2 个下载链接 |
| 浏览次数 | 263 |
| 讨论数量 | 0 |
| 主题状态 | 正常讨论中 |